Refactor static builds

This commit is contained in:
Nicolas Viennot 2019-11-10 15:19:32 -05:00
parent e5f6e68fad
commit bfa3c104d7
5 changed files with 39 additions and 18 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ downloads/
ext/
libssh-*/
msgpack-*/
releases/

View File

@ -20,7 +20,7 @@ script:
# On arch=arm64, some directories are not setup correctly, and 'ruby -S gem
# install dpl' required by the release push scripts fails.
- 'if [ "$TRAVIS_TAG" ]; then sudo chown -R $USER: /var/lib/gems /usr/local/bin; fi'
- 'if [ "$TRAVIS_TAG" ]; then ./package_release.sh $TRAVIS_TAG $PLATFORM; fi'
- 'if [ "$TRAVIS_TAG" ]; then ./build_static_release.sh $TRAVIS_TAG $PLATFORM; fi'
deploy:
provider: releases
@ -29,7 +29,7 @@ deploy:
skip_cleanup: true
overwrite: true
file_glob: true
file: /tmp/tmate-release/*.tar.*
file: releases/*.tar.*
on:
repo: tmate-io/tmate
branch: master

View File

@ -20,9 +20,10 @@ RUN set -ex; \
make -j $(nproc); \
make install
COPY . .
COPY compat ./compat
COPY *.c *.h autogen.sh Makefile.am configure.ac ./
RUN ./autogen.sh && ./configure --enable-static
RUN make -j $(nproc)
RUN strip tmate
RUN objcopy --only-keep-debug tmate tmate.symbols && strip tmate
RUN ./tmate -V

33
build_static_release.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
set -eux
# This is invoked by .travis.yml
VERSION=$1
PLATFORM=$2
SRC_VERSION=`cat configure.ac | grep AC_INIT | sed -E 's/^AC_INIT\(tmate, (.+)\)$/\1/'`
if [ $SRC_VERSION != $VERSION ]; then
echo "Version mismatch: $SRC_VERSION != $VERSION"
exit 1
fi
RELEASE_NAME=tmate-$VERSION-static-linux-$PLATFORM
echo "Building $RELEASE_NAME"
docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM
mkdir -p releases
cd releases
rm -rf $RELEASE_NAME
mkdir -p $RELEASE_NAME
docker run --rm local-$PLATFORM/tmate-build cat tmate > $RELEASE_NAME/tmate
chmod +x $RELEASE_NAME/tmate
tar -cf - $RELEASE_NAME | xz > tmate-$VERSION-static-linux-$PLATFORM.tar.xz
rm -rf $RELEASE_NAME-symbols
mkdir -p $RELEASE_NAME-symbols
docker run --rm local-$PLATFORM/tmate-build cat tmate.symbols > $RELEASE_NAME-symbols/tmate.symbols
tar -cf - $RELEASE_NAME-symbols | xz > dbg-symbols-tmate-$VERSION-static-linux-$PLATFORM.tar.xz

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -eux
VERSION=$1
PLATFORM=$2
RELEASE_NAME=tmate-$VERSION-static-linux-$PLATFORM
# This assumes the follow command has already been run:
# docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM
mkdir -p /tmp/tmate-release/$RELEASE_NAME
cd /tmp/tmate-release
docker run --rm local-$PLATFORM/tmate-build cat tmate > $RELEASE_NAME/tmate
chmod +x $RELEASE_NAME/tmate
tar -cf - $RELEASE_NAME | xz > tmate-$VERSION-static-linux-$PLATFORM.tar.xz