From cd04cc260e0ee80937f8404127a9849486d34ff8 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Fri, 27 Sep 2019 21:09:10 +0200 Subject: [PATCH] 32-bit CentOS 6 builds --- travis/Dockerfile.centos6 | 3 +++ travis/Dockerfile.centos6-i386 | 48 ++++++++++++++++++++++++++++++++++ travis/build-centos6-docker.sh | 5 ++++ travis/build-centos6.sh | 17 +++++------- travis/entrypoint.sh | 9 +++++++ 5 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 travis/Dockerfile.centos6-i386 create mode 100755 travis/entrypoint.sh diff --git a/travis/Dockerfile.centos6 b/travis/Dockerfile.centos6 index b26f4ed..2a711da 100644 --- a/travis/Dockerfile.centos6 +++ b/travis/Dockerfile.centos6 @@ -20,3 +20,6 @@ RUN yum install -y gcc-c++ && \ popd && \ rm -r patchelf/ +ENV ARCH=x86_64 +COPY entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] diff --git a/travis/Dockerfile.centos6-i386 b/travis/Dockerfile.centos6-i386 new file mode 100644 index 0000000..432836d --- /dev/null +++ b/travis/Dockerfile.centos6-i386 @@ -0,0 +1,48 @@ +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"] + +# old git doesn't support cloning tags with -b, therefore cloning remote HEAD and then manually checking out the requested tag +RUN git clone https://github.com/Kitware/CMake && \ + cd CMake && \ + git checkout v3.14.3 && \ + ./configure --prefix=/usr/local --parallel=$(nproc) && \ + make -j$(nproc) all && \ + make install && \ + cd .. && \ + rm -r CMake/ +# wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.tar.gz -O- | tar xz --strip-components=1 -C/usr/local + +#RUN wget http://springdale.math.ias.edu/data/puias/computational/6/x86_64//patchelf-0.8-2.sdl6.x86_64.rpm && \ +# echo "3d746306f5f7958b9487e6d08f53bb13 patchelf-0.8-2.sdl6.x86_64.rpm" || md5sum -c && \ +# rpm -i patchelf-0.8-2.sdl6.x86_64.rpm + +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/ + diff --git a/travis/build-centos6-docker.sh b/travis/build-centos6-docker.sh index 2bda8f9..9a3952c 100755 --- a/travis/build-centos6-docker.sh +++ b/travis/build-centos6-docker.sh @@ -8,6 +8,11 @@ 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 -i -v "$here"/..:/ws:ro -v "$old_cwd":/out -e OUTDIR_OWNER=$(id -u) "$IMAGE" /bin/bash -xe /ws/travis/build-centos6.sh diff --git a/travis/build-centos6.sh b/travis/build-centos6.sh index 6c4a5e6..b020790 100755 --- a/travis/build-centos6.sh +++ b/travis/build-centos6.sh @@ -2,12 +2,6 @@ set -xe -# 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! -. /opt/rh/devtoolset-6/enable - mkdir build cd build @@ -28,12 +22,15 @@ tar cfvz /out/appdir.tgz AppDir # cannot add appimage plugin yet, since it won't work on CentOS 6 (at least for now) # therefore we also need to use appimagetool directly to build an AppImage # but we can still prepare the AppDir -wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -chmod +x appimagetool-x86_64.AppImage +APPIMAGETOOL_ARCH="$ARCH" +if [ "$APPIMAGETOOL_ARCH" == "i386" ]; then APPIMAGETOOL_ARCH="i686"; fi + +wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$APPIMAGETOOL_ARCH".AppImage +chmod +x appimagetool-"$APPIMAGETOOL_ARCH".AppImage sed -i 's/AI\x02/\x00\x00\x00/' appimagetool*.AppImage -appimage=linuxdeploy-centos6-x86_64.AppImage -./appimagetool-x86_64.AppImage --appimage-extract +appimage=linuxdeploy-centos6-"$ARCH".AppImage +./appimagetool-"$APPIMAGETOOL_ARCH".AppImage --appimage-extract squashfs-root/AppRun AppDir "$appimage" 2>&1 chown "$OUTDIR_OWNER" "$appimage" 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 "$@"