I keep this bug open because Georgiewskiy did not subscribe to the
upstream BTS. The attached patch reverts the libmojs-dev ->
mozjs185-dev changes, hoping to get a crashing executable *and* a
meaningful backtrace.

To build 1.76.1-2, you did:
$ apt-get source --tar-only oolite
$ git clone git://anonscm.debian.org/pkg-games/oolite.git
$ cd oolite
$ grep Build-Depends -A4 debian/control
$ sudo apt-get missing_build_dependencies
$ DEB_BUILD_OPTIONS="noopt nostrip" debuild -us -uc
$ sudo dpkg -i ../oolite*.deb

Now, please:
$ debuild clean
$ git status # Check that workspace is clean.
$ git checkout 7e5f3143858f0f4d38ccc501a73dd5d35a77b4d7 # Check revision.
$ patch -p1 < /tmp/allow_nostrip_for_1.76.1-1.diff
$ DEB_BUILD_OPTIONS="noopt nostrip" debuild -us -uc
$ sudo dpkg -i ../oolite*.deb

There is no need to test both strip/nostrip versions, they should
produce the same assembly code.
diff --git a/debian/control b/debian/control
index 0e27861..6893d75 100644
--- a/debian/control
+++ b/debian/control
@@ -7,10 +7,9 @@ Standards-Version: 3.9.3
 Build-Depends: dpkg-dev (>= 1.16.1), debhelper (>= 9),
 	libsdl1.2-dev, libsdl-mixer1.2-dev,
 	libgnustep-base-dev, gnustep-core-devel,
-	libnspr4-dev, libmozjs185-dev,
-	libpng-dev, mesa-common-dev, gobjc, libffi-dev
-# Work-around: Oolite does not Build-Depend on libffi-dev, but
-# libmozjs185-dev does (reported as #).
+	libnspr4-dev, libmozjs-dev (>= 2.0~),
+	libpng-dev, mesa-common-dev,
+        gobjc
 Homepage: http://www.oolite.org
 Vcs-Git: git://git.debian.org/pkg-games/oolite.git
 Vcs-Browser: http://git.debian.org/?p=pkg-games/oolite.git
diff --git a/debian/patches/debian_version_of_libmozjs.diff b/debian/patches/debian_version_of_libmozjs.diff
index a442105..40d7c38 100644
--- a/debian/patches/debian_version_of_libmozjs.diff
+++ b/debian/patches/debian_version_of_libmozjs.diff
@@ -1,24 +1,33 @@
 Description: use Debian/unstable version of libmozjs
  Upstream downloads libmozjs v4 from a private URL at build time.
  .
- We adapt the source to use 1.8.5 packaged in Debian.
- This part of the work has been forwarded upstream
- but changes have been necessary since.
+ We adapt the source to use the version available in Debian.
+ This part of the work is forwarded upstream.
  .
  JSOPTION_ANONFUNFIX has been removed in mozjs, see
  https://bugzilla.mozilla.org/show_bug.cgi?id=665835
  .
- The main API difference is that older JSScript memory allocation
- is hidden inside the associated JSObject.
+ jsxdrapi.h does not provide C compatibility anymore.
 
 Author: Nicolas Boulenguez <nicolas.bouleng...@free.fr>
 Forwarded: Michael Werle <mi...@michaelwerle.com>
 
 Index: b/src/Core/Scripting/OOJSScript.m
 ===================================================================
---- a/src/Core/Scripting/OOJSScript.m	2012-06-25 09:36:25.000000000 +0200
-+++ b/src/Core/Scripting/OOJSScript.m	2012-06-25 09:37:49.000000000 +0200
-@@ -58,11 +58,11 @@
+--- a/src/Core/Scripting/OOJSScript.m	2012-05-12 21:53:26.000000000 +0200
++++ b/src/Core/Scripting/OOJSScript.m	2012-05-30 16:45:05.000000000 +0200
+@@ -22,6 +22,10 @@
+ 
+ */
+ 
++/* Work-around because jsxdrapi.h does not provide */
++/* (Objective) C compatibility anymore. */
++#define OO_CACHE_JS_SCRIPTS 0
++
+ #ifndef OO_CACHE_JS_SCRIPTS
+ #define OO_CACHE_JS_SCRIPTS		1
+ #endif
+@@ -58,11 +62,11 @@
  
  static void AddStackToArrayReversed(NSMutableArray *array, RunningStack *stack);
  
@@ -33,7 +42,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  #endif
  
  static NSString *StrippedName(NSString *string);
