Skip to content

Commit

Permalink
binutils-cross: enable zstd support
Browse files Browse the repository at this point in the history
Since NDK r27, debug sections of libraries from the bundled sysroot are
compressed with zstd. It is necessary to enable the zstd support for ld.bfd.
  • Loading branch information
licy183 committed Aug 24, 2024
1 parent b51a814 commit ada0ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/binutils-libs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_GROUPS="base-devel"

# For binutils-cross:
# Since NDK r27, debug sections of libraries from the bundled sysroot are
# compressed with zstd. It is necessary to enable the zstd support for ld.bfd.
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="
--prefix=$TERMUX_PREFIX/opt/binutils/cross
Expand All @@ -31,9 +33,16 @@ TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="
--disable-static
--disable-nls
--with-system-zlib
--with-zstd
--disable-gprofng
ZSTD_LIBS=-l:libzstd.a
"

termux_step_post_get_source() {
# Remove this marker all the time, as binutils is architecture-specific.
rm -rf $TERMUX_HOSTBUILD_MARKER
}

termux_step_host_build() {
$TERMUX_PKG_SRCDIR/configure $TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS
make -j $TERMUX_PKG_MAKE_PROCESSES
Expand All @@ -45,9 +54,6 @@ termux_step_host_build() {
export LEXLIB=

termux_step_pre_configure() {
# Remove this marker all the time, as binutils is architecture-specific.
rm -rf $TERMUX_HOSTBUILD_MARKER

export CPPFLAGS="$CPPFLAGS -Wno-c++11-narrowing"
# llvm upgraded a warning to an error, which caused this build (and some
# others, including the rust toolchain) to fail like so:
Expand Down
3 changes: 3 additions & 0 deletions scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ PACKAGES+=" patchelf"
# Needed by lldb for python integration
PACKAGES+=" swig"

# Needed by binutils-cross
PACKAGES+=" libzstd-dev"

# Do not require sudo if already running as root.
SUDO="sudo"
if [ "$(id -u)" = "0" ]; then
Expand Down

0 comments on commit ada0ee2

Please sign in to comment.