Hi, I was trying to build a port depending on spidermonkey68 on my macppc machine and found out it "requires" rust. After seeing how other downstreams deal with it, i've found out that Debian actually does not use rust for spidermonkey. For all archs [0].
What i'm proposing here is a proof of concept that allows building spidermonkey68 on !rust archs, like macppc [1], but i think really we should drop rust and llvm for all archs. Comments/feedback are welcome, Charlène. [0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959144 [1] https://bin.charlenew.xyz/spidermonkey_norust.log Index: Makefile =================================================================== RCS file: /cvs/ports/devel/spidermonkey68/Makefile,v retrieving revision 1.4 diff -u -p -u -p -r1.4 Makefile --- Makefile 24 Jun 2020 08:57:02 -0000 1.4 +++ Makefile 24 Jun 2020 22:18:37 -0000 @@ -54,9 +54,7 @@ LIB_DEPENDS = devel/nspr \ DEBUG_PACKAGES = ${BUILD_PACKAGES} AUTOCONF_VERSION= 2.13 -BUILD_DEPENDS += devel/autoconf/${AUTOCONF_VERSION} \ - devel/llvm \ - lang/rust +BUILD_DEPENDS += devel/autoconf/${AUTOCONF_VERSION} SEPARATE_BUILD = Yes WRKDIST = ${WRKDIR}/firefox-${V} @@ -77,9 +75,7 @@ CONFIGURE_ARGS = --disable-debug \ --with-system-zlib \ --with-system-icu \ --with-system-nspr \ - --enable-unaligned-private-values \ - --with-libclang-path=${LOCALBASE}/lib \ - --with-clang-path=${LOCALBASE}/bin/clang + --enable-unaligned-private-values # Build failure on mips64(,el}. Related bug on Debian: # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908486 @@ -99,6 +95,16 @@ MAKE_ENV = SHELL=/bin/sh \ SO_VERSION=${SO_VERSION} NO_TEST = Yes + +.include <bsd.port.arch.mk> +.if ${PROPERTIES:Mrust} +BUILD_DEPENDS += devel/llvm \ + lang/rust +CONFIGURE_ARGS += --with-libclang-path=${LOCALBASE}/lib \ + --with-clang-path=${LOCALBASE}/bin/clang +.else +PATCH_LIST += patch-* patch_norust-* +.endif pre-configure: cd ${WRKSRC} && env -i AUTOCONF_VERSION=${AUTOCONF_VERSION} autoconf Index: patches/patch_norust-js_moz_configure =================================================================== RCS file: patches/patch_norust-js_moz_configure diff -N patches/patch_norust-js_moz_configure --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch_norust-js_moz_configure 24 Jun 2020 22:18:37 -0000 @@ -0,0 +1,31 @@ +$OpenBSD$ + +Remove unused LLVM and Rust build dependencies. Since the Javascript engine is +normally part of Firefox, its build system has dependencies on the LLVM and +Rust toolchains. This limits the number of architectures which mozjs68 can be +built on. It turns out, however, that neither LLVM nor Rust are used when +mozjs68 is being built and these build dependencies are therefore not +necessary. + +This patch removes them and allows mozjs68 to be built on any +architecture. + +Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> + +From: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959144 + +Index: js/moz.configure +--- js/moz.configure.orig ++++ js/moz.configure +@@ -18,11 +18,6 @@ def building_js(build_project): + option(env='JS_STANDALONE', default=building_js, + help='Reserved for internal use') + +-include('../build/moz.configure/rust.configure', +- when='--enable-compile-environment') +-include('../build/moz.configure/bindgen.configure', +- when='--enable-compile-environment') +- + @depends('JS_STANDALONE') + def js_standalone(value): + if value: Index: patches/patch_norust-moz_configure =================================================================== RCS file: patches/patch_norust-moz_configure diff -N patches/patch_norust-moz_configure --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch_norust-moz_configure 24 Jun 2020 22:18:37 -0000 @@ -0,0 +1,56 @@ +$OpenBSD$ + +Remove unused LLVM and Rust build dependencies. Since the Javascript engine is +normally part of Firefox, its build system has dependencies on the LLVM and +Rust toolchains. This limits the number of architectures which mozjs68 can be +built on. It turns out, however, that neither LLVM nor Rust are used when +mozjs68 is being built and these build dependencies are therefore not +necessary. + +This patch removes them and allows mozjs68 to be built on any +architecture. + +Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> + +From: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959144 + +Index: moz.configure +--- moz.configure.orig ++++ moz.configure +@@ -598,36 +598,6 @@ set_config('MAKENSISU_FLAGS', nsis_flags) + + check_prog('7Z', ('7z', '7za'), allow_missing=True, when=target_is_windows) + +- +-@depends(host_c_compiler, c_compiler, bindgen_config_paths) +-def llvm_objdump(host_c_compiler, c_compiler, bindgen_config_paths): +- clang = None +- for compiler in (host_c_compiler, c_compiler): +- if compiler and compiler.type == 'clang': +- clang = compiler.compiler +- break +- elif compiler and compiler.type == 'clang-cl': +- clang = os.path.join(os.path.dirname(compiler.compiler), 'clang') +- break +- +- if not clang and bindgen_config_paths: +- clang = bindgen_config_paths.clang_path +- llvm_objdump = 'llvm-objdump' +- if clang: +- out = check_cmd_output(clang, '--print-prog-name=llvm-objdump', +- onerror=lambda: None) +- if out: +- llvm_objdump = out.rstrip() +- return (llvm_objdump,) +- +- +-llvm_objdump = check_prog('LLVM_OBJDUMP', llvm_objdump, what='llvm-objdump', +- when='--enable-compile-environment', +- paths=toolchain_search_path) +- +-add_old_configure_assignment('LLVM_OBJDUMP', llvm_objdump) +- +- + # Please do not add configure checks from here on. + + # Fallthrough to autoconf-based configure