From eca739669e26a741fe7166e6806ea53addff2877 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 18 Sep 2020 00:11:10 +0200 Subject: [PATCH] mozjs78: fix cross --- srcpkgs/mozjs78/patches/fix-rust-target.patch | 15 +++++ srcpkgs/mozjs78/patches/rust-configure.patch | 58 +++++++++++++++++++ srcpkgs/mozjs78/template | 9 +-- 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/mozjs78/patches/fix-rust-target.patch create mode 100644 srcpkgs/mozjs78/patches/rust-configure.patch diff --git a/srcpkgs/mozjs78/patches/fix-rust-target.patch b/srcpkgs/mozjs78/patches/fix-rust-target.patch new file mode 100644 index 00000000000..f1a98dfd53f --- /dev/null +++ b/srcpkgs/mozjs78/patches/fix-rust-target.patch @@ -0,0 +1,15 @@ +Allow us to just set RUST_TARGEt ourselves instead of hacking around in mozilla's +weird custom build system... + +diff -upr firefox-68.9.0.orig/build/moz.configure/rust.configure firefox-68.9.0/build/moz.configure/rust.configure +--- firefox-68.9.0.orig/build/moz.configure/rust.configure 2020-06-02 22:54:39.982616128 +0200 ++++ firefox-68.9.0/build/moz.configure/rust.configure 2020-06-02 23:08:37.656332899 +0200 +@@ -345,7 +345,7 @@ def rust_triple_alias(host_or_target): + + return None + +- rustc_target = find_candidate(candidates) ++ rustc_target = os.environ['RUST_TARGET'] + + if rustc_target is None: + die("Don't know how to translate {} for rustc".format( diff --git a/srcpkgs/mozjs78/patches/rust-configure.patch b/srcpkgs/mozjs78/patches/rust-configure.patch new file mode 100644 index 00000000000..de1eea665de --- /dev/null +++ b/srcpkgs/mozjs78/patches/rust-configure.patch @@ -0,0 +1,58 @@ +--- a/build/moz.configure/rust.configure ++++ b/build/moz.configure/rust.configure +@@ -78,9 +78,6 @@ + + return unwrap + +-rustc = unwrap_rustup(rustc, 'rustc') +-cargo = unwrap_rustup(cargo, 'cargo') +- + + set_config('CARGO', cargo) + set_config('RUSTC', rustc) +@@ -348,26 +345,6 @@ + + os.write(in_fd, source) + os.close(in_fd) +- +- cmd = [ +- rustc, +- '--crate-type', 'staticlib', +- target_arg, +- '-o', out_path, +- in_path, +- ] +- +- def failed(): +- die(dedent('''\ +- Cannot compile for {} with {} +- The target may be unsupported, or you may not have +- a rust std library for that target installed. Try: +- +- rustup target add {} +- '''.format(host_or_target.alias, rustc, rustc_target))) +- check_cmd_output(*cmd, onerror=failed) +- if not os.path.exists(out_path) or os.path.getsize(out_path) == 0: +- failed() + finally: + os.remove(in_path) + os.remove(out_path) +@@ -405,18 +405,6 @@ def rust_triple_alias(host_or_target, host_or_target_c_compiler): + rust_target_triple = rust_triple_alias(target, c_compiler) + rust_host_triple = rust_triple_alias(host, host_c_compiler) + +- +-@depends(host, rust_host_triple, rustc_info.host) +-def validate_rust_host_triple(host, rust_host, rustc_host): +- if rust_host != rustc_host: +- if host.alias == rust_host: +- configure_host = host.alias +- else: +- configure_host = '{}/{}'.format(host.alias, rust_host) +- die("The rust compiler host ({}) is not suitable for the configure host ({})." +- .format(rustc_host, configure_host)) +- +- + set_config('RUST_TARGET', rust_target_triple) + set_config('RUST_HOST_TARGET', rust_host_triple) + diff --git a/srcpkgs/mozjs78/template b/srcpkgs/mozjs78/template index 023a1ed3adf..c7223af51b0 100644 --- a/srcpkgs/mozjs78/template +++ b/srcpkgs/mozjs78/template @@ -5,6 +5,7 @@ revision=1 wrksrc="firefox-${version}" build_wrksrc=js/src build_style=gnu-configure +build_helper=rust hostmakedepends="perl python pkg-config automake autoconf213 autoconf-archive cargo rust llvm clang which python3" makedepends="icu-devel libffi-devel nspr-devel python-devel readline-devel @@ -17,7 +18,6 @@ homepage="https://www.mozilla.org/js/" distfiles="${MOZILLA_SITE}/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz" checksum=965ccfcbb8c0aa97639911997c54be0fcf896fd388b03138952089af675ea918 patch_args="-Np1" -nocross=yes CXXFLAGS+=" -Wno-class-memaccess" LDFLAGS+=" -Wl,-z,stack-size=1048576" @@ -37,7 +37,9 @@ do_configure() { export TARGET_CC="${CC}" export HOST_CFLAGS="-Os" export HOST_CXXFLAGS="-Os" - _args+=" --target=$XBPS_CROSS_TRIPLET --enable-linker=bfd" + _args+=" --target=${XBPS_CROSS_TRIPLET} --enable-linker=bfd" + else + _args+=" --target=${XBPS_TRIPLET}" fi autoconf-2.13 old-configure.in > old-configure @@ -49,8 +51,7 @@ do_configure() { --enable-readline --enable-shared-js --enable-system-ffi \ --enable-tests --with-intl-api --with-system-icu --with-system-nspr \ --enable-hardening --enable-release --with-system-zlib \ - --target=${XBPS_TRIPLET} --host=${XBPS_TRIPLET} \ - ${_args} + --host=${XBPS_TRIPLET} ${_args} } do_check() {