Skip to content

Commit f431b72

Browse files
authored
scripts: change in PATH variable configurings (#23665)
1 parent 28e9eb7 commit f431b72

8 files changed

+17
-18
lines changed

scripts/build/setup/termux_setup_ghc.sh

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ termux_setup_ghc() {
2727
(
2828
set -e
2929
unset CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS AR AS CPP LD RANLIB READELF STRIP
30+
export PATH="/usr/bin"
3031
cd "$TERMUX_GHC_TEMP_FOLDER"
3132
./configure --prefix="$TERMUX_GHC_RUNTIME_FOLDER"
3233
make install

scripts/build/setup/termux_setup_gn.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ termux_setup_gn() {
2525
cd $GN_FOLDER
2626
(
2727
unset CC CXX CFLAGS CXXFLAGS LD LDFLAGS AR AS CPP OBJCOPY OBJDUMP RANLIB READELF STRIP
28+
export PATH="/usr/bin"
2829
./build/gen.py \
2930
--no-last-commit-position
3031
cat <<-EOF >./out/last_commit_position.h

scripts/build/setup/termux_setup_meson.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ termux_setup_meson() {
2727
shopt -u nullglob
2828
mv "$MESON_TMP_FOLDER" "$MESON_FOLDER"
2929
fi
30-
TERMUX_MESON="$MESON_FOLDER/meson.py"
30+
TERMUX_MESON="/usr/bin/python${TERMUX_PYTHON_VERSION} ${MESON_FOLDER}/meson.py"
3131
TERMUX_MESON_CROSSFILE=$TERMUX_PKG_TMPDIR/meson-crossfile-$TERMUX_ARCH.txt
3232
local MESON_CPU MESON_CPU_FAMILY
3333
if [ "$TERMUX_ARCH" = "arm" ]; then

scripts/build/setup/termux_setup_python_pip.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ termux_setup_python_pip() {
5353

5454
if [ ! -d "$TERMUX_PYTHON_CROSSENV_PREFIX" ]; then
5555
cd "$TERMUX_PYTHON_CROSSENV_SRCDIR"
56-
python${TERMUX_PYTHON_VERSION} -m crossenv \
56+
/usr/bin/python${TERMUX_PYTHON_VERSION} -m crossenv \
5757
"$TERMUX_PREFIX/bin/python${TERMUX_PYTHON_VERSION}" \
5858
"${TERMUX_PYTHON_CROSSENV_PREFIX}"
5959
fi
@@ -66,6 +66,6 @@ termux_setup_python_pip() {
6666
export SETUPTOOLS_USE_DISTUTILS=stdlib
6767
fi
6868

69-
export PATH="${PATH}:${TERMUX_PYTHON_CROSSENV_PREFIX}/build/bin"
69+
export PATH="${TERMUX_PYTHON_CROSSENV_PREFIX}/build/bin:${PATH}"
7070
fi
7171
}

scripts/build/setup/termux_setup_xmake.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ termux_setup_xmake() {
4646
(
4747
# avoid pick up Termux pkg-config, stop link with Termux ncursesw
4848
unset AR AS CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS PREFIX TERMUX_ARCH
49-
export PATH="/usr/bin:${PATH}"
49+
export PATH="/usr/bin"
5050
pushd "${XMAKE_FOLDER}"
5151
./configure --prefix="${XMAKE_FOLDER}"
5252
make -j"$(nproc)" install

scripts/build/termux_step_massage.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ termux_step_massage() {
2626
# Remove cache file created by gtk-update-icon-cache:
2727
rm -f share/icons/hicolor/icon-theme.cache
2828

29-
# Remove locale files we're not interested in::
29+
# Remove locale files we're not interested in:
3030
rm -Rf share/locale
3131

32+
# Remove ldconfig cache:
33+
rm -f glibc/etc/ld.so.cache
34+
3235
# `update-mime-database` updates NOT ONLY "$PREFIX/share/mime/mime.cache".
3336
# Simply removing this specific file does not solve the issue.
3437
if [ -e "share/mime/mime.cache" ]; then

scripts/build/termux_step_setup_variables.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,8 @@ termux_step_setup_variables() {
9595
if [ -n "${LD_PRELOAD-}" ]; then
9696
unset LD_PRELOAD
9797
fi
98-
if ! $(echo "$PATH" | grep -q "^$TERMUX_PREFIX/bin"); then
99-
if [ -d "${TERMUX_PREFIX}/bin" ]; then
100-
export PATH="${TERMUX_PREFIX}/bin:${PATH}"
101-
else
102-
termux_error_exit "Glibc components are not installed, run './scripts/setup-termux-glibc.sh'"
103-
fi
98+
if [ ! -d "${TERMUX_PREFIX}/bin" ]; then
99+
termux_error_exit "Glibc components are not installed, run './scripts/setup-termux-glibc.sh'"
104100
fi
105101
else
106102
if [ ! -d "${CGCT_DIR}/${TERMUX_ARCH}/bin" ]; then

scripts/build/toolchain/termux_setup_toolchain_gnu.sh

+5-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ termux_setup_toolchain_gnu() {
5757
export PKGCONFIG=$PKG_CONFIG
5858
export PKG_CONFIG_LIBDIR="$TERMUX_PKG_CONFIG_LIBDIR"
5959

60-
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
61-
if ! $(echo "$PATH" | grep -q "^$TERMUX_STANDALONE_TOOLCHAIN/bin:"); then
62-
export PATH="$TERMUX_STANDALONE_TOOLCHAIN/bin:$PATH"
63-
fi
64-
if ! $(echo "$PATH" | grep -q ":$TERMUX_PREFIX/bin"); then
65-
export PATH="$PATH:$TERMUX_PREFIX/bin"
66-
fi
60+
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ] && ! tr ':' '\n' <<< "$PATH" | grep -q "^$TERMUX_PREFIX/bin$"; then
61+
export PATH="$TERMUX_PREFIX/bin:$PATH"
62+
fi
63+
if ! tr ':' '\n' <<< "$PATH" | grep -q "^$TERMUX_STANDALONE_TOOLCHAIN/bin$"; then
64+
export PATH="$TERMUX_STANDALONE_TOOLCHAIN/bin:$PATH"
6765
fi
6866

6967
export CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"

0 commit comments

Comments
 (0)