[gcompris/gcomprixogoo] Improved the bundling of GCompris for MacOSX. Seems to have everything in place now.



commit 21632b701613ae96022d8dc509530dfc8878314f
Author: Bruno Coudoin <bruno ordinateur-de-bruno-coudoin local>
Date:   Tue Mar 30 01:44:21 2010 +0200

    Improved the bundling of GCompris for MacOSX. Seems to have everything in place now.

 configure.ac             |   10 +++++-----
 macosx/Info.plist        |    2 +-
 macosx/gcompris.bundle   |    5 +++++
 macosx/launcher.sh       |    4 ++--
 src/gcompris/Makefile.am |   15 +--------------
 src/gcompris/binreloc.c  |   24 +++++++++++++++++++++---
 src/gcompris/binreloc.h  |    6 +++++-
 src/gcompris/gcompris.c  |    8 ++++++--
 8 files changed, 46 insertions(+), 28 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6be6792..f8e45f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,8 +164,8 @@ fi
 # From http://autopackage.org/docs/binreloc/
 enable_binreloc=auto
 if test x"$nsbundle" = "xyes" ; then
-enable_binreloc=no
-AC_MSG_NOTICE([binreloc disabled by nsbundle])
+enable_binreloc=yes
+AC_MSG_NOTICE([binreloc enabled by nsbundle])
 fi
 
 AM_BINRELOC
@@ -331,12 +331,12 @@ elif test "x$nsbundle" = "xyes" ; then
   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "../Resources/${DATADIRNAME}", [GCompris data directory])
 
   dnl Plugin Directory
-  AC_DEFINE_UNQUOTED(PACKAGE_CLIB_DIR, "../Resources/${DATADIRNAME}", [Gcompris plugins directory])
-  plugindir=${myprefix}/${DATADIRNAME}/gcompris
+  AC_DEFINE_UNQUOTED(PACKAGE_CLIB_DIR, "../Resources/lib", [Gcompris plugins directory])
+  plugindir=${myprefix}/lib/gcompris
   AC_SUBST(plugindir)
 
   dnl Python plugin Directory
-  PYTHON_PLUGIN_DIR="../Resources/${DATADIRNAME}/gcompris/python"
+  PYTHON_PLUGIN_DIR=${myprefix}/${DATADIRNAME}/gcompris/python
   AC_SUBST(PYTHON_PLUGIN_DIR)
 
   dnl System GCompris config directory
diff --git a/macosx/Info.plist b/macosx/Info.plist
index 324f764..d40a8d5 100644
--- a/macosx/Info.plist
+++ b/macosx/Info.plist
@@ -9,7 +9,7 @@
     <key>CFBundleGetInfoString</key>
     <string>9.2, Copyright 2000-2010 Bruno Coudoin and Others</string>
     <key>CFBundleIconFile</key>
-    <string>Giggle.icns</string>
+    <string>GCompris.icns</string>
     <key>CFBundleIdentifier</key>
     <string>net.gcompris</string>
     <key>CFBundleInfoDictionaryVersion</key>
diff --git a/macosx/gcompris.bundle b/macosx/gcompris.bundle
index c088201..4b22624 100644
--- a/macosx/gcompris.bundle
+++ b/macosx/gcompris.bundle
@@ -71,6 +71,11 @@
     ${prefix}/lib/libvorbisfile.dylib
   </binary>
 
+  <!-- GCompris plugins -->
+  <binary>
+    ${prefix}/lib/gcompris/*.so
+  </binary>
+
   <!-- Copy in GTK+ theme engines. Dunno why this is a dupe of
   modules, but that's why it's commented out. >
   <binary>
diff --git a/macosx/launcher.sh b/macosx/launcher.sh
index 6a5f0be..87d36b4 100755
--- a/macosx/launcher.sh
+++ b/macosx/launcher.sh
@@ -15,7 +15,7 @@ tmp="`pwd`/$0"
 tmp=`dirname "$tmp"`
 tmp=`dirname "$tmp"`
 bundle=`dirname "$tmp"`
-bundle_contents="$bundle"
+bundle_contents="$bundle"/Contents
 bundle_res="$bundle_contents"/Resources
 bundle_lib="$bundle_res"/lib
 bundle_bin="$bundle_res"/bin
@@ -107,7 +107,7 @@ if test "$APPLELANGUAGES"; then
             export LC_MESSAGES=`echo ${LC} | awk '{print $1}' | awk -F/ '{print $5}'`
             break
         fi
-    done  
+    done
 fi
 unset APPLELANGUAGES POS LC L
 
diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am
index 92acc86..cdf7c66 100644
--- a/src/gcompris/Makefile.am
+++ b/src/gcompris/Makefile.am
@@ -23,14 +23,6 @@ no_undefined =
 shared =
 endif
 
-#if WITH_NSBUNDLE
-#gcompris_nsbundle_m = gcompris-nsbundle.m
-#gcompris_nsbundle_h = gcompris-nsbundle.h
-#else
-gcompris_nsbundle_m =
-gcompris_nsbundle_h =
-#endif
-
 bin_PROGRAMS = gcompris
 
 INCLUDES = \
@@ -47,14 +39,11 @@ INCLUDES = \
 	$(DBUS_CFLAGS) \
 	$(AUDIO_CFLAGS) \
 	$(cairo_cflags) \
-	$(NSBUNDLE_CPPFLAGS) \
 	${IGE_MAC_CFLAGS}
 
 gcompris_SOURCES = \
 	$(cairo_c) \
 	$(cairo_h) \
-	$(gcompris_nsbundle_h) \
-	$(gcompris_nsbundle_m) \
 	about.c \
 	about.h \
 	anim.c \
@@ -127,7 +116,7 @@ gcompris_LDADD = \
 	$(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS) \
 	$(DBUS_LIBS) \
 	$(AUDIO_LIBS) \
-        $(INTLLIBS) $(NSBUNDLE_LDFLAGS) \
+        $(INTLLIBS) \
 	${IGE_MAC_LIBS}
 
 marshal_sources =				\
@@ -149,8 +138,6 @@ EXTRA_DIST = \
 
 DONT_DIST_SOURCE = $(marshal_sources)
 
-gcompris_nsbundle_CPPFLAGS = -fconstant-string-class=NSConstantString
-
 if SUGAR
 INCLUDES += $(SUGAR_CFLAGS)
 gcompris_SOURCES += sugar.c
diff --git a/src/gcompris/binreloc.c b/src/gcompris/binreloc.c
index 4bc275d..599e4bc 100644
--- a/src/gcompris/binreloc.c
+++ b/src/gcompris/binreloc.c
@@ -25,6 +25,11 @@
 #include <string.h>
 #include "binreloc.h"
 
+#ifdef MAC_INTEGRATION
+#include <igemacintegration/ige-mac-bundle.h>
+static IgeMacBundle *bundle = NULL;
+#endif
+
 G_BEGIN_DECLS
 
 
@@ -46,7 +51,7 @@ _br_find_exe (GbrInitError *error)
 	   relocation code for windows. Unfortunately this is not
 	   the case and we have to add this manually. This is only
 	   one possibility; other ways of looking up the full path
-	   of gnucash-bin.exe probably exist.*/
+	   of gcompris-bin.exe probably exist.*/
 	gchar *prefix;
 	gchar *result;
 
