82a78ca781
Building metapackages doesn't involve setup of compiler toolchain, so certain variables are not set. In general, it was not expected that package archive generation will use utilities that come with cross-compiler as this functionality should rely on utilities installed by host package manager. /home/builder/termux-packages/scripts/build/termux_step_create_debian_package.sh: line 49: AR: unbound variable
54 lines
2.5 KiB
Bash
54 lines
2.5 KiB
Bash
termux_step_create_debian_package() {
|
|
if [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
|
|
# Metapackage doesn't have data inside.
|
|
rm -rf data
|
|
fi
|
|
tar -cJf "$TERMUX_PKG_PACKAGEDIR/data.tar.xz" -H gnu .
|
|
|
|
# Get install size. This will be written as the "Installed-Size" deb field so is measured in 1024-byte blocks:
|
|
local TERMUX_PKG_INSTALLSIZE
|
|
TERMUX_PKG_INSTALLSIZE=$(du -sk . | cut -f 1)
|
|
|
|
# From here on TERMUX_ARCH is set to "all" if TERMUX_PKG_PLATFORM_INDEPENDENT is set by the package
|
|
[ "$TERMUX_PKG_PLATFORM_INDEPENDENT" = "true" ] && TERMUX_ARCH=all
|
|
|
|
mkdir -p DEBIAN
|
|
cat > DEBIAN/control <<-HERE
|
|
Package: $TERMUX_PKG_NAME
|
|
Architecture: ${TERMUX_ARCH}
|
|
Installed-Size: ${TERMUX_PKG_INSTALLSIZE}
|
|
Maintainer: $TERMUX_PKG_MAINTAINER
|
|
Version: $TERMUX_PKG_FULLVERSION
|
|
Homepage: $TERMUX_PKG_HOMEPAGE
|
|
HERE
|
|
test ! -z "$TERMUX_PKG_BREAKS" && echo "Breaks: $TERMUX_PKG_BREAKS" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_PRE_DEPENDS" && echo "Pre-Depends: $TERMUX_PKG_PRE_DEPENDS" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_DEPENDS" && echo "Depends: $TERMUX_PKG_DEPENDS" >> DEBIAN/control
|
|
[ "$TERMUX_PKG_ESSENTIAL" = "true" ] && echo "Essential: yes" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_CONFLICTS" && echo "Conflicts: $TERMUX_PKG_CONFLICTS" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_RECOMMENDS" && echo "Recommends: $TERMUX_PKG_RECOMMENDS" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_REPLACES" && echo "Replaces: $TERMUX_PKG_REPLACES" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_PROVIDES" && echo "Provides: $TERMUX_PKG_PROVIDES" >> DEBIAN/control
|
|
test ! -z "$TERMUX_PKG_SUGGESTS" && echo "Suggests: $TERMUX_PKG_SUGGESTS" >> DEBIAN/control
|
|
echo "Description: $TERMUX_PKG_DESCRIPTION" >> DEBIAN/control
|
|
|
|
# Create DEBIAN/conffiles (see https://www.debian.org/doc/debian-policy/ap-pkg-conffiles.html):
|
|
for f in $TERMUX_PKG_CONFFILES; do echo "$TERMUX_PREFIX/$f" >> DEBIAN/conffiles; done
|
|
|
|
# Allow packages to create arbitrary control files.
|
|
# XXX: Should be done in a better way without a function?
|
|
cd DEBIAN
|
|
termux_step_create_debscripts
|
|
|
|
# Create control.tar.xz
|
|
tar -cJf "$TERMUX_PKG_PACKAGEDIR/control.tar.xz" -H gnu .
|
|
|
|
test ! -f "$TERMUX_COMMON_CACHEDIR/debian-binary" && echo "2.0" > "$TERMUX_COMMON_CACHEDIR/debian-binary"
|
|
TERMUX_PKG_DEBFILE=$TERMUX_OUTPUT_DIR/${TERMUX_PKG_NAME}${DEBUG}_${TERMUX_PKG_FULLVERSION}_${TERMUX_ARCH}.deb
|
|
# Create the actual .deb file:
|
|
${AR-ar} cr "$TERMUX_PKG_DEBFILE" \
|
|
"$TERMUX_COMMON_CACHEDIR/debian-binary" \
|
|
"$TERMUX_PKG_PACKAGEDIR/control.tar.xz" \
|
|
"$TERMUX_PKG_PACKAGEDIR/data.tar.xz"
|
|
}
|