extpython/scripts/build.sh

41 lines
787 B
Bash
Raw Normal View History

2019-05-31 09:07:08 -07:00
#!/bin/bash -eux
2019-05-31 07:41:20 -07:00
2019-05-31 09:07:08 -07:00
. /tmp/vars.sh
function template {
perl -p -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' < $1
}
2019-05-31 07:41:20 -07:00
# create build dir
cd /build
mkdir work
cd work
# get cpython source
mkdir cpython
wget -qO- cpython.tar.gz $PYTHON_TARBALL | tar zxf - -C cpython/ --strip-components=1
2019-05-31 15:17:58 -07:00
# generate debian metadata
2019-05-31 09:07:08 -07:00
mkdir debian
export BUILD_DATE=$(date -R)
template /src/debian/changelog | tee debian/changelog
template /src/debian/control | tee debian/control
cp /src/debian/compat debian/
cp /src/Makefile ./
2019-05-31 09:23:34 -07:00
sed -i -E "s/_OPT_DIR_/${PYTHON_MAJOR}/" Makefile
2019-05-31 07:41:20 -07:00
2021-06-10 19:06:17 -07:00
if [ -v RULESFILE ]; then
cp /src/debian/$RULESFILE debian/rules
else
cp /src/debian/rules debian/
fi
2019-05-31 07:41:20 -07:00
# build the deb
time dpkg-buildpackage -us -uc -b
cd ..
mkdir out
2019-05-31 15:17:58 -07:00
mv *.deb out/
2019-05-31 07:41:20 -07:00
cd out
sha256sum *