core-lightning/tools/build-release.sh
Rusty Russell 0d5f0d79da build: allow building from source zip file.
Changes both how we construct it and how we deal with not having git.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-01-15 02:18:30 +00:00

62 lines
1.7 KiB
Bash
Executable File

#! /bin/sh
set -e
# When run inside docker (from below), we do build and drop result in /release
if [ x"$1" = x"--inside-docker" ]; then
VER="$2"
git clone /src /build
cd /build
./configure
make -j3
make install DESTDIR=/"$VER"
tar cvfz /release/clightning-"$VER".tar.gz -- *
exit 0
fi
if [ "$(git status --porcelain -u no)" != "" ]; then
echo "Not a clean git directory" >&2
exit 1
fi
VERSION=$(git tag --points-at HEAD)
if [ "$VERSION" = "" ]; then
echo "No tagged version at HEAD?" >&2
exit 1
fi
mkdir -p release
for platform in Fedora-28-amd64 Ubuntu-16.04-amd64 Ubuntu-16.04-i386; do
case $platform in
Fedora-28-amd64)
DOCKERFILE=contrib/Dockerfile.builder.fedora
TAG=fedora
;;
Ubuntu-16.04-amd64)
DOCKERFILE=contrib/Dockerfile.builder
TAG=ubuntu-amd64
;;
Ubuntu-16.04-i386)
DOCKERFILE=contrib/Dockerfile.builder.i386
TAG=ubuntu-i386
;;
*)
echo "No Dockerfile for $platform" >&2
exit 1
esac
docker build -f $DOCKERFILE -t $TAG .
docker run --rm=true -v "$(pwd)":/src:ro -v "$(pwd)"/release:/release $TAG /src/tools/build-release.sh --inside-docker "$VERSION-$platform"
docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform" /build
done
# git archive won't go into submodules :(
ln -sf .. "release/clightning-$VERSION"
FILES=$(git ls-files --recurse-submodules | sed "s,^,clightning-$VERSION/,")
# shellcheck disable=SC2086
(cd release && zip "clightning-$VERSION.zip" $FILES)
rm "release/clightning-$VERSION"
exit 0
sha256sum release/clightning-"$VERSION"* > release/SHA256SUMS
gpg -sb --armor -o release/SHA256SUMS.asc-"$(gpgconf --list-options gpg | awk -F: '$1 == "default-key" {print $10}' | tr -d '"')" release/SHA256SUMS