Skip to content

Commit af65080

Browse files
committed
tree-wide: migrate system-clang hostbuilds to clang-19
- After #25197, the termux-package-builder docker container will now contain `clang-19`, not `clang-18`, so all instances of `clang-18` and accompanying `-18` program names need to be renamed to `-19` instead. - It should be noted that there is another kind of `clang`-hostbuild that can be found in termux-packages that uses NDK-`clang` to hostbuild rather than system-`clang`. Those do not have a number appended to their invocations of `clang`, so they are unaffected here and do not need to be modified. - Introduce new variables `TERMUX_HOST_LLVM_MAJOR_VERSION` and `TERMUX_HOST_LLVM_BASE_DIR` in `scripts/properties.sh` to reduce the number of places where the llvm.org-provided LLVM installation version number needs to be updated to just 1 %ci:no-build
1 parent 060dd82 commit af65080

File tree

10 files changed

+46
-32
lines changed

10 files changed

+46
-32
lines changed

packages/nodejs-lts/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ termux_step_host_build() {
3434
local ICU_VERSION=76.1
3535
local ICU_TAR=icu4c-${ICU_VERSION//./_}-src.tgz
3636
local ICU_DOWNLOAD=https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//./-}/$ICU_TAR
37-
export CC=/usr/bin/clang-18
38-
export CXX=/usr/bin/clang++-18
39-
export LD=/usr/bin/clang++-18
37+
export CC="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang"
38+
export CXX="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++"
39+
export LD="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++"
4040
termux_download \
4141
$ICU_DOWNLOAD\
4242
$TERMUX_PKG_CACHEDIR/$ICU_TAR \

packages/nodejs/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ termux_step_host_build() {
3737
dfacb46bfe4747410472ce3e1144bf28a102feeaa4e3875bac9b4c6cf30f4f3e
3838
tar xf $TERMUX_PKG_CACHEDIR/$ICU_TAR
3939
cd icu/source
40-
export CC=/usr/bin/clang-18
41-
export CXX=/usr/bin/clang++-18
42-
export LD=/usr/bin/clang++-18
40+
export CC="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang"
41+
export CXX="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++"
42+
export LD="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++"
4343
if [ "$TERMUX_ARCH_BITS" = 32 ]; then
4444
./configure --prefix $TERMUX_PKG_HOSTBUILD_DIR/icu-installed \
4545
--disable-samples \

packages/openjdk-17/build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ termux_step_configure() {
9090
OBJDUMP="$OBJDUMP" \
9191
STRIP="$STRIP" \
9292
CXXFILT="llvm-cxxfilt" \
93-
BUILD_CC="/usr/bin/clang-18" \
94-
BUILD_CXX="/usr/bin/clang++-18" \
95-
BUILD_NM="/usr/bin/llvm-nm-18" \
96-
BUILD_AR="/usr/bin/llvm-ar-18" \
97-
BUILD_OBJCOPY="/usr/bin/llvm-objcopy-18" \
98-
BUILD_STRIP="/usr/bin/llvm-strip-18" \
93+
BUILD_CC="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang" \
94+
BUILD_CXX="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++" \
95+
BUILD_NM="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-nm" \
96+
BUILD_AR="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-ar" \
97+
BUILD_OBJCOPY="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-objcopy" \
98+
BUILD_STRIP="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-strip" \
9999
--with-jobs=$TERMUX_PKG_MAKE_PROCESSES
100100
}
101101

packages/openjdk-21/build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ termux_step_configure() {
9292
OBJDUMP="$OBJDUMP" \
9393
STRIP="$STRIP" \
9494
CXXFILT="llvm-cxxfilt" \
95-
BUILD_CC="/usr/bin/clang-18" \
96-
BUILD_CXX="/usr/bin/clang++-18" \
97-
BUILD_NM="/usr/bin/llvm-nm-18" \
98-
BUILD_AR="/usr/bin/llvm-ar-18" \
99-
BUILD_OBJCOPY="/usr/bin/llvm-objcopy-18" \
100-
BUILD_STRIP="/usr/bin/llvm-strip-18" \
95+
BUILD_CC="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang" \
96+
BUILD_CXX="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++" \
97+
BUILD_NM="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-nm" \
98+
BUILD_AR="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-ar" \
99+
BUILD_OBJCOPY="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-objcopy" \
100+
BUILD_STRIP="$TERMUX_HOST_LLVM_BASE_DIR/bin/llvm-strip" \
101101
--with-jobs=$TERMUX_PKG_MAKE_PROCESSES
102102
}
103103

packages/rust/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ termux_step_configure() {
148148
sed \
149149
-e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
150150
-e "s|@TERMUX_STANDALONE_TOOLCHAIN@|${TERMUX_STANDALONE_TOOLCHAIN}|g" \
151+
-e "s|@TERMUX_HOST_LLVM_BASE_DIR@|${TERMUX_HOST_LLVM_BASE_DIR}|g" \
151152
-e "s|@CARGO_TARGET_NAME@|${CARGO_TARGET_NAME}|g" \
152153
-e "s|@RUSTC@|${RUSTC}|g" \
153154
-e "s|@CARGO@|${CARGO}|g" \

packages/rust/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ rpath = false
4848
lld = false
4949

5050
[target.x86_64-unknown-linux-gnu]
51-
llvm-config = "/usr/bin/llvm-config-19"
51+
llvm-config = "@TERMUX_HOST_LLVM_BASE_DIR@/bin/llvm-config"
5252
rpath = true
5353

5454
[target.aarch64-linux-android]

packages/swift/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ termux_step_host_build() {
118118

119119
# The Ubuntu Docker image (sometimes used by CI but sometimes not)
120120
# might not have clang/clang++ in its path, so explicitly set it
121-
# to clang-18 if necessary.
121+
# to the versioned system clang if necessary.
122122
if [ -z "$CLANG" ]; then
123-
CLANG=$(command -v clang-18)
124-
CLANGXX=$(command -v clang++-18)
123+
CLANG="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang"
124+
CLANGXX="$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++"
125125
fi
126126

127127
# Natively compile llvm-tblgen and some other files needed later.

scripts/properties.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ TERMUX_NDK_VERSION="${TERMUX_NDK_VERSION_NUM}${TERMUX_NDK_REVISION}"
314314
# and update SHA256 sums in scripts/setup-android-sdk.sh
315315
# check all packages build and run correctly and bump if needed
316316

317+
: "${TERMUX_HOST_LLVM_MAJOR_VERSION:="19"}"
318+
: "${TERMUX_HOST_LLVM_BASE_DIR:="/usr/lib/llvm-${TERMUX_HOST_LLVM_MAJOR_VERSION}"}"
319+
317320
: "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-17-openjdk-amd64}"
318321
export JAVA_HOME="${TERMUX_JAVA_HOME}"
319322

scripts/setup-ubuntu.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ PACKAGES+=" php-xml"
144144
PACKAGES+=" composer"
145145

146146
# Needed by package rust.
147-
PACKAGES+=" libssl-dev" # Needed to build Rust
148-
PACKAGES+=" llvm-19-dev"
149-
PACKAGES+=" llvm-19-tools"
150-
PACKAGES+=" clang-19"
147+
PACKAGES+=" libssl-dev"
151148

152149
# Needed by librusty-v8
153150
PACKAGES+=" libclang-rt-17-dev"
@@ -331,23 +328,36 @@ fi
331328
# Allow 32-bit packages.
332329
$SUDO dpkg --add-architecture i386
333330

331+
$SUDO apt-get -yq update
332+
333+
# Install jq first, then source properties.sh
334+
$SUDO env DEBIAN_FRONTEND=noninteractive \
335+
apt-get install -yq --no-install-recommends $PACKAGES
336+
337+
. $(dirname "$(realpath "$0")")/properties.sh
338+
339+
LLVM_PACKAGES=""
340+
341+
# Needed by rust and other packages.
342+
LLVM_PACKAGES+=" llvm-${TERMUX_HOST_LLVM_MAJOR_VERSION}-dev"
343+
LLVM_PACKAGES+=" llvm-${TERMUX_HOST_LLVM_MAJOR_VERSION}-tools"
344+
LLVM_PACKAGES+=" clang-${TERMUX_HOST_LLVM_MAJOR_VERSION}"
345+
334346
# Add apt.llvm.org repo to get newer LLVM than Ubuntu provided
335347
$SUDO cp $(dirname "$(realpath "$0")")/llvm-snapshot.gpg.key /etc/apt/trusted.gpg.d/apt.llvm.org.asc
336348
$SUDO chmod a+r /etc/apt/trusted.gpg.d/apt.llvm.org.asc
337349
{
338-
echo "deb [arch=amd64] http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
350+
echo "deb [arch=amd64] http://apt.llvm.org/noble/ llvm-toolchain-noble-${TERMUX_HOST_LLVM_MAJOR_VERSION} main"
339351
} | $SUDO tee /etc/apt/sources.list.d/apt-llvm-org.list > /dev/null
340352

341353
$SUDO apt-get -yq update
342354

343355
$SUDO env DEBIAN_FRONTEND=noninteractive \
344-
apt-get install -yq --no-install-recommends $PACKAGES
356+
apt-get install -yq --no-install-recommends $LLVM_PACKAGES
345357

346358
$SUDO locale-gen --purge en_US.UTF-8
347359
echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' | $SUDO tee -a /etc/default/locale
348360

349-
. $(dirname "$(realpath "$0")")/properties.sh
350-
351361
# Ownership of `TERMUX__PREFIX` must be fixed before `TERMUX_APP__DATA_DIR`
352362
# if its under it, otherwise `TERMUX__ROOTFS` will not have its ownership fixed.
353363
$SUDO mkdir -p "$TERMUX__PREFIX"

x11-packages/qt5-qtwebengine/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ TERMUX_PKG_HOSTBUILD=true
1515
termux_step_host_build() {
1616
# Generate ffmpeg headers for i686
1717
mkdir -p fake-bin
18-
ln -s $(command -v clang-18) fake-bin/clang
19-
ln -s $(command -v clang++-18) fake-bin/clang++
18+
ln -s "$TERMUX_HOST_LLVM_BASE_DIR/bin/clang" fake-bin/clang
19+
ln -s "$TERMUX_HOST_LLVM_BASE_DIR/bin/clang++" fake-bin/clang++
2020

2121
# Remove python3 compatibility file preventing using newer python3 versions:
2222
rm $TERMUX_PKG_SRCDIR/src/3rdparty/chromium/third_party/ffmpeg/chromium/scripts/enum.py

0 commit comments

Comments
 (0)