From 25d7331dfbd0c2cacad124197800d774246a4758 Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 6 Jan 2019 03:52:01 +0100 Subject: [PATCH] firefox: fix cross, update to 64.0.2 [ci skip] --- srcpkgs/firefox/files/mozconfig | 1 - .../firefox/patches/fix-cmsghdr-rust.patch | 11 ++ .../firefox/patches/fix-double-include.patch | 68 +++++++++ .../patches/fix-rust-libc-ppc64-musl.patch | 7 + srcpkgs/firefox/patches/fix-tools.patch | 16 ++- srcpkgs/firefox/patches/fix-webrtc-arm.patch | 130 ++++++++++++++++++ .../patches/fix-webrtc-glibcisms.patch | 16 ++- .../firefox/patches/remove-rustc-check.patch | 32 +++++ srcpkgs/firefox/template | 45 +++++- 9 files changed, 316 insertions(+), 10 deletions(-) create mode 100644 srcpkgs/firefox/patches/fix-cmsghdr-rust.patch create mode 100644 srcpkgs/firefox/patches/fix-double-include.patch create mode 100644 srcpkgs/firefox/patches/fix-rust-libc-ppc64-musl.patch create mode 100644 srcpkgs/firefox/patches/fix-webrtc-arm.patch create mode 100644 srcpkgs/firefox/patches/remove-rustc-check.patch diff --git a/srcpkgs/firefox/files/mozconfig b/srcpkgs/firefox/files/mozconfig index 33188c0c757..0798fdd40ef 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-cmsghdr-rust.patch b/srcpkgs/firefox/patches/fix-cmsghdr-rust.patch new file mode 100644 index 00000000000..9666ac279cc --- /dev/null +++ b/srcpkgs/firefox/patches/fix-cmsghdr-rust.patch @@ -0,0 +1,11 @@ +--- media/audioipc/audioipc/src/cmsg.rs.orig 2019-01-07 15:37:48.111034714 +0100 ++++ media/audioipc/audioipc/src/cmsg.rs 2019-01-07 15:40:17.251689417 +0100 +@@ -108,7 +108,7 @@ + + let cmsghdr = cmsghdr { + cmsg_len: cmsg_len as _, +- #[cfg(target_env = "musl")] ++ #[cfg(all(target_env = "musl", target_pointer_width = "64"))] + __pad1: 0, + cmsg_level: level, + cmsg_type: kind, diff --git a/srcpkgs/firefox/patches/fix-double-include.patch b/srcpkgs/firefox/patches/fix-double-include.patch new file mode 100644 index 00000000000..5adfc209985 --- /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. + */ + ++#ifndef __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. + */ + ++#ifndef __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. + ++#ifndef __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 @@ + * + */ + ++#ifndef __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/fix-rust-libc-ppc64-musl.patch b/srcpkgs/firefox/patches/fix-rust-libc-ppc64-musl.patch new file mode 100644 index 00000000000..f16be1b307c --- /dev/null +++ b/srcpkgs/firefox/patches/fix-rust-libc-ppc64-musl.patch @@ -0,0 +1,7 @@ +--- Cargo.toml.orig 2019-01-16 20:11:57.372185694 +0100 ++++ Cargo.toml 2019-01-16 20:13:37.474282852 +0100 +@@ -63,3 +63,4 @@ + [patch.crates-io] + libudev-sys = { path = "dom/webauthn/libudev-sys" } + serde_derive = { git = "https://github.com/servo/serde", branch = "deserialize_from_enums8" } ++libc = { git = "https://github.com/rust-lang/libc", rev = "914eba137b25ece7ade3986f1e34df9cf439af22" } diff --git a/srcpkgs/firefox/patches/fix-tools.patch b/srcpkgs/firefox/patches/fix-tools.patch index d5a94cb5798..c3809e9a781 100644 --- a/srcpkgs/firefox/patches/fix-tools.patch +++ b/srcpkgs/firefox/patches/fix-tools.patch @@ -28,7 +28,19 @@ --- tools/profiler/core/platform-linux-android.cpp.orig +++ tools/profiler/core/platform-linux-android.cpp -@@ -534,9 +534,11 @@ +@@ -277,7 +277,11 @@ + + // Request profiling signals. + struct sigaction sa; ++#if defined(GP_ARCH_arm) ++ sa.sa_sigaction = SigprofHandler; ++#else + sa.sa_sigaction = MOZ_SIGNAL_TRAMPOLINE(SigprofHandler); ++#endif + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART | SA_SIGINFO; + if (sigaction(SIGPROF, &sa, &mOldSigprofHandler) != 0) { +@@ -546,9 +550,11 @@ void Registers::SyncPopulate() { @@ -39,4 +51,4 @@ +#endif } #endif - + diff --git a/srcpkgs/firefox/patches/fix-webrtc-arm.patch b/srcpkgs/firefox/patches/fix-webrtc-arm.patch new file mode 100644 index 00000000000..033d03d8603 --- /dev/null +++ b/srcpkgs/firefox/patches/fix-webrtc-arm.patch @@ -0,0 +1,130 @@ +--- media/webrtc/trunk/moz.build.orig 2019-01-16 14:48:37.361278044 +0100 ++++ media/webrtc/trunk/moz.build 2019-01-16 14:49:21.637924835 +0100 +@@ -242,6 +242,18 @@ + "/media/webrtc/trunk/webrtc/modules/video_processing/video_processing_neon_gn" + ] + ++ ++if CONFIG["CPU_ARCH"] == "arm" and CONFIG["OS_TARGET"] == "Linux": ++ ++ DIRS += [ ++ "/media/webrtc/trunk/webrtc/common_audio/common_audio_neon_c_gn", ++ "/media/webrtc/trunk/webrtc/common_audio/common_audio_neon_gn", ++ "/media/webrtc/trunk/webrtc/modules/audio_coding/isac_neon_gn", ++ "/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_c_gn", ++ "/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_gn", ++ "/media/webrtc/trunk/webrtc/modules/video_processing/video_processing_neon_gn" ++ ] ++ + if CONFIG["CPU_ARCH"] == "x86" and CONFIG["OS_TARGET"] == "Linux": + + DIRS += [ + +--- media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_c_gn/moz.build.orig 2019-01-16 14:58:54.713353133 +0100 ++++ media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_c_gn/moz.build 2019-01-08 19:56:53.000000000 +0100 +@@ -71,7 +71,10 @@ + DEFINES["NO_TCMALLOC"] = True + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_X11"] = "1" ++ ++ if CONFIG["CPU_ARCH"] == "aarch64": ++ DEFINES["WEBRTC_ARCH_ARM64"] = True ++ +- DEFINES["WEBRTC_ARCH_ARM64"] = True + DEFINES["WEBRTC_LINUX"] = True + + OS_LIBS += [ + +--- media/webrtc/trunk/webrtc/common_audio/common_audio_neon_c_gn/moz.build.orig 2019-01-16 15:16:36.947747240 +0100 ++++ media/webrtc/trunk/webrtc/common_audio/common_audio_neon_c_gn/moz.build 2019-01-16 15:17:22.168379111 +0100 +@@ -69,7 +69,10 @@ + DEFINES["NO_TCMALLOC"] = True + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_X11"] = "1" +- DEFINES["WEBRTC_ARCH_ARM64"] = True ++ ++ if CONFIG["CPU_ARCH"] == "aarch64": ++ DEFINES["WEBRTC_ARCH_ARM64"] = True ++ + DEFINES["WEBRTC_LINUX"] = True + + if CONFIG["OS_TARGET"] == "NetBSD": + +--- media/webrtc/trunk/webrtc/modules/audio_coding/isac_neon_gn/moz.build.orig 2019-01-16 15:28:38.302731713 +0100 ++++ media/webrtc/trunk/webrtc/modules/audio_coding/isac_neon_gn/moz.build 2019-01-16 15:29:20.174378505 +0100 +@@ -80,7 +80,10 @@ + DEFINES["NO_TCMALLOC"] = True + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_X11"] = "1" +- DEFINES["WEBRTC_ARCH_ARM64"] = True ++ ++ if CONFIG["CPU_ARCH"] == "aarch64": ++ DEFINES["WEBRTC_ARCH_ARM64"] = True ++ + DEFINES["WEBRTC_LINUX"] = True + + OS_LIBS += [ + +--- media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_gn/moz.build.orig 2019-01-16 15:31:28.281297859 +0100 ++++ media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing_neon_gn/moz.build 2019-01-16 15:31:06.724479707 +0100 +@@ -77,7 +77,10 @@ + DEFINES["NO_TCMALLOC"] = True + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_X11"] = "1" +- DEFINES["WEBRTC_ARCH_ARM64"] = True ++ ++ if CONFIG["CPU_ARCH"] == "aarch64": ++ DEFINES["WEBRTC_ARCH_ARM64"] = True ++ + DEFINES["WEBRTC_LINUX"] = True + + OS_LIBS += [ + +--- media/webrtc/trunk/webrtc/modules/video_processing/video_processing_neon_gn/moz.build.orig 2019-01-16 15:32:36.700720723 +0100 ++++ media/webrtc/trunk/webrtc/modules/video_processing/video_processing_neon_gn/moz.build 2019-01-16 15:33:08.188455104 +0100 +@@ -67,7 +67,10 @@ + DEFINES["NO_TCMALLOC"] = True + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_X11"] = "1" +- DEFINES["WEBRTC_ARCH_ARM64"] = True ++ ++ if CONFIG["CPU_ARCH"] == "aarch64": ++ DEFINES["WEBRTC_ARCH_ARM64"] = True ++ + DEFINES["WEBRTC_LINUX"] = True + + if CONFIG["OS_TARGET"] == "NetBSD": + +--- media/webrtc/trunk/webrtc/common_audio/common_audio_c_gn/moz.build.orig 2019-01-16 16:09:33.670752803 +0100 ++++ media/webrtc/trunk/webrtc/common_audio/common_audio_c_gn/moz.build 2019-01-16 16:11:13.266888242 +0100 +@@ -140,6 +140,7 @@ + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + ++if CONFIG["OS_TARGET"] == "Linux" and CONFIG["CPU_ARCH"] != "arm": + UNIFIED_SOURCES += [ + "/media/webrtc/trunk/webrtc/common_audio/signal_processing/complex_bit_reverse.c", + "/media/webrtc/trunk/webrtc/common_audio/signal_processing/filter_ar_fast_q12.c", +--- media/webrtc/trunk/webrtc/modules/audio_coding/isac_fix_c_gn/moz.build.orig 2019-01-16 16:31:03.781907299 +0100 ++++ media/webrtc/trunk/webrtc/modules/audio_coding/isac_fix_c_gn/moz.build 2019-01-16 16:30:44.106080812 +0100 +@@ -142,6 +142,8 @@ + "rt" + ] + ++if CONFIG["OS_TARGET"] == "Linux" and CONFIG["CPU_ARCH"] != "arm": ++ + SOURCES += [ + "/media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_filter_c.c" + ] + +--- media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc.orig 2019-01-16 16:52:42.676473795 +0100 ++++ media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc 2019-01-16 16:54:22.595598235 +0100 +@@ -67,7 +67,7 @@ + return 0; + } + +-#if !defined(ANDROID) ++#if !defined(ANDROID) && !defined(__linux__) + #ifdef WEBRTC_ARCH_ARM_V7 + uint64_t WebRtc_GetCPUFeaturesARM(void) { + return kCPUFeatureARMv7 diff --git a/srcpkgs/firefox/patches/fix-webrtc-glibcisms.patch b/srcpkgs/firefox/patches/fix-webrtc-glibcisms.patch index 0a9304430b2..0249ce58803 100644 --- a/srcpkgs/firefox/patches/fix-webrtc-glibcisms.patch +++ b/srcpkgs/firefox/patches/fix-webrtc-glibcisms.patch @@ -1,5 +1,5 @@ ---- media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c.orig 2018-05-09 23:48:44.677389171 +0200 -+++ media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c 2018-05-09 23:48:56.254373557 +0200 +--- media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c.orig 2018-12-07 03:57:04.000000000 +0100 ++++ media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c 2019-01-06 19:39:01.798166351 +0100 @@ -11,7 +11,9 @@ #include #include @@ -11,3 +11,15 @@ #include #else #include +@@ -29,7 +31,10 @@ + int architecture = 0; + unsigned long hwcap = 0; + const char* platform = NULL; +-#if __GLIBC_PREREQ(2, 16) ++#if !__GLIBC__ ++ hwcap = getauxval(AT_HWCAP); ++ platform = (const char*)getauxval(AT_PLATFORM); ++#elif __GLIBC_PREREQ(2, 16) + hwcap = getauxval(AT_HWCAP); + platform = (const char*)getauxval(AT_PLATFORM); + #else diff --git a/srcpkgs/firefox/patches/remove-rustc-check.patch b/srcpkgs/firefox/patches/remove-rustc-check.patch new file mode 100644 index 00000000000..f6bebc8aab1 --- /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 5a846b26e55..3ff4a8a204b 100644 --- a/srcpkgs/firefox/template +++ b/srcpkgs/firefox/template @@ -3,23 +3,22 @@ # THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/firefox-i18n". # pkgname=firefox -version=64.0 +version=64.0.2 revision=1 short_desc="Mozilla Firefox web browser" maintainer="Juan RP " license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later" homepage="https://www.mozilla.org/firefox/" distfiles="${MOZILLA_SITE}/${pkgname}/releases/${version}/source/${pkgname}-${version}.source.tar.xz" -checksum=da40f2f8f1cbf0ddb3454aa9f65bb1a2b2043ca9b1724aecd016337be77d537f +checksum=34cf115a4eeb4d73f7199396bb3a5d5843c8c455eae4213bf451c4db88768f1f -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" 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) @@ -31,6 +30,12 @@ conflicts="firefox-esr>=0" build_options="alsa dbus pulseaudio startup_notification xscreensaver sndio" build_options_default="alsa dbus pulseaudio startup_notification xscreensaver sndio" +case $XBPS_TARGET_MACHINE in + armv6*) + broken="required NEON extensions are not suppored on armv6" + ;; +esac + post_extract() { case "$XBPS_TARGET_MACHINE" in *-musl) @@ -64,7 +69,31 @@ do_build() { ;; esac + case "$XBPS_TARGET_MACHINE" in + x86_64*|i686*|arm*) + echo "ac_add_options --disable-elf-hack" >>.mozconfig + ;; + esac + if [ "$CROSS_BUILD" ]; then + cat >> .cargo/config.in <&1 | \ + sed -n '/#include <...> search starts here:/,/End of search list./p' | \ + sed '1,1d;$d' | sed 's/^ /-I/' | paste -s ) + + export BINDGEN_CFLAGS="--target=$XBPS_CROSS_TRIPLET \ + --sysroot=${XBPS_CROSS_BASE} ${BINDGEN_INCLUDE_FLAGS}" + 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,11 +105,17 @@ 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" export CXXFLAGS+=" -D_FILE_OFFSET_BITS=64" ;; + armv7*) + export CFLAGS+=" -mfpu=neon -Wno-psabi" + export CXXFLAGS+=" -mfpu=neon -Wno-psabi" + ;; esac export LDFLAGS+=" -Wl,-rpath=/usr/lib/firefox"