build-package: mv termux_step_create_debfile to scripts/build/

This commit is contained in:
Henrik Grimler 2019-02-27 19:59:31 +01:00 committed by Leonid Pliushch
parent 586e8709fd
commit 8be8c3a2d6
2 changed files with 47 additions and 46 deletions

View File

@ -120,52 +120,7 @@ termux_step_create_debscripts() {
}
# Create the build deb file. Not to be overridden by package scripts.
termux_step_create_debfile() {
# 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
test -n "$TERMUX_PKG_PLATFORM_INDEPENDENT" && 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_DEPENDS" && echo "Depends: $TERMUX_PKG_DEPENDS" >> DEBIAN/control
test ! -z "$TERMUX_PKG_ESSENTIAL" && 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.gz
tar -czf "$TERMUX_PKG_PACKAGEDIR/control.tar.gz" .
test ! -f "$TERMUX_COMMON_CACHEDIR/debian-binary" && echo "2.0" > "$TERMUX_COMMON_CACHEDIR/debian-binary"
TERMUX_PKG_DEBFILE=$TERMUX_DEBDIR/${TERMUX_PKG_NAME}${DEBUG}_${TERMUX_PKG_FULLVERSION}_${TERMUX_ARCH}.deb
# Create the actual .deb file:
ar cr "$TERMUX_PKG_DEBFILE" \
"$TERMUX_COMMON_CACHEDIR/debian-binary" \
"$TERMUX_PKG_PACKAGEDIR/control.tar.gz" \
"$TERMUX_PKG_PACKAGEDIR/data.tar.xz"
}
source scripts/build/termux_step_create_debfile.sh
termux_step_compare_debs() {
if [ "${TERMUX_INSTALL_DEPS}" = true ]; then

View File

@ -0,0 +1,46 @@
termux_step_create_debfile() {
# 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
test -n "$TERMUX_PKG_PLATFORM_INDEPENDENT" && 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_DEPENDS" && echo "Depends: $TERMUX_PKG_DEPENDS" >> DEBIAN/control
test ! -z "$TERMUX_PKG_ESSENTIAL" && 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.gz
tar -czf "$TERMUX_PKG_PACKAGEDIR/control.tar.gz" .
test ! -f "$TERMUX_COMMON_CACHEDIR/debian-binary" && echo "2.0" > "$TERMUX_COMMON_CACHEDIR/debian-binary"
TERMUX_PKG_DEBFILE=$TERMUX_DEBDIR/${TERMUX_PKG_NAME}${DEBUG}_${TERMUX_PKG_FULLVERSION}_${TERMUX_ARCH}.deb
# Create the actual .deb file:
ar cr "$TERMUX_PKG_DEBFILE" \
"$TERMUX_COMMON_CACHEDIR/debian-binary" \
"$TERMUX_PKG_PACKAGEDIR/control.tar.gz" \
"$TERMUX_PKG_PACKAGEDIR/data.tar.xz"
}