Skip to content

Instantly share code, notes, and snippets.

@Gottox
Created January 5, 2019 20:26
Show Gist options
  • Save Gottox/317228847932d2123e033e407be1023f to your computer and use it in GitHub Desktop.
Save Gottox/317228847932d2123e033e407be1023f to your computer and use it in GitHub Desktop.
diff --git a/srcpkgs/firefox/files/mozconfig b/srcpkgs/firefox/files/mozconfig
index 33188c0c75..0798fdd40e 100644
--- a/srcpkgs/firefox/files/mozconfig
+++ b/srcpkgs/firefox/files/mozconfig
@@ -30,7 +30,6 @@ ac_add_options --disable-gconf
ac_add_options --disable-tests
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
-ac_add_options --disable-elf-hack
ac_add_options --disable-install-strip
ac_add_options --disable-strip
ac_add_options --disable-profiling
diff --git a/srcpkgs/firefox/patches/fix-double-include.patch b/srcpkgs/firefox/patches/fix-double-include.patch
new file mode 100644
index 0000000000..e0f1aa9f89
--- /dev/null
+++ b/srcpkgs/firefox/patches/fix-double-include.patch
@@ -0,0 +1,68 @@
+Fixes a cross compilation error on aarch64 (possible others too):
+
+ /builddir/firefox-62.0.3/media/webrtc/trunk/webrtc/common_audio/signal_processing/complex_bit_reverse.c:20:22: error: redefinition of 'index_7'
+
+--- media/webrtc/trunk/webrtc/common_audio/signal_processing/complex_bit_reverse.c.orig 2018-10-27 21:12:37.895516483 +0200
++++ media/webrtc/trunk/webrtc/common_audio/signal_processing/complex_bit_reverse.c 2018-10-27 21:13:49.208516829 +0200
+@@ -16,6 +16,8 @@
+ * operation. Same for index_8.
+ */
+
++#ifdef __COMPLEX_BIT_REVERSE_C
++#define __COMPLEX_BIT_REVERSE_C
+ /* Indexes for the case of stages == 7. */
+ static const int16_t index_7[112] = {
+ 1, 64, 2, 32, 3, 96, 4, 16, 5, 80, 6, 48, 7, 112, 9, 72, 10, 40, 11, 104,
+@@ -106,3 +108,4 @@ void WebRtcSpl_ComplexBitReverse(int16_t
+ }
+ }
+ }
++#endif /* __COMPLEX_BIT_REVERSE_C */
+--- media/webrtc/trunk/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c.orig 2018-10-27 22:51:02.032543685 +0200
++++ media/webrtc/trunk/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c 2018-10-27 22:50:50.567543631 +0200
+@@ -8,6 +8,8 @@
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
++#ifdef __FILTER_AR_FAST_Q12
++#define __FILTER_AR_FAST_Q12
+ #include "webrtc/base/checks.h"
+ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
+
+@@ -40,3 +42,4 @@ void webrtcspl_filterarfastq12(const int
+ data_out[i] = (int16_t)((output + 2048) >> 12);
+ }
+ }
++#endif /* __FILTER_AR_FAST_Q12 */
+--- ./media/webrtc/trunk/webrtc/common_audio/signal_processing/spl_sqrt_floor.c.orig 2018-10-27 23:03:30.592547144 +0200
++++ ./media/webrtc/trunk/webrtc/common_audio/signal_processing/spl_sqrt_floor.c 2018-10-27 23:04:29.741547419 +0200
+@@ -28,6 +28,8 @@
+
+ // Minor modifications in code style for WebRTC, 2012.
+
++#ifdef __SPL_SQRT_FLOOR
++#define __SPL_SQRT_FLOOR
+ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
+
+ /*
+@@ -75,3 +77,4 @@ int32_t WebRtcSpl_SqrtFloor(int32_t valu
+
+ return root >> 1;
+ }
++#endif /* __SPL_SQRT_FLOOR */
+--- ./media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/fix/source/lattice_c.c.orig 2018-10-27 23:20:58.921551910 +0200
++++ ./media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/fix/source/lattice_c.c 2018-10-27 23:21:34.043552068 +0200
+@@ -14,6 +14,8 @@
+ *
+ */
+
++#ifdef __LATTICE_C
++#define __LATTICE_C
+ #include "settings.h"
+ #include "signal_processing_library.h"
+ #include "webrtc/typedefs.h"
+@@ -47,3 +49,4 @@ void WebRtcIsacfix_FilterArLoop(int16_t*
+ ar_g_Q0[0] = tmpAR;
+ }
+ }
++#endif /* __LATTICE_C */
diff --git a/srcpkgs/firefox/patches/remove-rustc-check.patch b/srcpkgs/firefox/patches/remove-rustc-check.patch
new file mode 100644
index 0000000000..f6bebc8aab
--- /dev/null
+++ b/srcpkgs/firefox/patches/remove-rustc-check.patch
@@ -0,0 +1,32 @@
+Mozilla rustc check does not support crossbuild: let's remove it
+
+--- build/moz.configure/rust.configure 2018-10-01 16:28:31.000000000 +0200
++++ build/moz.configure/rust.configure 2018-10-20 14:21:35.510000000 +0200
+@@ -204,26 +204,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.alias)))
+- 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)
+
diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 2d65031ef8..3c5f2dbd00 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -12,14 +12,14 @@ homepage="https://www.mozilla.org/firefox/"
distfiles="${MOZILLA_SITE}/${pkgname}/releases/${version}/source/${pkgname}-${version}.source.tar.xz"
checksum=da40f2f8f1cbf0ddb3454aa9f65bb1a2b2043ca9b1724aecd016337be77d537f
-only_for_archs="i686 i686-musl x86_64 x86_64-musl"
+#only_for_archs="i686 i686-musl x86_64 x86_64-musl"
lib32disabled=yes
hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust cargo
- llvm clang nodejs cbindgen"
+ llvm clang nodejs cbindgen python strace"
makedepends="nss-devel libjpeg-turbo-devel gtk+-devel gtk+3-devel icu-devel
pixman-devel sqlite-devel libevent-devel libnotify-devel libvpx-devel
- libXrender-devel libXcomposite-devel libSM-devel libXt-devel
+ libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
libXdamage-devel $(vopt_if alsa alsa-lib-devel)
$(vopt_if dbus dbus-glib-devel) $(vopt_if pulseaudio pulseaudio-devel)
$(vopt_if startup_notification startup-notification-devel)
@@ -64,7 +64,25 @@ do_build() {
;;
esac
+ case "$XBPS_TARGET_MACHINE" in
+ x86_64*|i686*)
+ echo "ac_add_options --disable-elf-hack" >>.mozconfig
+ ;;
+ esac
+
if [ "$CROSS_BUILD" ]; then
+ cat >> .cargo/config.in <<EOF
+
+[build]
+jobs = ${makejobs#*j}
+target = "${RUST_TARGET}"
+
+[target.${RUST_TARGET}]
+linker = "${CC}"
+EOF
+ export BINDGEN_CFLAGS="--target=$XBPS_CROSS_TRIPLET"
+ export HOST_CC=cc
+ export TARGET_CC="${CC}"
export HOST_CFLAGS="${XBPS_CFLAGS}"
export HOST_CXXFLAGS="${XBPS_CXXFLAGS}"
export ac_cv_sqlite_secure_delete=yes \
@@ -76,6 +94,8 @@ do_build() {
echo "ac_add_options --target=$XBPS_CROSS_TRIPLET" >>.mozconfig
fi
+ mkdir -p third_party/rust/libloading/.deps
+
case "$XBPS_TARGET_MACHINE" in
i686*)
export CFLAGS+=" -D_FILE_OFFSET_BITS=64"
@@ -107,6 +127,7 @@ ac_add_options $(vopt_enable startup_notification startup-notification)
!
rm -f old-configure
+ #strace -f -o /tmp/strace.log /bin/bash ./mach build
./mach build
}
do_install() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment