From dd8d8b9007c9f083c384afebf3198b4e46d5ed46 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 1 May 2018 22:59:49 +0200 Subject: [PATCH] Add Dockerfile for building AppImage --- linux/appimage/Dockerfile | 44 ++++++++++++++ linux/{ => appimage}/build-appimage.sh | 11 ++++ linux/appimage/build.sh | 26 +++++++++ linux/appimage/qt-installer-noninteractive.qs | 57 +++++++++++++++++++ linux/appimage/setup.sh | 37 ++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 linux/appimage/Dockerfile rename linux/{ => appimage}/build-appimage.sh (97%) mode change 100644 => 100755 create mode 100755 linux/appimage/build.sh create mode 100644 linux/appimage/qt-installer-noninteractive.qs create mode 100755 linux/appimage/setup.sh diff --git a/linux/appimage/Dockerfile b/linux/appimage/Dockerfile new file mode 100644 index 000000000..5457753e2 --- /dev/null +++ b/linux/appimage/Dockerfile @@ -0,0 +1,44 @@ +# Build: +# docker build -t falkon-appimage-build . +# Run: +# docker run -v $OUT_DIRECTORY:/out -it falkon-appimage-build $FALKON_TARBALL_URL + +FROM centos:7 + +RUN yum -y install \ + wget \ + fontconfig \ + xz \ + openssl-devel \ + libX11-devel \ + xcb-util-devel \ + centos-release-scl \ + make \ + gettext \ + squashfs-tools \ + chrpath \ + which \ + mesa-libGL-devel \ + mesa-libEGL-devel \ + libXcomposite-devel \ + libXcursor-devel \ + alsa-lib-devel \ + libXi-devel \ + libXtst-devel \ + libXrandr-devel + +RUN yum -y install devtoolset-4-gcc-c++ + +RUN wget -O cmake-install https://cmake.org/files/v3.11/cmake-3.11.1-Linux-x86_64.sh && \ + chmod +x cmake-install && \ + ./cmake-install --skip-license --prefix=/usr && \ + rm cmake-install + +COPY setup.sh /root/setup.sh +COPY qt-installer-noninteractive.qs /root/qt-installer-noninteractive.qs +RUN scl enable devtoolset-4 /root/setup.sh + +COPY build.sh /root/build.sh +COPY build-appimage.sh /root/build-appimage.sh + +ENTRYPOINT ["/root/build.sh"] diff --git a/linux/build-appimage.sh b/linux/appimage/build-appimage.sh old mode 100644 new mode 100755 similarity index 97% rename from linux/build-appimage.sh rename to linux/appimage/build-appimage.sh index e15176aa6..cafac55c9 --- a/linux/build-appimage.sh +++ b/linux/appimage/build-appimage.sh @@ -43,6 +43,7 @@ LDFLAGS="${LDFLAGS:--Wl,-z,relro }"; export LDFLAGS ; optPrint(){ printf "\n\t\t${ITL1}VALID OPTIONS ARE${ITL0}:\n --sourcedir=[path] + --outdir=[path] --qmake=[path to executable] --disable-debug | -D --runtime=[path] @@ -77,6 +78,9 @@ ${BLD1}--sourcedir=${BLD0} ${UDR1}example:--sourcedir="/home/build/falkon"${UDR0} +${BLD1}--outdir=${BLD0} + + Where to copy final AppImage. ${BLD1}--runtime=[path]${BLD0} @@ -127,6 +131,10 @@ while [ $# != 0 ] ;do SOURCE_DIR=$(getVal "${CFG_OPT}") export SOURCE_DIR ;; + --outdir=*) + OUT_DIR=$(getVal "${CFG_OPT}") + export OUT_DIR + ;; --disable-debug|-D) unset DEBUG_BUILD ;; @@ -357,6 +365,9 @@ nowBldImg if [[ $? == 0 ]] && [[ -x bin/Falkon.AppImage ]]; then printf "\\033c" printf "Done!\nThe compiled files are in "${PWD}"/bin\n" + if [ ! -z "$OUT_DIR" ]; then + cp bin/Falkon.AppImage "$OUT_DIR" + fi fi exit 0 diff --git a/linux/appimage/build.sh b/linux/appimage/build.sh new file mode 100755 index 000000000..628080bc5 --- /dev/null +++ b/linux/appimage/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +FALKON_URL=$1 +RUNTIME_URL="https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64" + +if [ -z "$FALKON_URL" ]; then + echo "No url specified!" + exit 1 +fi + +source /root/env.sh +source /opt/rh/devtoolset-4/enable + +cd /root + +wget $RUNTIME_URL -O runtime + +wget $FALKON_URL -O falkon.tar.xz +tar xf falkon.tar.xz +cd falkon-* + +/root/build-appimage.sh \ + --sourcedir=`pwd` \ + --outdir=/out \ + --runtime=/root/runtime \ + --qmake=$QTDIR/bin/qmake diff --git a/linux/appimage/qt-installer-noninteractive.qs b/linux/appimage/qt-installer-noninteractive.qs new file mode 100644 index 000000000..fcd571fbb --- /dev/null +++ b/linux/appimage/qt-installer-noninteractive.qs @@ -0,0 +1,57 @@ +function Controller() { + installer.autoRejectMessageBoxes(); + installer.installationFinished.connect(function() { + gui.clickButton(buttons.NextButton); + }) +} + +Controller.prototype.WelcomePageCallback = function() { + gui.clickButton(buttons.NextButton, 2000); +} + +Controller.prototype.CredentialsPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.IntroductionPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.TargetDirectoryPageCallback = function() +{ + gui.currentPageWidget().TargetDirectoryLineEdit.setText("/root/Qt"); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ComponentSelectionPageCallback = function() { + var widget = gui.currentPageWidget(); + + widget.deselectAll(); + widget.selectComponent("qt.qt5.5101.gcc_64"); + widget.selectComponent("qt.qt5.5101.qtscript"); + widget.selectComponent("qt.qt5.5101.qtwebengine"); + + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.LicenseAgreementPageCallback = function() { + gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.StartMenuDirectoryPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ReadyForInstallationPageCallback = function() +{ + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.FinishedPageCallback = function() { +var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm +if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) { + checkBoxForm.launchQtCreatorCheckBox.checked = false; +} + gui.clickButton(buttons.FinishButton); +} diff --git a/linux/appimage/setup.sh b/linux/appimage/setup.sh new file mode 100755 index 000000000..88d108a4c --- /dev/null +++ b/linux/appimage/setup.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +QT_INSTALL_URL="https://download.qt.io/official_releases/qt/5.10/5.10.1/qt-opensource-linux-x64-5.10.1.run" +EXTRA_CMAKE_MODULES_URL="https://download.kde.org/stable/frameworks/5.45/extra-cmake-modules-5.45.0.tar.xz" +KI18N_URL="https://download.kde.org/stable/frameworks/5.45/ki18n-5.45.0.tar.xz" + +QTDIR="/root/Qt/5.10.1/gcc_64" + +# Install Qt +cd /root +wget $QT_INSTALL_URL -O qt-installer +chmod u+x qt-installer +./qt-installer --script qt-installer-noninteractive.qs --platform minimal -v + +echo "export QTDIR=$QTDIR" > /root/env.sh + +# Install ECM +cd /root +wget $EXTRA_CMAKE_MODULES_URL -O extra-cmake-modules.tar.xz +tar xf extra-cmake-modules.tar.xz +cd extra-cmake-modules-* +mkdir build && cd build +cmake -DBUILD_TESTING=OFF -DBUILD_QCH=OFF -DCMAKE_PREFIX_PATH=$QTDIR/lib/cmake -DCMAKE_INSTALL_PREFIX=$QTDIR -DCMAKE_INSTALL_LIBDIR=lib .. +make && make install + +# Install KI18n +cd /root +wget $KI18N_URL -O ki18n.tar.xz +tar xf ki18n.tar.xz +cd ki18n-* +mkdir build && cd build +cmake -DBUILD_TESTING=OFF -DBUILD_QCH=OFF -DCMAKE_PREFIX_PATH=$QTDIR/lib/cmake -DCMAKE_INSTALL_PREFIX=$QTDIR -DCMAKE_INSTALL_LIBDIR=lib .. +make && make install + +# Cleanup +cd /root +rm -r qt-installer* extra-cmake-modules* ki18n* setup.sh