diff --git a/linux/appimage/Dockerfile b/linux/appimage/Dockerfile new file mode 100644 index 00000000..5457753e --- /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 e15176aa..cafac55c --- a/linux/build-appimage.sh +++ b/linux/appimage/build-appimage.sh @@ -1,362 +1,373 @@ #!/bin/sh ############################################################################### # Compile Falkon source and pack it as Appimage. ############################################################################### set -e SCRIPT_PATH="$(dirname "$(readlink -f "$0")")" NCPUS=$(getconf _NPROCESSORS_ONLN) || : which mksquashfs >/dev/null 2>&1 || TEST=no which chrpath >/dev/null 2>&1 || TEST=no TEST=${TEST:-yes} if [ $(which qmake 2>/dev/null) ]; then SYSTEM_QMAKE=$(which qmake) elif [ $(which qmake-qt5 2>/dev/null) ]; then SYSTEM_QMAKE=$(which qmake-qt5) fi BLD1="\033[1m" BLD0="\033[21m" ITL1="\033[3m" ITL0="\033[23m" UDR1="\033[4m" UDR0="\033[24m" CRS1="\033[9m" CRS0="\033[29m" RDFG="\033[31m" RDBG="\033[41m" DFFG="\033[39m" DFBG="\033[49m" ALL0="\033[00m" LIBDIRPATH=lib ; export LIBDIRPATH SOURCE_DIR=${SOURCE_DIR:-${SCRIPT_PATH}/..} ; export SOURCE_DIR QMAKE=${QMAKE:-$SYSTEM_QMAKE} ; export QMAKE DEBUG_BUILD="-DCMAKE_BUILD_TYPE=Debug" ; export DEBUG_BUILD CFLAGS="${CFLAGS:--O2 -g -pipe -Wall }" ; export CFLAGS ; CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall }" ; export CXXFLAGS ; 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] --disable-x11 --disable-dbus --update-source | -U --help | -h | help |-H\n\n" } helpPrint(){ printf "\n\t\t\t${ITL1}PARAMETERS${ITL0}: ${BLD1}--disable-x11${BLD0} Disable all X11 calls. Enable this when building for Wayland-only. All X11 calls are guarded by runtime X11 platform check even without this option. ${BLD1}--disable-dbus${BLD0} Build without QtDBus module. Native desktop notifications will be disabled. ${BLD1}--sourcedir=${BLD0} Assuming this script is located in ${ITL1}falkon/linux${ITL0}, otherwise you must specify the path to Falkon source directory. ${UDR1}example:--sourcedir="/home/build/falkon"${UDR0} +${BLD1}--outdir=${BLD0} + + Where to copy final AppImage. ${BLD1}--runtime=[path]${BLD0} Path to precompiled „${BLD1}runtime.c${BLD0}“ ${ITL1}(part of AppImageKit)${ITL0}. More info at: ${UDR1}https://github.com/probonopd/AppImageKit${UDR0} ${BLD1}Mandatory option${BLD0} ${BLD1}--disable-debug | -D${BLD0} You may want to disable debug build. (enabled by default) ${BLD1}--update-source | -U${BLD0} Fetches the information from Falkon online git repository and merges it with your local copy ${BLD1}--qmake=${BLD0} Full path to qmake executable. This option is mandatory in case you want to create an AppImage. \n" } printConf(){ printf "\n\tBuild configuration:\n Library path=${LIBDIRPATH} Source dir=${SOURCE_DIR} Debug build=${DEBUG_BUILD} Disable X11=${YNOX11} Disable DBUS=${DISABLE_DBUS} Runtime binary=${RUNTIME_BINARY} Qmake=${QMAKE}\n" | sed -r 's/=$/ » Not set/g' } getVal(){ echo $* | sed -r 's/([[:graph:]]*=)//' } varAssign(){ while [ $# != 0 ] ;do CFG_OPT="$1" case "${CFG_OPT}" in --sourcedir=*) SOURCE_DIR=$(getVal "${CFG_OPT}") export SOURCE_DIR ;; + --outdir=*) + OUT_DIR=$(getVal "${CFG_OPT}") + export OUT_DIR + ;; --disable-debug|-D) unset DEBUG_BUILD ;; --runtime=*) RUNTIME_BINARY=$(getVal "${CFG_OPT}") export RUNTIME_BINARY ;; --disable-x11) YNOX11="-DNO_X11:BOOL=TRUE" export YNOX11 ;; --disable-bus) DISABLE_DBUS="-DDISABLE_DBUS:BOOL=TRUE" export DISABLE_DBUS ;; --qmake=*) QMAKE=$(getVal "${CFG_OPT}") export QMAKE ;; --update-source|-U) UPDATE_SOURCE="true" export UPDATE_SOURCE ;; --help|help|-h|-H) helpPrint exit 1 ;; *) printf "\n${RDBG}unknown parameter: ${CFG_OPT}${DFBG}\n" optPrint exit 1 ;; esac shift done } nowBldImg(){ cd "${SOURCE_DIR}" if [[ "${UPDATE_SOURCE}" == "true" ]]; then git pull || : fi rm -fr build || : mkdir build && cd build QTFILESARETHERE=$(${QMAKE} -query | grep INSTALL_PREFIX | sed 's/QT_INSTALL_PREFIX://') LIBSARETHERE=$(${QMAKE} -query | grep INSTALL_LIBS | sed 's/QT_INSTALL_LIBS://') PLUGINSARETHERE=$(${QMAKE} -query | grep INSTALL_PLUGINS | sed 's/QT_INSTALL_PLUGINS://') QMLSARETHERE=$(${QMAKE} -query | grep INSTALL_QML | sed 's/QT_INSTALL_QML://') TRANSLATIONSARETHERE=$(${QMAKE} -query | grep INSTALL_TRANSLATIONS | sed 's/QT_INSTALL_TRANSLATIONS://') LIBEXECSARETHERE=$(${QMAKE} -query | grep INSTALL_LIBEXECS | sed 's/QT_INSTALL_LIBEXECS://') NODEFOPT="${DEBUG_BUILD} ${YNOX11} ${DISABLE_DBUS}" cmake ${NODEFOPT} \ -DBUILD_SHARED_LIBS:BOOL=TRUE \ -DCMAKE_SKIP_RPATH:BOOL=OFF \ -DCMAKE_SKIP_INSTALL_RPATH:BOOL=NO \ -DQMAKE_EXECUTABLE:FILEPATH=${QMAKE} \ -DCMAKE_PREFIX_PATH=${QTFILESARETHERE} \ -DFALKON_PLUGIN_PATH="" \ -DKDE_INSTALL_LIBDIR:PATH="${LIBDIRPATH}" .. printf "Compiling Falkon with the following settings:\n" printConf make -j$NCPUS if [[ $? == 0 ]] ; then make DESTDIR="${PWD}" install fi mv usr/local bundle_build_dir pushd bundle_build_dir/lib/plugins/falkon chrpath --replace '$ORIGIN/../..' *.so popd NEEDEDLIBSLIST="libicudata.so.56 libicui18n.so.56 libicuuc.so.56 libQt5Core.so.5 libQt5DBus.so.5 libQt5Gui.so.5 libQt5Multimedia.so.5 libQt5MultimediaWidgets.so.5 libQt5Network.so.5 libQt5OpenGL.so.5 libQt5Positioning.so.5 libQt5PrintSupport.so.5 libQt5Qml.so.5 libQt5Quick.so.5 libQt5QuickWidgets.so.5 libQt5Sql.so.5 libQt5Svg.so.5 libQt5WebChannel.so.5 libQt5WebEngineCore.so.5 libQt5WebEngine.so.5 libQt5WebEngineWidgets.so.5 libQt5Widgets.so.5 libQt5X11Extras.so.5 libQt5XcbQpa.so.5" NEEDEDPLUGINSLIST="bearer generic iconengines imageformats platforminputcontexts platformthemes printsupport xcbglintegrations" mkdir -p bundle_build_dir/plugins/{platforms,sqldrivers} \ bundle_build_dir/qtwebengine_dictionaries \ bundle_build_dir/qml \ bundle_build_dir/translations || : for L in ${NEEDEDLIBSLIST} ; do cp -d ${LIBSARETHERE}/${L}* bundle_build_dir/lib ; done for P in ${NEEDEDPLUGINSLIST} ; do cp -r ${PLUGINSARETHERE}/${P} bundle_build_dir/plugins ; done install ${PLUGINSARETHERE}/platforms/libqxcb.so bundle_build_dir/plugins/platforms install ${PLUGINSARETHERE}/sqldrivers/libqsqlite.so bundle_build_dir/plugins/sqldrivers cp -r ${QMLSARETHERE}/{QtQuick.2,QtWebEngine} bundle_build_dir/qml cp -r ${QTFILESARETHERE}/resources bundle_build_dir cp -r ${TRANSLATIONSARETHERE}/qtwebengine_locales bundle_build_dir/translations cp ${LIBEXECSARETHERE}/QtWebEngineProcess bundle_build_dir CRYPTONEEDED="$(ldd 'bin/falkon'| grep libcrypto | sed 's/.*=>//;s/(.*//')" LIBSSLNEEDED="$(echo "${CRYPTONEEDED}" | sed 's/crypto/ssl/')" install ${CRYPTONEEDED} ${LIBSSLNEEDED} bundle_build_dir/lib CRYPTOLINKED="$(basename "${CRYPTONEEDED}")" LIBSSLLINKED="$(basename "${LIBSSLNEEDED}")" #Try to include all ssl v1.0 variants. for LINK in {libcrypto.so,libcrypto.so.10,libcrypto.so.1.0.0} ; do if [[ ! -e bundle_build_dir/lib/${LINK} ]] ; then ln -s ${CRYPTOLINKED} bundle_build_dir/lib/${LINK} fi done for LNKS in {libssl.so,libssl.so.10,libssl.so.1.0.0} ; do if [[ ! -e bundle_build_dir/lib/${LNKS} ]] ; then ln -s ${CRYPTOLINKED} bundle_build_dir/lib/${LNKS} fi done cp ../linux/applications/org.kde.falkon.desktop bundle_build_dir cp ../linux/pixmaps/falkon.png bundle_build_dir ln -s falkon.png bundle_build_dir/.DirIcon pushd bundle_build_dir mv bin/falkon ./ && rm -fr bin chrpath --replace '$ORIGIN' lib/libFalkonPrivate.so.3.* chrpath --replace '$ORIGIN/lib' falkon chrpath --replace '$ORIGIN/lib' QtWebEngineProcess cat <qt.conf [Paths] Plugins=plugins Imports=qml Qml2Imports=qml LibraryExecutables=. EOQTCFG cat <AppRun #!/bin/sh set -e FALKON_DIR="\$(dirname "\$(readlink -f "\$0")")" XDG_DATA_DIRS="\${FALKON_DIR}/share:\${XDG_DATA_DIRS}" FALKON_PLUGIN_PATH="\${FALKON_DIR}/lib/plugins/falkon" export XDG_DATA_DIRS FALKON_PLUGIN_PATH cd "\${FALKON_DIR}/" exec ./falkon "\$@" EOF chmod +x AppRun popd printf "Generating app image\n" mksquashfs bundle_build_dir falkon.squashfs -root-owned -noappend cat "${RUNTIME_BINARY}" >bin/Falkon.AppImage cat falkon.squashfs >>bin/Falkon.AppImage chmod a+x bin/Falkon.AppImage } varAssign $* if [[ ! -x ${QMAKE} ]] ;then printf "${RDFG}ERROR${DFFG}: ${BLD1}qmake${BLD0} was not found! Please use ${BLD1}--qmake=${BLD0} option to specify the path where it is located!\n" exit 1 fi if [[ ! -d "${SOURCE_DIR}/src" ]]; then printf "Please install ${UDR1}$0${UDR0} in „${BLD1}scripts${BLD0}“ ${ITL1}(a sub folder in Falkon source directory)${ITL0}, or specify the source path with ${BLD1}--sourcedir=${BLD0}full/path!\n" exit 1 fi if [[ ${TEST} != "yes" ]] ; then printf "${RDFG}You must have the following tools installed:${DFFG} ${ITL1}mksquashfs, chrpath${ITL0}!\n" exit 1 fi if [[ "${QMAKE}" == "${SYSTEM_QMAKE}" ]] ; then printf "${RDFG}You should use precompiled Qt package${DFFG} downloaded from ${UDR1}${ITL1}http://download.qt.io/official_releases/qt/${ALL0}\n" exit 1 elif [[ -z ${RUNTIME_BINARY} ]] ; then printf "\n${RDFG}Required precompiled „${BLD1}runtime${BLD0}“ binary!${DFFG} It's a part of ${ITL1}AppImageKit${ITL0} ${UDR1}https://github.com/probonopd/AppImageKit${UDR0}\n" exit 1 fi 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 00000000..628080bc --- /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 00000000..fcd571fb --- /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 00000000..88d108a4 --- /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