Source: gjs
Version: 1.78.2-2
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

gjs fails to cross build from source, because meson.build uses
cxx.run().  While meson.build also considers a failure from cxx.run()
with a warning when cross compiling, that code never goes into effect,
because cxx.run() aborts meson execution during cross compilation. I'm
proposing the attached patch to skip cxx.run() when cross compiling
(with the previous warning). This allows the build to continue until it
runs into #1060838, which hopefully is to be fixed elsewhere.

Helmut
--- gjs-1.78.2.orig/meson.build
+++ gjs-1.78.2/meson.build
@@ -258,7 +258,15 @@
 # Check if a minimal SpiderMonkey program compiles, links, and runs. If not,
 # it's most likely the case that SpiderMonkey was configured incorrectly, for
 # example by building mozglue as a shared library.
-minimal_program = cxx.run('''
+recommended_configuration = ''' Check the recommended configuration:
+https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md'''
+if meson.is_cross_build()
+    warning('''This is a cross build. A check that a minimal
+SpiderMonkey program executes will not be performed. Before shipping GJS, you
+should check that it does not crash on startup, since building SpiderMonkey with
+the wrong configuration may cause that.''' + recommended_configuration)
+else
+    minimal_program = cxx.run('''
 #include <js/Initialization.h>
 int main(void) {
     if (!JS_Init()) return 1;
@@ -266,24 +274,17 @@
     return 0;
 }
 ''',
-    args: debug_arg, dependencies: spidermonkey,
-    name: 'SpiderMonkey sanity check')
-
-recommended_configuration = ''' Check the recommended configuration:
-https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md'''
-if not minimal_program.compiled()
-    error('''A minimal SpiderMonkey program
+        args: debug_arg, dependencies: spidermonkey,
+        name: 'SpiderMonkey sanity check')
+    if not minimal_program.compiled()
+        error('''A minimal SpiderMonkey program
 could not be compiled or linked. Most likely you should build it with a
 different configuration.''' + recommended_configuration)
-elif meson.is_cross_build()
-    warning('''This is a cross build. A check that a minimal
-SpiderMonkey program executes will not be performed. Before shipping GJS, you
-should check that it does not crash on startup, since building SpiderMonkey with
-the wrong configuration may cause that.''' + recommended_configuration)
-elif minimal_program.returncode() != 0
-    error('''A minimal SpiderMonkey program
+    elif minimal_program.returncode() != 0
+        error('''A minimal SpiderMonkey program
 failed to execute. Most likely you should build it with a different
 configuration.''' + recommended_configuration)
+    endif
 endif
 
 have_printf_alternative_int = cc.compiles('''

Reply via email to