diff --git a/x11-packages/firefox/0007-fix-link-with-libcxx-18.patch b/x11-packages/firefox/0007-fix-link-with-libcxx-18.patch new file mode 100644 index 00000000000000..888df0e8ecf178 --- /dev/null +++ b/x11-packages/firefox/0007-fix-link-with-libcxx-18.patch @@ -0,0 +1,14 @@ +https://bugzilla.mozilla.org/show_bug.cgi?id=1874059 +https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276746 + +--- a/build/moz.configure/toolchain.configure ++++ b/build/moz.configure/toolchain.configure +@@ -2344,7 +2344,7 @@ + @depends(target, build_environment) + def visibility_flags(target, env): + if target.os != "WINNT": +- if target.kernel == "Darwin": ++ if True: + return ("-fvisibility=hidden", "-fvisibility-inlines-hidden") + return ( + "-I%s/system_wrappers" % os.path.join(env.dist), diff --git a/x11-packages/firefox/0027-fix-compile-with-libcxx.patch b/x11-packages/firefox/0027-fix-compile-with-libcxx.patch new file mode 100644 index 00000000000000..a6836b4986e383 --- /dev/null +++ b/x11-packages/firefox/0027-fix-compile-with-libcxx.patch @@ -0,0 +1,11 @@ +--- a/gfx/graphite2/src/MozGrMalloc.h ++++ b/gfx/graphite2/src/MozGrMalloc.h +@@ -12,7 +12,7 @@ + + #include "mozilla/mozalloc.h" + +-#if defined(XP_LINUX) ++#if defined(XP_LINUX) && !defined(_LIBCPP_VERSION) + + #define malloc moz_xmalloc + #define calloc moz_xcalloc diff --git a/x11-packages/firefox/0100-Bug-1912663-Fix-some-build-issues-with-cbindgen-0.27.patch b/x11-packages/firefox/0100-Bug-1912663-Fix-some-build-issues-with-cbindgen-0.27.patch new file mode 100644 index 00000000000000..a5009db8e6b394 --- /dev/null +++ b/x11-packages/firefox/0100-Bug-1912663-Fix-some-build-issues-with-cbindgen-0.27.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= +Date: Sun, 11 Aug 2024 15:12:29 +0000 +Subject: [PATCH] Bug 1912663 - Fix some build issues with cbindgen 0.27. + r=firefox-style-system-reviewers,zrhoffman + +It updates serde and syn and they are more strict. In particular, syn 2 +doesn't parse the rust 2015 syntax where try is not a keyword, and serde +rejects duplicate keys. + +Differential Revision: https://phabricator.services.mozilla.com/D219025 +--- + servo/components/style_traits/values.rs | 16 ++++++++-------- + servo/ports/geckolib/cbindgen.toml | 1 - + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs +index 545dd317de14..1128eb9b315e 100644 +--- a/servo/components/style_traits/values.rs ++++ b/servo/components/style_traits/values.rs +@@ -388,39 +388,39 @@ impl Separator for Space { + where + F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result>, + { +- input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. ++ input.skip_whitespace(); // Unnecessary for correctness, but may help try_parse() rewind less. + let mut results = vec![parse_one(input)?]; + loop { +- input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. +- if let Ok(item) = input.try(&mut parse_one) { ++ input.skip_whitespace(); // Unnecessary for correctness, but may help try_parse() rewind less. ++ if let Ok(item) = input.try_parse(&mut parse_one) { + results.push(item); + } else { + return Ok(results); + } + } + } + } + + impl Separator for CommaWithSpace { + fn separator() -> &'static str { + ", " + } + + fn parse<'i, 't, F, T, E>( + input: &mut Parser<'i, 't>, + mut parse_one: F, + ) -> Result, ParseError<'i, E>> + where + F: for<'tt> FnMut(&mut Parser<'i, 'tt>) -> Result>, + { +- input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. ++ input.skip_whitespace(); // Unnecessary for correctness, but may help try_parse() rewind less. + let mut results = vec![parse_one(input)?]; + loop { +- input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. ++ input.skip_whitespace(); // Unnecessary for correctness, but may help try_parse() rewind less. + let comma_location = input.current_source_location(); +- let comma = input.try(|i| i.expect_comma()).is_ok(); +- input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less. +- if let Ok(item) = input.try(&mut parse_one) { ++ let comma = input.try_parse(|i| i.expect_comma()).is_ok(); ++ input.skip_whitespace(); // Unnecessary for correctness, but may help try_parse() rewind less. ++ if let Ok(item) = input.try_parse(&mut parse_one) { + results.push(item); + } else if comma { + return Err(comma_location.new_unexpected_token_error(Token::Comma)); +diff --git a/servo/ports/geckolib/cbindgen.toml b/servo/ports/geckolib/cbindgen.toml +index d507293e195d..38ff6504d949 100644 +--- a/servo/ports/geckolib/cbindgen.toml ++++ b/servo/ports/geckolib/cbindgen.toml +@@ -360,7 +360,6 @@ renaming_overrides_prefixing = true + "Keyframe" = "Keyframe" + "nsChangeHint" = "nsChangeHint" + "ServoElementSnapshotTable" = "ServoElementSnapshotTable" +-"Keyframe" = "Keyframe" + "ComputedKeyframeValues" = "ComputedKeyframeValues" + "OriginFlags" = "OriginFlags" + "ServoTraversalFlags" = "ServoTraversalFlags" diff --git a/x11-packages/firefox/build.sh b/x11-packages/firefox/build.sh index 73a7eb6462f867..075eeb25de31ce 100644 --- a/x11-packages/firefox/build.sh +++ b/x11-packages/firefox/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Mozilla Firefox web browser" TERMUX_PKG_LICENSE="MPL-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="129.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://archive.mozilla.org/pub/firefox/releases/${TERMUX_PKG_VERSION}/source/firefox-${TERMUX_PKG_VERSION}.source.tar.xz TERMUX_PKG_SHA256=4b9ff955de7099f09aa1f00985e34695fa1a911e56c2d46cb4d60c3bff3d9174 # ffmpeg and pulseaudio are dependencies through dlopen(3): @@ -50,6 +51,22 @@ termux_step_post_get_source() { } termux_step_pre_configure() { + # XXX: flang toolchain provides libclang.so + termux_setup_flang + local __fc_dir="$(dirname $(command -v $FC))" + local __flang_toolchain_folder="$(realpath "$__fc_dir"/..)" + if [ ! -d "$TERMUX_PKG_TMPDIR/firefox-toolchain" ]; then + rm -rf "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp + mv "$__flang_toolchain_folder" "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp + + cp "$(command -v "$CC")" "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp/bin/ + cp "$(command -v "$CXX")" "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp/bin/ + cp "$(command -v "$CPP")" "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp/bin/ + + mv "$TERMUX_PKG_TMPDIR"/firefox-toolchain-tmp "$TERMUX_PKG_TMPDIR"/firefox-toolchain + fi + export PATH="$TERMUX_PKG_TMPDIR/firefox-toolchain/bin:$PATH" + termux_setup_nodejs termux_setup_rust @@ -68,6 +85,11 @@ termux_step_pre_configure() { export HOST_CC=$(command -v clang) export HOST_CXX=$(command -v clang++) + export BINDGEN_CFLAGS="--target=$CCTERMUX_HOST_PLATFORM --sysroot=$TERMUX_PKG_TMPDIR/firefox-toolchain/sysroot" + local env_name=BINDGEN_EXTRA_CLANG_ARGS_${CARGO_TARGET_NAME^^} + env_name=${env_name//-/_} + export $env_name="$BINDGEN_CFLAGS" + # https://reviews.llvm.org/D141184 CXXFLAGS+=" -U__ANDROID__ -D_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC" LDFLAGS+=" -landroid-shmem -landroid-spawn -llog" @@ -79,6 +101,11 @@ termux_step_pre_configure() { } termux_step_configure() { + if [ "$TERMUX_CONTINUE_BUILD" == "true" ]; then + termux_step_pre_configure + cd $TERMUX_PKG_SRCDIR + fi + sed \ -e "s|@TERMUX_HOST_PLATFORM@|${TERMUX_HOST_PLATFORM}|" \ -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|" \ @@ -96,7 +123,7 @@ END } termux_step_make() { - ./mach build --keep-going + ./mach build ./mach buildsymbols }