mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-05-04 07:13:31 -05:00
Build static binaries for releases on Travis
This commit is contained in:
40
.travis.yml
40
.travis.yml
@@ -1,25 +1,39 @@
|
||||
language: cpp
|
||||
sudo: required
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: CentOS 6 x86_64 build
|
||||
env: ARCH=x86_64 BUILD_TYPE=centos6
|
||||
install: true
|
||||
services:
|
||||
- docker
|
||||
script: travis/build-centos6-docker.sh
|
||||
- name: Ubuntu bionic x86_64 release build
|
||||
env: ARCH=x86_64
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- libmagic-dev
|
||||
- libjpeg-dev
|
||||
- libpng-dev
|
||||
- cimg-dev
|
||||
script: travis/build.sh
|
||||
after_success:
|
||||
- if [ "$TRAVIS_BRANCH" != "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" != "master" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi
|
||||
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
|
||||
- bash upload.sh linuxdeploy-"$ARCH".AppImage*
|
||||
|
||||
- name: CentOS 6 i386 build
|
||||
env: ARCH=i386 BUILD_TYPE=centos6
|
||||
install: true
|
||||
services:
|
||||
- docker
|
||||
script: travis/build-centos6-docker.sh
|
||||
- name: Ubuntu bionic i386 build
|
||||
env: ARCH=i386
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- libmagic-dev:i386
|
||||
- libjpeg-dev:i386
|
||||
- libpng-dev:i386
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
- libfuse2:i386
|
||||
- libcairo2:i386
|
||||
script: travis/build.sh
|
||||
after_success:
|
||||
- if [ "$TRAVIS_BRANCH" != "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" != "master" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi
|
||||
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
|
||||
|
||||
@@ -8,12 +8,16 @@ pkg_check_modules(libpng REQUIRED IMPORTED_TARGET libpng)
|
||||
if(STATIC_BUILD)
|
||||
include(ExternalProject)
|
||||
|
||||
if($ENV{ARCH} STREQUAL i386 OR $ENV{ARCH} STREQUAL i586 OR $ENV{ARCH} STREQUAL i686)
|
||||
set(configure_command_prefix env CFLAGS=-m32 CXXFLAGS=-m32)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(libjpeg_static_extproj
|
||||
URL https://www.ijg.org/files/jpegsrc.v9d.tar.gz
|
||||
URL_HASH SHA256=99cb50e48a4556bc571dadd27931955ff458aae32f68c4d9c39d624693f69c32
|
||||
BUILD_IN_SOURCE ON
|
||||
EXCLUDE_FROM_ALL ON
|
||||
CONFIGURE_COMMAND ./configure --prefix=/usr
|
||||
CONFIGURE_COMMAND ${configure_command_prefix} ./configure --prefix=/usr
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
FROM centos:6
|
||||
|
||||
RUN yum install -y centos-release-scl-rh && \
|
||||
yum install -y devtoolset-7 wget curl patchelf vim-common fuse libfuse2 libtool autoconf automake zlib-devel libjpeg-devel libpng-devel nano git && \
|
||||
wget https://artifacts.assassinate-you.net/artifactory/cmake-centos6/cmake-v3.15.3-x86_64.tar.gz -O- | tar xz --strip-components=1 -C/usr/local
|
||||
|
||||
ENV ARCH=x86_64
|
||||
COPY entrypoint.sh /
|
||||
SHELL ["/entrypoint.sh", "bash", "-x", "-c"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
RUN yum install -y gcc-c++ && \
|
||||
git clone https://github.com/NixOS/patchelf.git && \
|
||||
pushd patchelf && \
|
||||
# cannot use -b since it's not supported in really old versions of git
|
||||
git checkout 0.8 && \
|
||||
./bootstrap.sh && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j $(nproc) && \
|
||||
make install && \
|
||||
popd && \
|
||||
rm -r patchelf/
|
||||
|
||||
CMD ["bash"]
|
||||
@@ -1,35 +0,0 @@
|
||||
FROM i386/centos:6
|
||||
|
||||
SHELL ["/bin/bash", "-x", "-c"]
|
||||
|
||||
# during Docker build, yum doesn't detect it's an i386 environment on x86_64 machines, and tries to install x86_64 packages, which can't work
|
||||
# this little command fixes this
|
||||
RUN sed -i 's/$basearch/i386/g' /etc/yum.repos.d/CentOS-Base.repo
|
||||
|
||||
# thanks CloudLinux, you're really helping us poor AppImage creators seeking for maximum compatibility by providing devtoolset i386 builds
|
||||
RUN yum install -y yum-utils && \
|
||||
rpm --import https://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux && \
|
||||
yum-config-manager --add-repo https://www.repo.cloudlinux.com/cloudlinux/6/sclo/devtoolset-7/i386/ && \
|
||||
yum install -y devtoolset-7 wget curl patchelf vim-common fuse libfuse2 libtool autoconf automake zlib-devel libjpeg-devel libpng-devel nano git
|
||||
|
||||
# the shell wrapper takes care of enabling devtoolset and running a shell properly
|
||||
# unfortunately this is the easiest and most solid workaround to the limitations of the scl command
|
||||
COPY entrypoint.sh /
|
||||
ENV ARCH=i386
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
SHELL ["/entrypoint.sh", "bash", "-x", "-c"]
|
||||
|
||||
RUN wget https://artifacts.assassinate-you.net/artifactory/cmake-centos6/cmake-v3.15.3-i386.tar.gz -O- | tar xz --strip-components=1 -C/usr/local
|
||||
|
||||
RUN git clone https://github.com/NixOS/patchelf.git && \
|
||||
pushd patchelf && \
|
||||
# cannot use -b since it's not supported in really old versions of git
|
||||
git checkout 0.8 && \
|
||||
./bootstrap.sh && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j $(nproc) && \
|
||||
make install && \
|
||||
popd && \
|
||||
rm -r patchelf/
|
||||
|
||||
CMD ["bash"]
|
||||
@@ -1,18 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
old_cwd=$(readlink -f .)
|
||||
here=$(readlink -f $(dirname "$0"))
|
||||
|
||||
DOCKERFILE="$here"/Dockerfile.centos6
|
||||
IMAGE=linuxdeploy-build-centos6
|
||||
|
||||
if [ "$ARCH" == "i386" ]; then
|
||||
DOCKERFILE="$DOCKERFILE"-i386
|
||||
IMAGE="$IMAGE"-i386
|
||||
fi
|
||||
|
||||
(cd "$here" && docker build -f "$DOCKERFILE" -t "$IMAGE" .)
|
||||
|
||||
docker run --rm -it -v "$here"/..:/ws:ro -v "$old_cwd":/out -e CI=1 -e OUTDIR_OWNER=$(id -u) "$IMAGE" /bin/bash -xe -c "cd /out && /ws/travis/build-centos6.sh"
|
||||
@@ -1,72 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# use RAM disk if possible
|
||||
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
|
||||
TEMP_BASE=/dev/shm
|
||||
else
|
||||
TEMP_BASE=/tmp
|
||||
fi
|
||||
|
||||
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" linuxdeploy-build-XXXXXX)
|
||||
|
||||
cleanup () {
|
||||
if [ -d "$BUILD_DIR" ]; then
|
||||
rm -rf "$BUILD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# store repo root as variable
|
||||
REPO_ROOT=$(readlink -f $(dirname $(dirname "$0")))
|
||||
OLD_CWD=$(readlink -f .)
|
||||
|
||||
pushd "$BUILD_DIR"
|
||||
|
||||
cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_SYSTEM_CIMG=Off -DUSE_CCACHE=Off
|
||||
|
||||
make -j$(nproc)
|
||||
|
||||
ctest -V
|
||||
|
||||
# args are used more than once
|
||||
LINUXDEPLOY_ARGS=("--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "/ws/resources/linuxdeploy.png" "-d" "/ws/resources/linuxdeploy.desktop" "-e" "$(which patchelf)" "-e" "$(which strip)")
|
||||
|
||||
# deploy patchelf which is a dependency of linuxdeploy
|
||||
bin/linuxdeploy "${LINUXDEPLOY_ARGS[@]}"
|
||||
|
||||
# bundle AppImage plugin
|
||||
mkdir -p AppDir/plugins
|
||||
|
||||
wget https://github.com/TheAssassin/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-"$ARCH".AppImage
|
||||
chmod +x linuxdeploy-plugin-appimage-"$ARCH".AppImage
|
||||
sed -i 's|AI\x02|\x00\x00\x00|' linuxdeploy*.AppImage
|
||||
./linuxdeploy-plugin-appimage-"$ARCH".AppImage --appimage-extract
|
||||
mv squashfs-root/ AppDir/plugins/linuxdeploy-plugin-appimage
|
||||
|
||||
ln -s ../../plugins/linuxdeploy-plugin-appimage/AppRun AppDir/usr/bin/linuxdeploy-plugin-appimage
|
||||
|
||||
export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy|continuous|linuxdeploy-$ARCH.AppImage.zsync"
|
||||
export OUTPUT=linuxdeploy-"$ARCH".AppImage
|
||||
|
||||
# build AppImage using plugin
|
||||
AppDir/usr/bin/linuxdeploy-plugin-appimage --appdir AppDir/
|
||||
|
||||
# rename AppImage to avoid "Text file busy" issues when using it to create another one
|
||||
mv "$OUTPUT" test.AppImage
|
||||
# also have to patch our test AppImage, but we can leave the newly produced one untouched
|
||||
sed -i 's|AI\x02|\x00\x00\x00|' test.AppImage
|
||||
|
||||
# verify that the resulting AppImage works
|
||||
./test.AppImage --appimage-extract-and-run "${LINUXDEPLOY_ARGS[@]}"
|
||||
|
||||
# check whether AppImage plugin is found and works
|
||||
./test.AppImage --appimage-extract-and-run "${LINUXDEPLOY_ARGS[@]}" --output appimage
|
||||
|
||||
chown "$OUTDIR_OWNER" "$OUTPUT"
|
||||
|
||||
mv "$OUTPUT"* "$OLD_CWD"/
|
||||
|
||||
62
travis/build-static-patchelf.sh
Executable file
62
travis/build-static-patchelf.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
INSTALL_DESTDIR="$1"
|
||||
|
||||
if [[ "$INSTALL_DESTDIR" == "" ]]; then
|
||||
echo "Error: build dir $BUILD_DIR does not exist" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# support cross-compilation for 32-bit ISAs
|
||||
case "$ARCH" in
|
||||
"x86_64"|"amd64")
|
||||
;;
|
||||
"i386"|"i586"|"i686")
|
||||
export CFLAGS="-m32"
|
||||
export CXXFLAGS="-m32"
|
||||
;;
|
||||
*)
|
||||
echo "Error: unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# use RAM disk if possible
|
||||
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
|
||||
TEMP_BASE=/dev/shm
|
||||
else
|
||||
TEMP_BASE=/tmp
|
||||
fi
|
||||
|
||||
cleanup () {
|
||||
if [ -d "$BUILD_DIR" ]; then
|
||||
rm -rf "$BUILD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" linuxdeploy-build-XXXXXX)
|
||||
|
||||
pushd "$BUILD_DIR"
|
||||
|
||||
# fetch source code
|
||||
git clone https://github.com/NixOS/patchelf.git .
|
||||
|
||||
# cannot use -b since it's not supported in really old versions of git
|
||||
git checkout 0.8
|
||||
|
||||
# prepare configure script
|
||||
./bootstrap.sh
|
||||
|
||||
# configure static build
|
||||
env LDFLAGS="-static -static-libgcc -static-libstdc++" ./configure --prefix=/usr
|
||||
|
||||
# build binary
|
||||
make -j "$(nproc)"
|
||||
|
||||
# install into user-specified destdir
|
||||
make install DESTDIR="$INSTALL_DESTDIR"
|
||||
@@ -35,7 +35,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}"
|
||||
cmake "$REPO_ROOT" -DSTATIC_BUILD=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}"
|
||||
|
||||
make -j$(nproc)
|
||||
|
||||
@@ -58,8 +58,13 @@ if [ "$ARCH" == "i386" ]; then
|
||||
export LD_LIBRARY_PATH=$(readlink -f out/usr/lib)
|
||||
fi
|
||||
|
||||
# build patchelf
|
||||
"$REPO_ROOT"/travis/build-static-patchelf.sh "$(readlink -f out/)"
|
||||
patchelf_path="$(readlink -f out/usr/bin/patchelf)"
|
||||
export PATH="$(readlink -f out/usr/bin):$PATH"
|
||||
|
||||
# args are used more than once
|
||||
LINUXDEPLOY_ARGS=("--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "$REPO_ROOT/resources/linuxdeploy.png" "-d" "$REPO_ROOT/resources/linuxdeploy.desktop" "-e" "/usr/bin/patchelf" "-e" "$strip_path")
|
||||
LINUXDEPLOY_ARGS=("--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "$REPO_ROOT/resources/linuxdeploy.png" "-d" "$REPO_ROOT/resources/linuxdeploy.desktop" "-e" "$patchelf_path" "-e" "$strip_path")
|
||||
|
||||
# deploy patchelf which is a dependency of linuxdeploy
|
||||
bin/linuxdeploy "${LINUXDEPLOY_ARGS[@]}"
|
||||
@@ -75,7 +80,7 @@ mv squashfs-root/ AppDir/plugins/linuxdeploy-plugin-appimage
|
||||
ln -s ../../plugins/linuxdeploy-plugin-appimage/AppRun AppDir/usr/bin/linuxdeploy-plugin-appimage
|
||||
|
||||
export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy|continuous|linuxdeploy-$ARCH.AppImage.zsync"
|
||||
export OUTPUT="linuxdeploy-devbuild-$ARCH.AppImage"
|
||||
export OUTPUT="linuxdeploy-$ARCH.AppImage"
|
||||
|
||||
# build AppImage using plugin
|
||||
AppDir/usr/bin/linuxdeploy-plugin-appimage --appdir AppDir/
|
||||
|
||||
Reference in New Issue
Block a user