Skip to content

Commit 313cced

Browse files
authored
Merge pull request #6 from linuxdeploy/centos6
Build on CentOS 6
2 parents 994d273 + 46ed203 commit 313cced

File tree

6 files changed

+81
-18
lines changed

6 files changed

+81
-18
lines changed

.travis.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
language: cpp
2-
sudo: required
32

4-
#plugins:
5-
# apt:
6-
# update: true
3+
services:
4+
- docker
75

86
matrix:
97
include:
108
- env: ARCH=x86_64
119
- env: ARCH=i386
12-
addons:
13-
apt:
14-
update: true
15-
packages:
16-
- gcc-multilib
17-
- g++-multilib
18-
- zlib1g:i386
19-
- libfuse2:i386
20-
- libffi-dev
21-
- libcairo2:i386
2210

2311
script:
24-
- bash -xe travis/build-appimage.sh
12+
- bash -xe travis/build-docker.sh
2513

2614
after_success:
2715
- ls -lh

travis/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM centos:6
2+
3+
SHELL ["/bin/bash", "-x", "-c"]
4+
5+
RUN yum install -y centos-release-scl-rh && \
6+
yum install -y devtoolset-7 wget curl patchelf vim-common fuse libfuse2 libtool autoconf automake zlib-devel libjpeg-devel libpng-devel nano git && \
7+
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
8+
9+
ENV ARCH=x86_64
10+
COPY entrypoint.sh /
11+
SHELL ["/entrypoint.sh", "bash", "-x", "-c"]
12+
ENTRYPOINT ["/entrypoint.sh"]

travis/Dockerfile.i386

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM i386/centos:6
2+
3+
SHELL ["/bin/bash", "-x", "-c"]
4+
5+
# 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
6+
# this little command fixes this
7+
RUN sed -i 's/$basearch/i386/g' /etc/yum.repos.d/CentOS-Base.repo
8+
9+
# thanks CloudLinux, you're really helping us poor AppImage creators seeking for maximum compatibility by providing devtoolset i386 builds
10+
RUN yum install -y yum-utils && \
11+
rpm --import https://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux && \
12+
yum-config-manager --add-repo https://www.repo.cloudlinux.com/cloudlinux/6/sclo/devtoolset-7/i386/ && \
13+
yum install -y devtoolset-7 wget curl patchelf vim-common fuse libfuse2 libtool autoconf automake zlib-devel libjpeg-devel libpng-devel nano git
14+
15+
# the shell wrapper takes care of enabling devtoolset and running a shell properly
16+
# unfortunately this is the easiest and most solid workaround to the limitations of the scl command
17+
COPY entrypoint.sh /
18+
ENV ARCH=i386
19+
ENTRYPOINT ["/entrypoint.sh"]
20+
SHELL ["/entrypoint.sh", "bash", "-x", "-c"]
21+
22+
# old git doesn't support cloning tags with -b, therefore cloning remote HEAD and then manually checking out the requested tag
23+
RUN git clone https://github.com/Kitware/CMake && \
24+
cd CMake && \
25+
git checkout v3.14.3 && \
26+
./configure --prefix=/usr/local --parallel=$(nproc) && \
27+
make -j$(nproc) all && \
28+
make install && \
29+
cd .. && \
30+
rm -r CMake/

travis/build-appimage.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,26 @@ make install DESTDIR=AppDir
4444
AIK_ARCH="$ARCH"
4545
[ "$ARCH" == "i386" ] && AIK_ARCH="i686"
4646

47-
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage
48-
chmod +x linuxdeploy-"$ARCH".AppImage
47+
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-centos6-"$ARCH".AppImage
48+
chmod +x linuxdeploy-centos6-"$ARCH".AppImage
4949

5050
# bundle appimagetool
5151
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$AIK_ARCH".AppImage
52+
5253
chmod +x appimagetool-"$AIK_ARCH".AppImage
54+
55+
sed -i 's/AI\x02/\x00\x00\x00/' {appimagetool,linuxdeploy}*.AppImage
56+
5357
./appimagetool-"$AIK_ARCH".AppImage --appimage-extract
5458
mv squashfs-root/ AppDir/appimagetool-prefix/
5559
ln -s ../../appimagetool-prefix/AppRun AppDir/usr/bin/appimagetool
5660

5761
export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-appimage|continuous|linuxdeploy-plugin-appimage-$ARCH.AppImage"
5862

5963
# deploy linuxdeploy-plugin-appimage
60-
./linuxdeploy-"$ARCH".AppImage --appdir AppDir -d "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.desktop \
64+
sed -i 's|AI\x02|\x00\x00\x00|' linuxdeploy-centos6-"$ARCH".AppImage
65+
./linuxdeploy-centos6-"$ARCH".AppImage --appimage-extract-and-run \
66+
--appdir AppDir -d "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.desktop \
6167
-i "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.svg
6268

6369
AppDir/AppRun --appdir AppDir

travis/build-docker.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
3+
set -xe
4+
5+
old_cwd=$(readlink -f .)
6+
here=$(readlink -f $(dirname "$0"))
7+
8+
DOCKERFILE="$here"/Dockerfile
9+
IMAGE=linuxdeploy-plugin-appimage-build
10+
11+
if [ "$ARCH" == "i386" ]; then
12+
DOCKERFILE="$DOCKERFILE".i386
13+
IMAGE="$IMAGE".i386
14+
fi
15+
16+
(cd "$here" && docker build -f "$DOCKERFILE" -t "$IMAGE" .)
17+
18+
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-appimage.sh"

travis/entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/bash
2+
3+
# get a compiler that allows for using modern-ish C++ (>= 11) on a distro that doesn't normally support it
4+
# before you ask: yes, the binaries will work on CentOS 6 even without devtoolset (they somehow partially link C++
5+
# things statically while using others from the system...)
6+
# so, basically, it's magic!
7+
source /opt/rh/devtoolset-*/enable
8+
9+
exec "$@"

0 commit comments

Comments
 (0)