-@@ -111,8 +111,7 @@
+@@ -111,8 +115,7 @@
  {
  	JSContext				*context = NULL;
  	NSString				*problem = nil;		// Acts as error flag.
@@ -43,7 +52,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  	jsval					returnValue = JSVAL_VOID;
  	NSEnumerator			*keyEnum = nil;
  	NSString				*key = nil;
-@@ -142,7 +141,7 @@
+@@ -142,7 +145,7 @@
  			problem = @"could not add JavaScript root object";
  		}
  		
@@ -52,7 +61,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  		{
  			problem = @"could not add JavaScript root object";
  		}
-@@ -168,7 +167,7 @@
+@@ -168,7 +171,7 @@
  		if (!problem)
  		{
  			OOLog(@"script.javaScript.willLoad", @"About to load JavaScript %@", path);
@@ -61,10 +70,12 @@ Index: b/src/Core/Scripting/OOJSScript.m
  		}
  		OOLogIndentIf(@"script.javaScript.willLoad");
  		
-@@ -205,10 +204,9 @@
+@@ -203,12 +206,9 @@
+ 				problem = @"could not run script";
+ 			}
  			OOJSStopTimeLimiter();
- 			
- 			// We don't need the script any more - the event handlers hang around as long as the JS object exists.
+-			
+-			// We don't need the script any more - the event handlers hang around as long as the JS object exists.
 -			JS_DestroyScript(context, script);
  		}
  		
@@ -73,7 +84,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  		
  		sRunningStack = stackElement.back;
  		
-@@ -620,16 +618,16 @@
+@@ -620,16 +620,16 @@
  }
  
  
@@ -93,17 +104,17 @@ Index: b/src/Core/Scripting/OOJSScript.m
  	*outErrorMessage = nil;
  	
  #if OO_CACHE_JS_SCRIPTS
-@@ -650,8 +648,7 @@
+@@ -650,8 +650,7 @@
  		else
  		{
  			script = JS_CompileUCScript(context, object, [data bytes], [data length] / sizeof(unichar), [path UTF8String], 1);
 -			if (script != NULL)  *outScriptObject = JS_NewScriptObject(context, script);
 -			else  *outErrorMessage = @"compilation failed";
-+			if (script == NULL) *outErrorMessage = @"compilation failed";
++			if (script == NULL)  *outErrorMessage = @"compilation failed";
  		}
  		
  #if OO_CACHE_JS_SCRIPTS
-@@ -669,7 +666,7 @@
+@@ -669,7 +668,7 @@
  
  
  #if OO_CACHE_JS_SCRIPTS
@@ -112,7 +123,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  {
  	JSXDRState					*xdr = NULL;
  	NSData						*result = nil;
-@@ -679,7 +676,7 @@
+@@ -679,7 +678,7 @@
  	xdr = JS_XDRNewMem(context, JSXDR_ENCODE);
  	if (xdr != NULL)
  	{
@@ -121,7 +132,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  		{
  			bytes = JS_XDRMemGetData(xdr, &length);
  			if (bytes != NULL)
-@@ -694,10 +691,10 @@
+@@ -694,10 +693,10 @@
  }
  
  
@@ -134,7 +145,7 @@ Index: b/src/Core/Scripting/OOJSScript.m
  	
  	if (data == nil)  return NULL;
  	
-@@ -705,7 +702,7 @@
+@@ -705,7 +704,7 @@
  	if (xdr != NULL)
  	{
  		JS_XDRMemSetData(xdr, (void *)[data bytes], [data length]);
@@ -145,8 +156,8 @@ Index: b/src/Core/Scripting/OOJSScript.m
  		JS_XDRDestroy(xdr);
 Index: b/src/Core/Scripting/OOJavaScriptEngine.m
 ===================================================================
---- a/src/Core/Scripting/OOJavaScriptEngine.m	2012-06-25 09:36:25.000000000 +0200
-+++ b/src/Core/Scripting/OOJavaScriptEngine.m	2012-06-25 09:37:49.000000000 +0200
+--- a/src/Core/Scripting/OOJavaScriptEngine.m	2012-05-29 21:16:11.000000000 +0200
++++ b/src/Core/Scripting/OOJavaScriptEngine.m	2012-05-30 16:50:41.000000000 +0200
 @@ -76,7 +76,7 @@
  #else
  #define JIT_OPTIONS					JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_PROFILING
@@ -156,25 +167,24 @@ Index: b/src/Core/Scripting/OOJavaScriptEngine.m
  
  
  #define OOJS_STACK_SIZE				8192
-Index: b/GNUmakefile
-===================================================================
---- a/GNUmakefile	2012-06-25 09:36:25.000000000 +0200
-+++ b/GNUmakefile	2012-06-25 10:20:02.000000000 +0200
-@@ -37,12 +37,11 @@
-     LIBJS_LIB_DIR                = $(LIBJS_ROOT)/dist/lib
-     LIBJS = js_static
+@@ -912,7 +912,7 @@
+ 		[NSException raise:NSGenericException format:@"Failed to initialize JS ID cache for \"%s\".", name];
+ 	}
+ 	
+-	*idCache = INTERNED_STRING_TO_JSID(string);
++	*idCache = INTERNED_STRING_TO_JSID(context, string);
+ 	
+ 	OOJSRelinquishContext(context);
+ }
+@@ -945,9 +945,9 @@
+ 	
+ 	OOJSRelinquishContext(context);
+ 	
+-	return INTERNED_STRING_TO_JSID(jsString);
++	return INTERNED_STRING_TO_JSID(context, jsString);
+ 	
+-	if (EXPECT(jsString != NULL))  return INTERNED_STRING_TO_JSID(jsString);
++	if (EXPECT(jsString != NULL))  return INTERNED_STRING_TO_JSID(context, jsString);
+ 	else  return JSID_VOID;
+ }
  
