diff options
author | Alexander Kurtakov | 2017-06-27 06:38:09 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-06-27 06:38:09 +0000 |
commit | c85cb5f21d55784f3e9cbb7e195020338598f4f0 (patch) | |
tree | 73f6310ea3ce55c5ba34e4b2d5f9e790c615b370 | |
parent | 96c08919e0de45982667042a8f650ccdb4d005f9 (diff) | |
download | rt.equinox.framework-c85cb5f21d55784f3e9cbb7e195020338598f4f0.tar.gz rt.equinox.framework-c85cb5f21d55784f3e9cbb7e195020338598f4f0.tar.xz rt.equinox.framework-c85cb5f21d55784f3e9cbb7e195020338598f4f0.zip |
Bug 518812 - Remove mozilla workarounds from launcher
Mozilla/Xulrunner support is being removed from SWT thus applying
workarounds for it in launcher is no longer needed.
Change-Id: If86168662b6c2ad244df85363233f623b1066fba
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
7 files changed, 3 insertions, 345 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.c b/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.c deleted file mode 100644 index a599589d5..000000000 --- a/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.c +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -/* Eclipse Mozilla Utility Methods */ - -#ifdef MOZILLA_FIX - -#include "eclipseMozilla.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <dirent.h> -#include <sys/stat.h> - -static char* prefixes[] = { - "xulrunner-1", - "mozilla-seamonkey-1", - "seamonkey-1", - "mozilla-1", - "mozilla-firefox-2", - "firefox-2", - "mozilla-firefox-3", - "firefox-3", - NULL -}; -static const int XULRUNNER_INDEX = 0; - -/* Filter function used by fixEnvForMozilla() for finding directories - * with a desired prefix. - */ -int filter(const struct dirent *dir) -{ -#if defined(__amd64__) || defined(__x86_64__) || defined(__powerpc64__) - char* root = "/usr/lib64/"; -#else - char* root = "/usr/lib/"; -#endif - -#if defined (SOLARIS) - /* - * The solaris compiler does not do static linking, so just check - * for a common lib to ensure that the install seems valid. - */ - char* testlib = "/libxpcom.so"; -#else - /* Ensure that the install is dynamically-linked and is built with GTK2 */ - char* testlib = "/components/libwidget_gtk2.so"; -#endif - - struct stat buf; - int index = 0; - char* dirname = (char *)dir->d_name; - - char* prefix = prefixes [index]; - while (prefix != NULL) - { - int prefixLength = strlen(prefix); - if (strncmp(dirname, prefix, prefixLength) == 0) - { - /* If a xulrunner install is found then success is immediate since - * xulrunner always provides an embeddable GRE. - */ - if (index == XULRUNNER_INDEX) return 1; /* include in scandir result */ - - int dirLength = strlen(dirname); - char* testpath = malloc (strlen(root) + dirLength + strlen(testlib) + 1); - strcpy(testpath, root); - strcat(testpath, dirname); - strcat(testpath, testlib); - int success = stat(testpath, &buf) == 0; - free(testpath); - if (success) - { - return 1; /* include in scandir result */ - } - } - prefix = prefixes [++index]; - } - return 0; /* exclude from scandir result */ -} - -#if defined (SOLARIS) -/* - * A replacement for - * scandir(const char *dir, struct dirent ***namelist, filter, alphasort); - * because scandir & alphasort don't exist on Solaris 9. - * Return the dirent->d_name that was sorted the highest according to strcoll, - * or NULL on error or if no entries matched the filter. - * The caller is responsible for freeing the returned string - */ -char * scan(const char * path) { - DIR *dir = NULL; - struct dirent * entry = NULL; - char * candidate = NULL; - - if ((dir = opendir(path)) == NULL) { - return NULL; - } - - while ((entry = readdir(dir)) != NULL) { - if (filter(entry)) { - if (candidate == NULL) { - candidate = strdup(entry->d_name); - } else if (strcoll(candidate, entry->d_name) < 0) { - free(candidate); - candidate = strdup(entry->d_name); - } - } - } - closedir(dir); - - return candidate; -} -#endif - -/* Set the environmnent required by the SWT Browser widget to bind to Mozilla. - * The SWT Browser widget relies on Mozilla on Linux. The LD_LIBRARY_PATH - * and the Mozilla environment variable MOZILLA_FIVE_HOME must point - * to the installation directory of Mozilla. - * - * 1. Use the location set by MOZILLA_FIVE_HOME if it is defined - * 2. Parse the file /etc/gre.conf if it is defined. This file is - * set by the RedtHat RPM manager. - * 3. Try some common installation locations. - */ -void fixEnvForMozilla() { - static int fixed = 0; - if (fixed) return; - { - char *ldPath = (char*)getenv("LD_LIBRARY_PATH"); - char *mozillaFiveHome = (char*)getenv("MOZILLA_FIVE_HOME"); - char *grePath = NULL; /* Gecko Runtime Environment Location */ - fixed = 1; - /* Always dup the string so we can free later */ - if (ldPath != NULL) ldPath = strdup(ldPath); - else ldPath = strdup(""); - - /* MOZILLA_FIVE_HOME (if defined) points to the Mozilla - * install directory. Don't look any further if it is set. - */ - if (mozillaFiveHome != NULL) - { - grePath = strdup(mozillaFiveHome); - } - - /* The file gre.conf (if available) points to the - * Mozilla install directory. Don't look any further if - * it is set. - */ - if (grePath == NULL) - { - struct stat buf; - FILE *file = NULL; -#if defined(__amd64__) || defined(__x86_64__) || defined(__powerpc64__) - if (stat("/etc/gre64.conf", &buf) == 0) - { - file = fopen("/etc/gre64.conf", "r"); - } - else if (stat("/etc/gre.d/gre64.conf", &buf) == 0) - { - file = fopen("/etc/gre.d/gre64.conf", "r"); - } else -#endif - if (stat("/etc/gre.conf", &buf) == 0) - { - file = fopen("/etc/gre.conf", "r"); - } - else if (stat("/etc/gre.d/gre.conf", &buf) == 0) - { - file = fopen("/etc/gre.d/gre.conf", "r"); - } - if (file != NULL) - { - char buffer[1024]; - char path[1024]; - while (fgets(buffer, 1024, file) != NULL) - { - if (sscanf(buffer, "GRE_PATH=%s", path) == 1) - { - int index = 0; - char* prefix = prefixes [index]; - while (prefix != NULL) - { - if (strstr(path, prefix)) - { - grePath = strdup(path); - break; - } - prefix = prefixes [++index]; - } - } - } - fclose(file); - } - } - - /* Try some common installation locations. */ - if (grePath == NULL) - { - /* try xulrunner-1*, mozilla-1*, firefox-2/3*, seamonkey-1* directories in /usr/lib/ */ -#if defined(__amd64__) || defined(__x86_64__) || defined(__powerpc64__) - char* dir = "/usr/lib64/"; -#else - char* dir = "/usr/lib/"; -#endif -#if defined (SOLARIS) - char * name = scan(dir); - if (name != NULL) { -#else - struct dirent **namelist; - int i; - int count = scandir(dir, &namelist, filter, alphasort); - if (count > 0) - { - /* count-1 is used below in an attempt to choose XULRunner - * any time one is found - */ - char* name = namelist [count - 1]->d_name; -#endif - grePath = malloc (strlen(dir) + strlen(name) + 1); - strcpy(grePath, dir); - strcat(grePath, name); -#if defined (SOLARIS) - free(name); -#else - for (i = 0; i < count; i++) { - free(namelist [i]); - } - free(namelist); -#endif - } - -#if defined (SOLARIS) - if (grePath == NULL) - { - /* some other typical installation locations */ - char* dirs[] = { - "/usr/sfw/lib/mozilla/", /* Solaris location */ - "/usr/lib/firefox/", /* OpenSolaris location */ - NULL - }; - - /* - * The solaris compiler does not do static linking, so just check - * for a common lib to ensure that the install seems valid. - */ - char* testlib = "libxpcom.so"; - - struct stat buf; - int index = 0; - - char* dir = dirs [index++]; - while (dir != NULL) - { - char* testpath = malloc (strlen(dir) + strlen(testlib) + 1); - strcpy(testpath, dir); - strcat(testpath, testlib); - int success = stat(testpath, &buf) == 0; - free(testpath); - if (success) - { - grePath = strdup(dir); - break; - } - dir = dirs [index++]; - } - } -#endif // SOLARIS - } - - if (grePath != NULL) - { - /* If grePath contains "xulrunner" then do not change the LD_LIBRARY_PATH, - * since it is likely that a xulrunner (not a mozilla or firefox) - * will be found at runtime. Note that MOZILLA_FIVE_HOME is still - * updated if grePath contains "xul" since this variable can act as - * a backup GRE to try if an initially-detected one fails to load. - */ - if (!strstr(grePath, "xulrunner")) { - ldPath = (char*)realloc(ldPath, strlen(ldPath) + strlen(grePath) + 2); - if (strlen(ldPath) > 0) strcat(ldPath, ":"); - strcat(ldPath, grePath); - setenv("LD_LIBRARY_PATH", ldPath, 1); - } - - if (mozillaFiveHome == NULL) setenv("MOZILLA_FIVE_HOME", grePath, 1); - free(grePath); - } - free(ldPath); - } -} -#endif /* MOZILLA_FIX */ diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.h b/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.h deleted file mode 100644 index e227741af..000000000 --- a/features/org.eclipse.equinox.executable.feature/library/eclipseMozilla.h +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifndef ECLIPSE_MOZILLA_H -#define ECLIPSE_MOZILLA_H - -/* Eclipse Mozilla Utility Methods */ - -#ifdef MOZILLA_FIX -extern void fixEnvForMozilla(); -#endif /* MOZILLA_FIX */ - -#endif /* ECLIPSE_MOZILLA_H */ diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c b/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c index bda8b3cb9..09aa37fe4 100644 --- a/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c +++ b/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c @@ -12,7 +12,6 @@ /* This file contains code common between GTK & Motif */ #include "eclipseOS.h" #include "eclipseCommon.h" -#include "eclipseMozilla.h" #include "eclipseUtil.h" #include "eclipseJNI.h" @@ -115,9 +114,6 @@ static void adjustLibraryPath( char * vmLibrary ) { int needAdjust = 0; char ** paths = NULL; -#ifdef MOZILLA_FIX - fixEnvForMozilla(); -#endif /* MOZILLA_FIX */ paths = getVMLibrarySearchPath(vmLibrary); diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c index bccbe8c80..65f1b0c8a 100644 --- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c +++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c @@ -11,7 +11,6 @@ * Tom Tromey (Red Hat, Inc.) *******************************************************************************/ -#include "eclipseMozilla.h" #include "eclipseCommon.h" #include "eclipseOS.h" #include "eclipseUtil.h" @@ -327,10 +326,6 @@ JavaResults* launchJavaVM( char* args[] ) pid_t jvmProcess, finishedProcess = 0; int exitCode; -#ifdef MOZILLA_FIX - fixEnvForMozilla(); -#endif /* MOZILLA_FIX */ - jvmProcess = fork(); if (jvmProcess == 0) { diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/make_aix.mak b/features/org.eclipse.equinox.executable.feature/library/gtk/make_aix.mak index 2d3a71d9b..439d68d96 100644 --- a/features/org.eclipse.equinox.executable.feature/library/gtk/make_aix.mak +++ b/features/org.eclipse.equinox.executable.feature/library/gtk/make_aix.mak @@ -32,7 +32,7 @@ PROGRAM_LIBRARY=$(PROGRAM_OUTPUT)_$(LIB_VERSION).so CC=gcc MAIN_OBJS = eclipseMain.o COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o -DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o eclipseShm.o eclipseNix.o +DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o EXEC = $(PROGRAM_OUTPUT) DLL = $(PROGRAM_LIBRARY) @@ -54,7 +54,6 @@ LFLAGS = ${M_ARCH} -shared CFLAGS = ${M_ARCH} -g -s -Wall\ -fpic \ -DAIX \ - -DMOZILLA_FIX \ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ @@ -91,9 +90,6 @@ eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h $(CC) $(CFLAGS) -c ../eclipseConfig.c -o eclipseConfig.o -eclipseMozilla.o: ../eclipseMozilla.c ../eclipseMozilla.h ../eclipseOS.h - $(CC) $(CFLAGS) -c ../eclipseMozilla.c -o eclipseMozilla.o - eclipseShm.o: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c $(CC) $(CFLAGS) -c ../eclipseShm.c -o eclipseShm.o diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak index e20823478..a1f0dc14a 100644 --- a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak +++ b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak @@ -37,7 +37,7 @@ endif CC?=gcc MAIN_OBJS = eclipseMain.o COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o -DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o eclipseShm.o eclipseNix.o +DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o EXEC = $(PROGRAM_OUTPUT) DLL = $(PROGRAM_LIBRARY) @@ -51,7 +51,6 @@ LFLAGS = ${M_ARCH} -shared -fpic -Wl,--export-dynamic CFLAGS = ${M_CFLAGS} ${M_ARCH} -g -s -Wall\ -fpic \ -DLINUX \ - -DMOZILLA_FIX \ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ @@ -88,9 +87,6 @@ eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h $(CC) $(CFLAGS) -c ../eclipseConfig.c -o eclipseConfig.o -eclipseMozilla.o: ../eclipseMozilla.c ../eclipseMozilla.h ../eclipseOS.h - $(CC) $(CFLAGS) -c ../eclipseMozilla.c -o eclipseMozilla.o - eclipseShm.o: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c $(CC) $(CFLAGS) -c ../eclipseShm.c -o eclipseShm.o diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/make_solaris.mak b/features/org.eclipse.equinox.executable.feature/library/gtk/make_solaris.mak index 4d41b5f65..47cd82465 100644 --- a/features/org.eclipse.equinox.executable.feature/library/gtk/make_solaris.mak +++ b/features/org.eclipse.equinox.executable.feature/library/gtk/make_solaris.mak @@ -33,7 +33,7 @@ PROGRAM_LIBRARY=$(PROGRAM_OUTPUT)_$(LIB_VERSION).so # Define the object modules to be compiled and flags. MAIN_OBJS = eclipseMain.o COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o -DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o eclipseShm.o eclipseNix.o +DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o PICFLAG = -K PIC # Optimize and remove all debugging information by default OPTFLAG = -O -s @@ -52,7 +52,6 @@ CFLAGS = ${M_ARCH} \ $(OPTFLAG) \ -DSOLARIS \ $(PICFLAG) \ - -DMOZILLA_FIX \ -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ -DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \ -DDEFAULT_WS="\"$(DEFAULT_WS)\"" \ @@ -88,9 +87,6 @@ eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h $(CC) $(CFLAGS) -c ../eclipseConfig.c -o eclipseConfig.o -eclipseMozilla.o: ../eclipseMozilla.c ../eclipseMozilla.h ../eclipseOS.h - $(CC) $(CFLAGS) -c ../eclipseMozilla.c -o eclipseMozilla.o - eclipseShm.o: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c $(CC) $(CFLAGS) -c ../eclipseShm.c -o eclipseShm.o |