Skip to content

Commit

Permalink
thunderbird: fix build on loongson3 (and possibly others)
Browse files Browse the repository at this point in the history
- (loongson3) Disable Clang due to missing ld.lld (linkage failure).
- (loongson3) Use the bfd linker.
- (loongosn3) Drop unsupported --disable-elf-hacks option.
- Sync LTO flag hack from Firefox to fix build, as some architectures, such as
  loongson3, has extra LTO flags starting with -flto (-flto-partition=none).
- Make wasi-sysroot sandbox optional.
  • Loading branch information
MingcongBai committed Oct 30, 2023
1 parent 2f23c68 commit 666fff6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
4 changes: 3 additions & 1 deletion app-web/thunderbird/autobuild/defines
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ PKGDES="Standalone mail and news reader from Mozilla"
PKGBREAK="thunderbird-i18n<=38.5.0"
PKGREP="thunderbird-i18n<=38.5.0"

# FIXME: ld.lld of llvm 15 complains about "relocation R_MIPS_64 cannot be used against local symbol" in loongson3. Skip for now.
USECLANG=1
ABSPLITDBG=0

Expand All @@ -21,3 +20,6 @@ AB_FLAGS_PIE=0
# FIXME: LLVM crashes.
USECLANG__PPC64EL=0
NOLTO__PPC64EL=1

# FIXME: ld.lld is not available.
USECLANG__LOONGSON3=0
4 changes: 0 additions & 4 deletions app-web/thunderbird/autobuild/mozconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ ac_add_options --allow-addon-sideload
ac_add_options --with-google-location-service-api-keyfile="$SRCDIR"/autobuild/google-api-key
ac_add_options --with-google-safebrowsing-api-keyfile="$SRCDIR"/autobuild/google-api-key

# WASI.
ac_add_options --with-wasi-sysroot=/usr/lib/wasm32-wasi/

# Toolchain settings.
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-release
ac_add_options --disable-strip
ac_add_options --enable-linker=lld
ac_add_options --enable-hardening

# Dependencies.
Expand Down
29 changes: 22 additions & 7 deletions app-web/thunderbird/autobuild/prepare
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
abinfo "Stripping LTO flags, let Firefox decide ..."
export CFLAGS="${CFLAGS/\-flto/}"
export CXXFLAGS="${CXXFLAGS/\-flto/}"
abinfo "Stripping LTO flags, let Thunderbird decide ..."
export CFLAGS="${CFLAGS/\-flto=$ABTHREADS/}"
export CXXFLAGS="${CXXFLAGS/\-flto=$ABTHREADS/}"
export LDFLAGS="${LDFLAGS/\-flto/}"

abinfo "Installing mozconfig ..."
Expand All @@ -18,15 +18,30 @@ if ab_match_arch loongson3; then
echo "ac_add_options --disable-jit" >> "$SRCDIR"/mozconfig
fi

# FIXME: --disable-elf-hack is not available for ppc64el.
if ! ab_match_arch ppc64el; then
# FIXME: --disable-elf-hack is not available for loongson3, ppc64el.
if ! ab_match_arch loongson3 && \
! ab_match_arch ppc64el; then
abinfo "Setting --disable-elf-hack ..."
echo "ac_add_options --disable-elf-hack" \
>> "$SRCDIR"/autobuild/mozconfig
>> "$SRCDIR"/mozconfig
fi

if ! ab_match_arch ppc64el; then
abinfo "Use the gold linker ..."
echo "ac_add_options --enable-linker=gold" \
>> "$SRCDIR"/autobuild/mozconfig
>> "$SRCDIR"/mozconfig
fi

if ! ab_match_arch loongson3; then
echo "ac_add_options --enable-linker=lld" \
>> "$SRCDIR"/mozconfig
echo "ac_add_options --with-wasi-sysroot=/usr/lib/wasm32-wasi/" \
>> "$SRCDIR"/mozconfig
else
echo "ac_add_options --enable-linker=bfd" \
>> "$SRCDIR"/mozconfig
echo "ac_add_options --without-wasm-sandboxed-libraries" \
>> "$SRCDIR"/mozconfig
fi

abinfo "Declaring $SHELL as /bin/bash ..."
Expand Down
2 changes: 1 addition & 1 deletion app-web/thunderbird/spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VER=115.2.2
REL=1
REL=2
CHKUPDATE="anitya::id=4967"
SRCS="https://archive.mozilla.org/pub/thunderbird/releases/$VER/source/thunderbird-$VER.source.tar.xz \
file::rename=af.xpi::http://ftp.mozilla.org/pub/thunderbird/releases/$VER/linux-x86_64/xpi/af.xpi \
Expand Down

0 comments on commit 666fff6

Please sign in to comment.