--    ADDITIONAL_INCLUDE_DIRS      = -I$(LIBJS_INC_DIR) -Isrc/SDL -Isrc/Core -Isrc/BSDCompat -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables
--    ADDITIONAL_OBJC_LIBS         = -lGLU -lGL -lX11 -lSDL -lSDL_mixer -lgnustep-base -l$(LIBJS) `nspr-config --libs` -lstdc++
--    ADDITIONAL_CFLAGS            = -Wall -DLINUX -DNEED_STRLCPY `sdl-config --cflags` `nspr-config --cflags`
--    ADDITIONAL_OBJCFLAGS         = -Wall -std=c99 -DLOADSAVEGUI -DLINUX -DXP_UNIX -Wno-import `sdl-config --cflags` `nspr-config --cflags`
--    oolite_LIB_DIRS              += -L/usr/X11R6/lib/ -L$(LIBJS_LIB_DIR)
--
-+    ADDITIONAL_INCLUDE_DIRS      = -Isrc/SDL -Isrc/Core -Isrc/BSDCompat -Isrc/Core/Scripting -Isrc/Core/Materials -Isrc/Core/Entities -Isrc/Core/OXPVerifier -Isrc/Core/Debug -Isrc/Core/Tables
-+    ADDITIONAL_OBJC_LIBS         = -lGLU -lGL -lX11 -lSDL -lSDL_mixer `js-config --libs` -lgnustep-base `nspr-config --libs` -lstdc++
-+    ADDITIONAL_CFLAGS            = -Wall -DLINUX -DNEED_STRLCPY `sdl-config --cflags` `nspr-config --cflags` `js-config --cflags`
-+    ADDITIONAL_OBJCFLAGS         = -Wall -std=c99 -DLOADSAVEGUI -DLINUX -DXP_UNIX -Wno-import `sdl-config --cflags` `nspr-config --cflags` `js-config --cflags`
-+    oolite_LIB_DIRS              += -L/usr/X11R6/lib/
-     ifeq ($(use_deps),yes)
-         oolite_LIB_DIRS          += -Ldeps/Linux-deps/$(HOST_ARCH)/lib_linker
-         ADDITIONAL_OBJC_LIBS     += -lpng14
diff --git a/debian/rules b/debian/rules
index 9594828..b410038 100755
--- a/debian/rules
+++ b/debian/rules
@@ -40,6 +40,11 @@ GSMAKE += ESPEAK=no # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591717
 GSMAKE += OO_JAVASCRIPT_TRACE=no # Forced by libmozjs185 settings
 GSMAKE += DEPLOYMENT_RELEASE_CONFIGURATION=yes
 
+# Use Debian system-wide mozilla library
+GSMAKE += LIBJS_INC_DIR=/usr/include/mozjs
+GSMAKE += LIBJS_LIB_DIR=/usr/lib
+GSMAKE += LIBJS=mozjs
+
 # Use Debian default build options.
 include /usr/share/dpkg/buildflags.mk
 GSMAKE += CFLAGS="$(CFLAGS)"

Reply via email to