diff --git a/.travis.yml b/.travis.yml index 30fa8d0..4d0bbb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,37 @@ language: cpp -sudo: required dist: xenial matrix: include: - - env: ARCH=x86_64 + - name: Build x86_64 AppImage on CentOS 6 + services: + - docker + env: ARCH=x86_64 BUILD_TYPE=centos6 + script: travis/build-centos6-docker.sh + after_success: + - ls -lh + # make sure only pushes to rewrite create a new release, otherwise pretend PR and upload to transfer.sh + - if [ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ] && [ "$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*.AppImage* + + - name: Build i386 AppImage on CentOS 6 + services: + - docker + env: ARCH=i386 BUILD_TYPE=centos6 + script: travis/build-centos6-docker.sh + after_success: + - ls -lh + # make sure only pushes to rewrite create a new release, otherwise pretend PR and upload to transfer.sh + - if [ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ] && [ "$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*.AppImage* + + # TODO: build and test on i386 as well! + - name: Build and test on Ubuntu xenial (no binaries uploaded) + dist: xenial + sudo: required + env: ARCH=x86_64 BUILD_TYPE=test addons: apt: update: true @@ -25,42 +52,19 @@ matrix: - mesa-common-dev - libgl1-mesa-dev # <-- that's for xenial to provide the x86_64-linux-gnu/libGL.so symlink - # libglvnd-dev # <-- that's for bionic to provide aforementioned symlink - - env: ARCH=i386 - addons: - apt: - update: true - packages: - - libmagic-dev:i386 - - libjpeg-dev:i386 - - libpng-dev:i386 - - automake # required for patchelf - - libfuse2:i386 - - libcairo2:i386 - - gcc-multilib - - g++-multilib - -install: - - git clone https://github.com/NixOS/patchelf.git -b 0.8 - - cd patchelf - - ./bootstrap.sh - - if [ "$ARCH" == "i386" ]; then export EXTRA_CONFIGURE_ARGS=("--build=i686-pc-linux-gnu" "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"); fi - - ./configure --prefix=/usr "${EXTRA_CONFIGURE_ARGS[@]}" - - make -j$(nproc) - - sudo make install - - cd .. - - rm -rf patchelf - -script: - - bash -xe travis/build.sh - # TODO: allow for cross-compiling the test projects and install i386 packages for build dependencies, then remove $ARCH check - - if [ "$ARCH" == "x86_64" ]; then bash -xe travis/test.sh linuxdeploy-plugin-qt-"$ARCH".AppImage; fi - -after_success: - - ls -lh - # make sure only pushes to rewrite create a new release, otherwise pretend PR and upload to transfer.sh - - if [ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ] && [ "$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*.AppImage* + install: + - git clone https://github.com/NixOS/patchelf.git -b 0.8 + - cd patchelf + - ./bootstrap.sh + - if [ "$ARCH" == "i386" ]; then export EXTRA_CONFIGURE_ARGS=("--build=i686-pc-linux-gnu" "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"); fi + - ./configure --prefix=/usr "${EXTRA_CONFIGURE_ARGS[@]}" + - make -j$(nproc) + - sudo make install + - cd .. + - rm -rf patchelf + script: + - bash -xe travis/build.sh + - bash -xe travis/test.sh linuxdeploy-plugin-qt-"$ARCH".AppImage branches: except: diff --git a/travis/Dockerfile.centos6 b/travis/Dockerfile.centos6 new file mode 100644 index 0000000..ef3814b --- /dev/null +++ b/travis/Dockerfile.centos6 @@ -0,0 +1,24 @@ +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"] diff --git a/travis/Dockerfile.centos6-i386 b/travis/Dockerfile.centos6-i386 new file mode 100644 index 0000000..cc74c5c --- /dev/null +++ b/travis/Dockerfile.centos6-i386 @@ -0,0 +1,35 @@ +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"] diff --git a/travis/build-centos6-docker.sh b/travis/build-centos6-docker.sh new file mode 100755 index 0000000..691737e --- /dev/null +++ b/travis/build-centos6-docker.sh @@ -0,0 +1,18 @@ +#! /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" diff --git a/travis/build-centos6.sh b/travis/build-centos6.sh new file mode 100755 index 0000000..306aa9e --- /dev/null +++ b/travis/build-centos6.sh @@ -0,0 +1,59 @@ +#! /bin/bash + +set -e +set -x + +if [ "$ARCH" == "" ]; then + echo 'Error: $ARCH is not set' + exit 1 +fi + +# 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-plugin-qt-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 -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}" -DUSE_SYSTEM_CIMG=Off + +make -j$(nproc) + +ctest -V + +make install DESTDIR=AppDir + +strip_path=$(which strip) + +export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-qt|continuous|linuxdeploy-plugin-qt-$ARCH.AppImage" + +# we're in Docker... +export APPIMAGE_EXTRACT_AND_RUN=1 + +wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage +chmod +x linuxdeploy*.AppImage +sed -i 's|AI\x02|\x00\x00\x00|' *.AppImage +./linuxdeploy-"$ARCH".AppImage --appdir AppDir \ + -d "$REPO_ROOT"/resources/linuxdeploy-plugin-qt.desktop \ + -i "$REPO_ROOT"/resources/linuxdeploy-plugin-qt.svg \ + -e $(which patchelf) \ + -e "$strip_path" \ + --output appimage + +mv linuxdeploy-plugin-qt-"$ARCH".AppImage* "$OLD_CWD"/ diff --git a/travis/build.sh b/travis/build.sh index 7ec3565..b350852 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -70,4 +70,4 @@ chmod +x linuxdeploy*.AppImage -e "$strip_path" \ --output appimage -mv linuxdeploy-plugin-qt-"$ARCH".AppImage "$OLD_CWD"/ +mv linuxdeploy-plugin-qt-"$ARCH".AppImage* "$OLD_CWD"/ diff --git a/travis/entrypoint.sh b/travis/entrypoint.sh new file mode 100755 index 0000000..e39f2ad --- /dev/null +++ b/travis/entrypoint.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +# get a compiler that allows for using modern-ish C++ (>= 11) on a distro that doesn't normally support it +# before you ask: yes, the binaries will work on CentOS 6 even without devtoolset (they somehow partially link C++ +# things statically while using others from the system...) +# so, basically, it's magic! +source /opt/rh/devtoolset-*/enable + +exec "$@"