@@ -55,7 +60,7 @@ _br_find_exe (GbrInitError *error)
 	   the current process */
 	prefix = g_win32_get_package_installation_directory_of_module (NULL);
 	result = g_build_filename (prefix,
-				   "bin", "gnucash-bin.exe",
+				   "bin", "gcompris.exe",
 				   (char*)NULL);
 	g_free (prefix);
 	return result;
@@ -76,7 +81,7 @@ _br_find_exe (GbrInitError *error)
 	ige_mac_bundle_setup_environment(bundle);
 	prefix = g_strdup(ige_mac_bundle_get_path(bundle));
 	result = g_build_filename(prefix, "Contents/MacOS",
-				  "gnucash-bin", NULL);
+				  "GCompris-bin", NULL);
 	g_free(prefix);
 	return result;
 #else
@@ -595,7 +600,11 @@ gbr_find_data_dir (const gchar *default_data_dir)
 			return NULL;
 	}
 
+#ifdef MAC_INTEGRATION
+	dir = g_strdup(ige_mac_bundle_get_datadir(bundle));
+#else
 	dir = g_build_filename (prefix, "share", NULL);
+#endif
 	g_free (prefix);
 	return dir;
 }
@@ -628,7 +637,11 @@ gbr_find_locale_dir (const gchar *default_locale_dir)
 			return NULL;
 	}
 
+#ifdef MAC_INTEGRATION
+	dir = g_strdup(ige_mac_bundle_get_localedir(bundle));
+#else
 	dir = g_build_filename (data_dir, "locale", NULL);
+#endif
 	g_free (data_dir);
 	return dir;
 }
@@ -661,10 +674,15 @@ gbr_find_lib_dir (const gchar *default_lib_dir)
 			return NULL;
 	}
 
+#ifdef MAC_INTEGRATION
+	dir = g_build_filename(ige_mac_bundle_get_datadir(bundle),
+			       "..", "lib", NULL);
+#else
 	if (default_lib_dir && strstr(default_lib_dir, "lib64"))
 		dir = g_build_filename (prefix, "lib64", NULL);
 	else
 		dir = g_build_filename (prefix, "lib", NULL);
+#endif
 	g_free (prefix);
 	return dir;
 }
diff --git a/src/gcompris/binreloc.h b/src/gcompris/binreloc.h
index 9cd93b7..3ca617f 100644
--- a/src/gcompris/binreloc.h
+++ b/src/gcompris/binreloc.h
@@ -29,7 +29,11 @@ typedef enum {
 	/** The file format of /proc/self/maps is invalid; kernel bug? */
 	GBR_INIT_ERROR_INVALID_MAPS,
 	/** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
-	GBR_INIT_ERROR_DISABLED
+	GBR_INIT_ERROR_DISABLED,
+	/** Not a bundle error on MacOSX */
+	GBR_INIT_ERROR_MAC_NOT_BUNDLE,
+	/** Not an application bundle error on MacOSX */
+	GBR_INIT_ERROR_MAC_NOT_APP_BUNDLE
 } GbrInitError;
 
 
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 6719405..9893a52 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -1220,15 +1220,19 @@ void gc_terminate(int signum)
 
 static void load_properties ()
 {
+  GError *error = NULL;
   properties = gc_prop_new ();
 
   /* Initialize the binary relocation API
    *  http://autopackage.org/docs/binreloc/
    */
-  if(gbr_init (NULL))
+  if(gbr_init (&error))
     g_message("Binary relocation enabled");
   else
-    g_message("Binary relocation disabled");
+    {
+      g_message("Binary relocation disabled code = %d", error->code);
+      g_error_free (error);
+    }
 
   /* usefull for OSX bundle app */
   /* FIXME exec_prefix should be put in properties */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]