You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

79 lines
2.5 KiB

termux_step_massage() {
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
# Remove lib/charset.alias which is installed by gettext-using packages:
rm -f lib/charset.alias
# Remove non-english man pages:
test -d share/man && (cd share/man; for f in $(ls | grep -v man); do rm -Rf $f; done )
if [ -z "${TERMUX_PKG_KEEP_INFOPAGES+x}" ]; then
# Remove info pages:
rm -Rf share/info
fi
# Remove locale files we're not interested in::
rm -Rf share/locale
if [ -z "${TERMUX_PKG_KEEP_SHARE_DOC+x}" ]; then
# Remove info pages:
rm -Rf share/doc
fi
# Remove old kept libraries (readline):
find . -name '*.old' -delete
# Remove static libraries:
if [ $TERMUX_PKG_KEEP_STATIC_LIBRARIES = "false" ]; then
find . -name '*.a' -delete
find . -name '*.la' -delete
fi
# Move over sbin to bin:
for file in sbin/*; do if test -f "$file"; then mv "$file" bin/; fi; done
# Remove world permissions and add write permissions.
# The -f flag is used to suppress warnings about dangling symlinks (such
# as ones to /system/... which may not exist on the build machine):
find . -exec chmod -f u+w,g-rwx,o-rwx \{\} \;
if [ "$TERMUX_DEBUG" = "" ]; then
# Strip binaries. file(1) may fail for certain unusual files, so disable pipefail.
set +e +o pipefail
find . -type f | xargs -r file | grep -E "(executable|shared object)" | grep ELF | cut -f 1 -d : | \
xargs -r "$STRIP" --strip-unneeded --preserve-dates
set -e -o pipefail
fi
# Remove DT_ entries which the android 5.1 linker warns about:
find . -type f -print0 | xargs -r -0 "$TERMUX_ELF_CLEANER"
# Fix shebang paths:
while IFS= read -r -d '' file
do
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"
done < <(find -L . -type f -print0)
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
# Compress man pages with gzip:
find share/man -type f ! -iname \*.gz -print0 | xargs -r -0 gzip
# 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
done < <(find share/man -type l ! -iname \*.gz -print0)
fi
termux_create_subpackages
# .. remove empty directories (NOTE: keep this last):
find . -type d -empty -delete
# Make sure user can read and write all files (problem with dpkg otherwise):
chmod -R u+rw .
}