2019-02-27 19:58:17 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
# 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:
|
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
|
|
|
|
# Make sure user can read and write all files (problem with dpkg otherwise):
|
|
|
|
chmod -R u+rw .
|
|
|
|
}
|