2019-02-27 19:58:17 +01:00
|
|
|
termux_step_massage() {
|
2019-08-14 19:29:58 +02:00
|
|
|
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
|
|
|
|
|
2019-02-27 19:58:17 +01:00
|
|
|
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
|
|
|
|
|
|
|
# Remove lib/charset.alias which is installed by gettext-using packages:
|
|
|
|
rm -f lib/charset.alias
|
|
|
|
|
|
|
|
# Remove locale files we're not interested in::
|
|
|
|
rm -Rf share/locale
|
|
|
|
|
|
|
|
# Remove old kept libraries (readline):
|
2019-08-06 14:39:42 +02:00
|
|
|
find . -name '*.old' -print0 | xargs -0 -r rm -f
|
2019-02-27 19:58:17 +01:00
|
|
|
|
|
|
|
# Move over sbin to bin:
|
|
|
|
for file in sbin/*; do if test -f "$file"; then mv "$file" bin/; fi; done
|
|
|
|
|
2019-08-06 14:39:42 +02:00
|
|
|
# Remove world permissions and make sure that user still have read-write permissions.
|
|
|
|
chmod -Rf u+rw,g-rwx,o-rwx . || true
|
2019-02-27 19:58:17 +01:00
|
|
|
|
2019-08-12 23:16:07 +02:00
|
|
|
if [ "$TERMUX_DEBUG" = "false" ]; then
|
2019-02-27 19:58:17 +01:00
|
|
|
# Strip binaries. file(1) may fail for certain unusual files, so disable pipefail.
|
|
|
|
set +e +o pipefail
|
2019-08-11 02:26:54 +02:00
|
|
|
find . \( -path "./bin/*" -o -path "./lib/*" -o -path "./libexec/*" \) -type f | \
|
2019-08-11 02:23:57 +02:00
|
|
|
xargs -r file | grep -E "ELF .+ (executable|shared object)" | cut -f 1 -d : | \
|
|
|
|
xargs -r "$STRIP" --strip-unneeded --preserve-dates
|
2019-02-27 19:58:17 +01:00
|
|
|
set -e -o pipefail
|
|
|
|
fi
|
2019-08-06 14:39:42 +02:00
|
|
|
|
2020-10-01 18:33:58 +02:00
|
|
|
if [ "$TERMUX_PKG_NO_ELF_CLEANER" != "true" ]; then
|
|
|
|
# Remove entries unsupported by Android's linker:
|
|
|
|
find . \( -path "./bin/*" -o -path "./lib/*" -o -path "./libexec/*" \) -type f -print0 | xargs -r -0 "$TERMUX_ELF_CLEANER"
|
|
|
|
fi
|
2019-02-27 19:58:17 +01:00
|
|
|
|
|
|
|
# Fix shebang paths:
|
|
|
|
while IFS= read -r -d '' file
|
|
|
|
do
|
2019-08-06 14:39:42 +02:00
|
|
|
head -c 100 "$file" | grep -E "^#\!.*\\/bin\\/.*" | grep -q -E -v "^#\! ?\\/system" && \
|
|
|
|
sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX/bin/\2@" "$file"
|
2019-02-27 19:58:17 +01:00
|
|
|
done < <(find -L . -type f -print0)
|
|
|
|
|
2020-07-07 18:22:00 +02:00
|
|
|
# Delete the info directory file.
|
|
|
|
rm -rf ./share/info/dir
|
|
|
|
|
2019-02-27 19:58:17 +01:00
|
|
|
test ! -z "$TERMUX_PKG_RM_AFTER_INSTALL" && rm -Rf $TERMUX_PKG_RM_AFTER_INSTALL
|
|
|
|
|
|
|
|
find . -type d -empty -delete # Remove empty directories
|
|
|
|
|
|
|
|
if [ -d share/man ]; then
|
2019-08-06 14:39:42 +02:00
|
|
|
# Remove non-english man pages:
|
|
|
|
find share/man -mindepth 1 -maxdepth 1 -type d ! -name man\* | xargs -r rm -rf
|
|
|
|
|
2019-02-27 19:58:17 +01:00
|
|
|
# Compress man pages with gzip:
|
2019-04-09 16:45:43 +02:00
|
|
|
find share/man -type f ! -iname \*.gz -print0 | xargs -r -0 gzip
|
|
|
|
|
2019-02-27 19:58:17 +01:00
|
|
|
# Update man page symlinks, e.g. unzstd.1 -> zstd.1:
|
|
|
|
while IFS= read -r -d '' file
|
|
|
|
do
|
|
|
|
local _link_value
|
|
|
|
_link_value=$(readlink $file)
|
|
|
|
rm $file
|
|
|
|
ln -s $_link_value.gz $file.gz
|
2019-04-09 16:45:43 +02:00
|
|
|
done < <(find share/man -type l ! -iname \*.gz -print0)
|
2019-02-27 19:58:17 +01:00
|
|
|
fi
|
|
|
|
|
2019-03-07 20:35:32 +01:00
|
|
|
termux_create_subpackages
|
2019-02-27 19:58:17 +01:00
|
|
|
|
|
|
|
# .. remove empty directories (NOTE: keep this last):
|
|
|
|
find . -type d -empty -delete
|
|
|
|
}
|