diff options
author | Andrew Niefer | 2009-12-14 19:17:53 +0000 |
---|---|---|
committer | Andrew Niefer | 2009-12-14 19:17:53 +0000 |
commit | b39e87343bfc233f79e7aac9523561275dae2662 (patch) | |
tree | 2aeb58bc114d6fc4435fb10da11f941b026e13b2 /bundles/org.eclipse.equinox.executable/library | |
parent | 439979181a5d683b5216dc5dac260cebbe79c01f (diff) | |
download | rt.equinox.framework-b39e87343bfc233f79e7aac9523561275dae2662.tar.gz rt.equinox.framework-b39e87343bfc233f79e7aac9523561275dae2662.tar.xz rt.equinox.framework-b39e87343bfc233f79e7aac9523561275dae2662.zip |
bug 297631 - aix.motif libraries need to be installed
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library')
9 files changed, 112 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index d0b39638d..98a9d5d7b 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -256,14 +256,15 @@ static _TCHAR* splashBitmap = NULL; /* the actual splash bitmap */ static _TCHAR * startupArg = NULL; /* path of the startup.jar the user wants to run relative to the program path */ static _TCHAR* vmName = NULL; /* Java VM that the user wants to run */ static _TCHAR* name = NULL; /* program name */ -static _TCHAR* library = NULL; /* the shared library */ static _TCHAR* permGen = NULL; /* perm gen size for sun */ /* variables for ee options */ static _TCHAR* eeExecutable = NULL; static _TCHAR* eeConsole = NULL; static _TCHAR* eeLibrary = NULL; + _TCHAR* eeLibPath = NULL; /* this one is global so others can see it */ +_TCHAR* eclipseLibrary = NULL; /* the shared library */ /* Define a table for processing command line options. */ typedef struct @@ -344,7 +345,7 @@ static int consoleLauncher = 0; JNIEXPORT void setInitialArgs(int argc, _TCHAR** argv, _TCHAR* lib) { initialArgc = argc; initialArgv = argv; - library = lib; + eclipseLibrary = lib; } /* this method must match the RunMethod typedef in eclipseMain.c */ @@ -850,9 +851,9 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA (*progArgv)[ dst++ ] = officialName; /* And the shared library */ - if (library != NULL) { + if (eclipseLibrary != NULL) { (*progArgv)[ dst++ ] = LIBRARY; - (*progArgv)[ dst++ ] = library; + (*progArgv)[ dst++ ] = eclipseLibrary; } /* the startup jar */ diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h index 5e4194693..655f90122 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h +++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h @@ -45,6 +45,7 @@ extern _TCHAR* wsArg; extern _TCHAR dirSeparator; /* '/' or '\\' */ extern _TCHAR pathSeparator; /* separator used in PATH variable */ +extern _TCHAR* eclipseLibrary; /* path the the eclipse_<ver>.so shared library */ extern char *toNarrow(const _TCHAR* src); diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c index dc0a94710..3b85e0d2e 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c @@ -39,6 +39,7 @@ static int shouldShutdown(JNIEnv *env); static void JNI_ReleaseStringChars(JNIEnv *env, jstring s, const _TCHAR* data); static const _TCHAR* JNI_GetStringChars(JNIEnv *env, jstring str); static char * getMainClass(JNIEnv *env, _TCHAR * jarFile); +static void setLibraryLocation(JNIEnv *env, jobject obj); static JavaVM * jvm = 0; static JNIEnv *env = 0; @@ -114,6 +115,9 @@ JNIEXPORT jlong JNICALL get_splash_handle(JNIEnv * env, jobject obj){ JNIEXPORT void JNICALL show_splash(JNIEnv * env, jobject obj, jstring s){ const _TCHAR* data = NULL; + + setLibraryLocation(env, obj); + if(s != NULL) { data = JNI_GetStringChars(env, s); if(data != NULL) { @@ -130,6 +134,29 @@ JNIEXPORT void JNICALL takedown_splash(JNIEnv * env, jobject obj){ takeDownSplash(); } +/* + * On AIX we need the location of the eclipse shared library so that we + * can find the libeclipse-motif.so library. Reach into the JNIBridge + * object to get the "library" field. + */ +static void setLibraryLocation(JNIEnv * env, jobject obj) { + jclass bridge = (*env)->FindClass(env, "org/eclipse/equinox/launcher/JNIBridge"); + if (bridge != NULL) { + jfieldID libraryField = (*env)->GetFieldID(env, bridge, "library", "Ljava/lang/String;"); + if (libraryField != NULL) { + jstring stringObject = (jstring) (*env)->GetObjectField(env, obj, libraryField); + if (stringObject != NULL) { + const char * str = JNI_GetStringChars(env, stringObject); + eclipseLibrary = strdup(str); + JNI_ReleaseStringChars(env, stringObject, str); + } + } + } + if( (*env)->ExceptionOccurred(env) != 0 ){ + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } +} static void registerNatives(JNIEnv *env) { jclass bridge = (*env)->FindClass(env, "org/eclipse/equinox/launcher/JNIBridge"); diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c index fbe791c3b..3e9c13d6a 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseMain.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseMain.c @@ -43,7 +43,6 @@ typedef void (*SetInitialArgs)(int argc, _TCHAR*argv[], _TCHAR* library); static _TCHAR* name = NULL; /* program name */ static _TCHAR** userVMarg = NULL; /* user specific args for the Java VM */ static _TCHAR* programDir = NULL; /* directory where program resides */ -static _TCHAR* library = NULL; /* pathname of the eclipse shared library */ static _TCHAR* officialName = NULL; static int suppressErrors = 0; /* supress error dialogs */ @@ -57,6 +56,8 @@ static _TCHAR* checkForIni(int argc, _TCHAR* argv[]); static int initialArgc; static _TCHAR** initialArgv; +_TCHAR* eclipseLibrary; /* path to the eclipse shared library */ + #ifdef UNICODE extern int main(int, char**); int mainW(int, wchar_t**); @@ -154,10 +155,10 @@ int main( int argc, _TCHAR* argv[] ) programDir = getProgramDir(program); /* Find the eclipse library */ - library = findLibrary(library, program); + eclipseLibrary = findLibrary(eclipseLibrary, program); - if(library != NULL) - handle = loadLibrary(library); + if(eclipseLibrary != NULL) + handle = loadLibrary(eclipseLibrary); if(handle == NULL) { errorMsg = malloc( (_tcslen(libraryMsg) + _tcslen(officialName) + 10) * sizeof(_TCHAR) ); _stprintf( errorMsg, libraryMsg, officialName ); @@ -171,7 +172,7 @@ int main( int argc, _TCHAR* argv[] ) setArgs = (SetInitialArgs)findSymbol(handle, SET_INITIAL_ARGS); if(setArgs != NULL) - setArgs(initialArgc, initialArgv, library); + setArgs(initialArgc, initialArgv, eclipseLibrary); else { if(!suppressErrors) displayMessage(officialName, entryMsg); @@ -192,7 +193,7 @@ int main( int argc, _TCHAR* argv[] ) } unloadLibrary(handle); - free( library ); + free( eclipseLibrary ); free( programDir ); free( program ); free( officialName ); @@ -257,7 +258,7 @@ static void parseArgs( int* pArgc, _TCHAR* argv[] ) } else if(_tcsicmp(argv[index], NAME) == 0) { name = argv[++index]; } else if(_tcsicmp(argv[index], LIBRARY) == 0) { - library = argv[++index]; + eclipseLibrary = argv[++index]; } else if(_tcsicmp(argv[index], SUPRESSERRORS) == 0) { suppressErrors = 1; } diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h index 92fa13d3a..26b807b8a 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 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 @@ -45,6 +45,9 @@ struct MOTIF_PTRS { Boolean (*XtDispatchEvent) (XEvent*); void (*XtGetValues) (Widget, ArgList, Cardinal); Widget (*XtInitialize) (String, String, XrmOptionDescRec*, Cardinal, int*, char**); +#ifdef AIX + Widget (*eclipseXtInitialize) (String, String, XrmOptionDescRec*, Cardinal, int*, char**); +#endif Boolean (*XtIsManaged) (Widget); void (*XtManageChild) (Widget); int (*XtMapWidget) (Widget); diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c index 041450dd0..93f21cbd3 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2009 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 @@ -50,6 +50,7 @@ void displayMessage( char* title, char* message ) if ( displayName == NULL || strlen(displayName) == 0 || (topWindow == 0 && initWindowSystem( &saveArgc, saveArgv, 1 ) != 0) ) { + printf("%s:\n%s\n", title, message); return; } msg = motif.XmStringGenerate( message, NULL, XmCHARSET_TEXT, NULL ); @@ -107,7 +108,7 @@ int initWindowSystem( int* pArgc, char* argv[], int showSplash ) to initialize the application. */ #ifdef AIX - topWindow = XtInitialize(NULL, officialName, NULL, 0, pArgc, argv); + topWindow = motif.eclipseXtInitialize(NULL, officialName, NULL, 0, pArgc, argv); #else topWindow = motif.XtInitialize(NULL, officialName, NULL, 0, pArgc, argv); #endif diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c index 794342221..84e7295f9 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 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 @@ -62,6 +62,10 @@ static FN_TABLE xtFunctions[] = { FN_TABLE_ENTRY(XtAddCallback), { NULL, NULL } }; +#ifdef AIX +static FN_TABLE shimFunctions[] = { FN_TABLE_ENTRY(eclipseXtInitialize), {NULL, NULL} }; +#endif + /* functions from libX11 */ static FN_TABLE x11Functions[] = { FN_TABLE_ENTRY(XDefaultScreenOfDisplay), FN_TABLE_ENTRY(XFree), @@ -93,8 +97,31 @@ static int loadMotifSymbols( void * library, FN_TABLE * table) { return 0; } +#ifdef AIX +void * loadMotifShimLibrary() { + if (eclipseLibrary != NULL) { + /* library is the normal eclipse_<ver>.so, look for libeclipse-motif.so beside it */ + _TCHAR* eclipseMotifLib = _T_ECLIPSE("libeclipse-motif.so"); + _TCHAR* path = strdup(eclipseLibrary); + _TCHAR* c = strrchr(path, '/'); + if (c == NULL) + return NULL; + + *c = 0; + c = malloc((strlen(path) + 2 + strlen(eclipseMotifLib)) * sizeof(char)); + _stprintf(c, _T_ECLIPSE("%s/%s"), path, eclipseMotifLib); + + return dlopen(c, RTLD_LAZY); + } + return 0; +} +#endif + int loadMotif() { void * xmLib = NULL, *xtLib = NULL, *x11Lib = NULL, *xinLib = NULL; +#ifdef AIX + void * motifShim = NULL; +#endif char * path = getProgramDir(); int dlFlags = RTLD_LAZY; @@ -111,7 +138,10 @@ int loadMotif() { } #else dlFlags |= RTLD_MEMBER; -#endif + motifShim = loadMotifShimLibrary(); + if (motifShim == NULL) + return -1; +#endif if (xmLib == NULL) { xmLib = dlopen(XM_LIB, dlFlags); @@ -139,6 +169,9 @@ int loadMotif() { if (loadMotifSymbols(xmLib, xmFunctions) != 0) return -1; if (loadMotifSymbols(xtLib, xtFunctions) != 0) return -1; if (loadMotifSymbols(x11Lib, x11Functions) != 0) return -1; +#ifdef AIX + if (loadMotifSymbols(motifShim, shimFunctions) !=0) return -1; +#endif return 0; } diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c new file mode 100644 index 000000000..2648ec65e --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2009 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 + *******************************************************************************/ +#include <X11/X.h> +#include <X11/Xlib.h> +#include <Xm/XmAll.h> + +Widget eclipseXtInitialize(String shellName, String appClass, XrmOptionDescRec* options, Cardinal numOptions, int* argc, char** argv) { + return XtInitialize(shellName, appClass, options, numOptions, argc, argv); +} diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak index 26fcad1aa..1d4689e1c 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak +++ b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak @@ -1,5 +1,5 @@ #******************************************************************************* -# Copyright (c) 2000, 2005 IBM Corporation and others. +# Copyright (c) 2000, 2009 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 @@ -25,17 +25,20 @@ include ../make_version.mak PROGRAM_OUTPUT=eclipse PROGRAM_LIBRARY=eclipse_$(LIB_VERSION).so +SHIM=libeclipse-motif.so CC = gcc # Define the object modules to be compiled and flags. MAIN_OBJS = eclipseMain.o +SHIM_OBJS = eclipseMotifShim.o COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o eclipseMotifInit.o DLL_OBJS = eclipse.o eclipseMotif.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o\ NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o EXEC = $(PROGRAM_OUTPUT) DLL = $(PROGRAM_LIBRARY) -LIBS = -L$(MOTIF_HOME)/lib -ldl -lXm -lXt -lX11 +LIBS = -L$(MOTIF_HOME)/lib -ldl +SHIM_LIBS = -L$(MOTIF_HOME)/lib -lXm -lXt -lX11 MOTIF_LIBS = -DXM_LIB="\"libXm.a(shr_32.o)\"" -DXT_LIB="\"libXt.a(shr4.o)\"" -DX11_LIB="\"libX11.a(shr4.o)\"" LFLAGS = -G -bnoentry -bexpall -lm -lc_r -lC_r CFLAGS = -O -s \ @@ -51,7 +54,7 @@ CFLAGS = -O -s \ -I$(MOTIF_HOME)/include \ -I/usr/java5/include -all: $(EXEC) $(DLL) +all: $(EXEC) $(DLL) $(SHIM) .c.o: $(CC) $(CFLAGS) -c $< -o $@ @@ -86,12 +89,16 @@ $(EXEC): $(MAIN_OBJS) $(COMMON_OBJS) $(DLL): $(DLL_OBJS) $(COMMON_OBJS) ld $(LFLAGS) -o $(DLL) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS) - + +$(SHIM): $(SHIM_OBJS) + ld $(LFLAGS) -o $(SHIM) $(SHIM_OBJS) $(SHIM_LIBS) + install: all cp $(EXEC) $(OUTPUT_DIR) + cp $(SHIM) $(OUTPUT_DIR) cp $(DLL) $(LIBRARY_DIR) rm -f $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) clean: - rm -f $(EXEC) $(DLL) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) + rm -f $(EXEC) $(DLL) $(SHIM) $(SHIM_OBJS) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) |