Skip to content

Commit

Permalink
Build AppImage Qt from sources
Browse files Browse the repository at this point in the history
Fixes unicode error in QJsonDocument. (EPEL's Qt build is broken)
https://bugzilla.redhat.com/show_bug.cgi?id=1376832
  • Loading branch information
callaa committed Apr 12, 2017
1 parent b68d62e commit cb60c52
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 22 deletions.
Binary file added desktop/drawpile-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions pkg/appimage/Build-client
Expand Up @@ -7,9 +7,7 @@
set -e
set -x


export LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib:$LD_LIBRARY_PATH # Needed for bundling the libraries into AppDir below
export PATH=/opt/rh/devtoolset-2/root/usr/bin/:$CMAKE_PATH:$PATH # Needed at compile time to find Qt and cmake
. /opt/rh/devtoolset-3/enable

SRCDIR=/Drawpile
WORKDIR=/work
Expand Down Expand Up @@ -41,8 +39,11 @@ chmod a+x AppRun

# Copy libraries
mkdir -p usr/lib/qt5/plugins/platforms
cd usr
ln -s lib lib64
cd ..

cp -r /usr/lib64/qt5/plugins/{audio,bearer,generic,iconengines,imageformats,platforminputcontexts,platformthemes} usr/lib/qt5/plugins
cp -r /usr/lib64/qt5/plugins/{audio,generic,iconengines,imageformats} usr/lib/qt5/plugins
cp /usr/lib64/qt5/plugins/platforms/libqxcb.so usr/lib/qt5/plugins/platforms

ldd usr/bin/drawpile | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -vL '{}' ./usr/lib || true
Expand Down Expand Up @@ -70,12 +71,15 @@ mkdir -p $ICONDIR/16x16/apps
cp $SRCDIR/desktop/drawpile-16x16.png $ICONDIR/16x16/apps/drawpile.png
mkdir -p $ICONDIR/32x32/apps
cp $SRCDIR/desktop/drawpile-32x32.png $ICONDIR/32x32/apps/drawpile.png
mkdir -p $ICONDIR/48x48/apps
cp $SRCDIR/desktop/drawpile-48x48.png $ICONDIR/48x48/apps/drawpile.png
mkdir -p $ICONDIR/64x64/apps
cp $SRCDIR/desktop/drawpile-64x64.png $ICONDIR/64x64/apps/drawpile.png
mkdir -p $ICONDIR/128x128/apps
cp $SRCDIR/desktop/drawpile-128x128.png $ICONDIR/128x128/apps/drawpile.png
mkdir -p $ICONDIR/scalable/apps
cp $SRCDIR/desktop/drawpile.svg $ICONDIR/scalable/apps/drawpile.svg
cp $SRCDIR/desktop/drawpile.svg $APPDIR


# Build Appimage
Expand Down
8 changes: 3 additions & 5 deletions pkg/appimage/Build-deps
Expand Up @@ -7,21 +7,19 @@

set -e
set -x

export LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib:$LD_LIBRARY_PATH
export PATH=/opt/rh/devtoolset-2/root/usr/bin/:$CMAKE_PATH:$PATH
. /opt/rh/devtoolset-3/enable

# Non-repo deps: ECM (needed to build KF5 libs)
cd /
wget -O ecm.tar.xz http://download.kde.org/stable/frameworks/5.29/extra-cmake-modules-5.29.0.tar.xz
wget -O ecm.tar.xz http://download.kde.org/stable/frameworks/5.33/extra-cmake-modules-5.33.0.tar.xz
tar xfJ ecm.tar.xz
cd extra-cmake-modules*/
cmake3 . -DCMAKE_INSTALL_PREFIX=/usr
make install

# Non-repo deps: Get and build KArchive
cd /
wget -O karchive.tar.xz http://download.kde.org/stable/frameworks/5.29/karchive-5.29.0.tar.xz
wget -O karchive.tar.xz http://download.kde.org/stable/frameworks/5.33/karchive-5.33.0.tar.xz
tar xfJ karchive.tar.xz
cd karchive*/
mkdir build
Expand Down
19 changes: 19 additions & 0 deletions pkg/appimage/Build-qt
@@ -0,0 +1,19 @@
#!/bin/bash

set -e
set -x
. /opt/rh/devtoolset-3/enable


# Build Qt
cd /opt
tar xfJ qt.tar.xz
cd qt-everywhere-opensource-src-5.7.1
yes | ./configure -opensource -prefix /usr -libdir /usr/lib64 -archdatadir /usr/lib64/qt5 -datadir /usr/share/qt5 -headerdir /usr/include/qt5 -xkb-config-root /usr/share/X11/xkb -openssl-linked -skip qt3d -skip qtcanvas3d -skip qtcharts -skip qtwebengine -skip qtwebview -skip gamepad -skip qtscxml -skip qtdeclarative -no-compile-examples

gmake
gmake install

cd ..
rm -rf qt-everywhere-opensource-src-5.7.1

11 changes: 5 additions & 6 deletions pkg/appimage/Build-server
Expand Up @@ -7,9 +7,7 @@
set -e
set -x


export LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib:$LD_LIBRARY_PATH # Needed for bundling the libraries into AppDir below
export PATH=/opt/rh/devtoolset-2/root/usr/bin/:$CMAKE_PATH:$PATH # Needed at compile time to find Qt and cmake
. /opt/rh/devtoolset-3/enable

SRCDIR=/Drawpile
WORKDIR=/work
Expand Down Expand Up @@ -44,11 +42,12 @@ chmod a+x AppRun

# Copy libraries
mkdir -p usr/lib/qt5/plugins
cd usr
ln -s lib lib64
cd ..
cp -r /usr/lib64/qt5/plugins/sqldrivers usr/lib/qt5/plugins

ldd usr/bin/drawpile-srv | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -vL '{}' ./usr/lib/ || true
#ldd usr/lib/qt5/plugins/platforms/libqxcb.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -vL '{}' ./usr/lib || true


cd usr/ ; find . -type f -exec sed -i -e 's|/usr/lib|././/lib|g' {} \; ; cd ..

Expand Down Expand Up @@ -79,7 +78,7 @@ Terminal=true
END

cp $SRCDIR/desktop/drawpile-64x64.png drawpile.png
cp $SRCDIR/desktop/drawpile-48x48.png $APPDIR/drawpile.png

# Build Appimage

Expand Down
16 changes: 11 additions & 5 deletions pkg/appimage/Dockerfile
@@ -1,11 +1,17 @@
FROM centos:6

RUN yum -y install epel-release wget
RUN wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
RUN yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils zlib-devel qt5-qtbase-devel qt5-qtsvg-devel qt5-qtmultimedia-devel qt5-linguist cmake3 make giflib-devel wget unzip git xz binutils fuse glibc-devel glib2-devel fuse-devel zlib-devel libpng12 libmicrohttpd-devel
RUN yum -y install tar bzip2 git libtool which fuse fuse-devel libpng-devel automake libtool mesa-libEGL cppunit-devel cmake3 glibc-headers libstdc++-devel freetype-devel fontconfig-devel libxml2-devel libstdc++-devel libXrender-devel patch xcb-util-keysyms-devel libXi-devel mesa-libGL-devel libxcb libxcb-devel xcb-util xcb-util-devel openssl-devel xz unzip glibc-devel glib2-devel libmicrohttpd-devel pulseaudio-libs-devel
RUN yum -y install libxcb libxcb-devel libXrender libXrender-devel xcb-util-wm xcb-util-wm-devel xcb-util xcb-util-devel xcb-util-image xcb-util-image-devel xcb-util-keysyms xcb-util-keysyms-devel

ADD Build-deps /
ADD appimage.patch /
# Newer compiler than what comes with CentOS 6
RUN yum -y install centos-release-scl-rh
RUN yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++

RUN bash -ex Build-deps
RUN wget http://download.qt.io/archive/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.1.tar.xz -O /opt/qt.tar.xz

ADD Build-qt /
RUN bash -ex Build-qt

ADD Build-deps /
RUN bash -ex Build-deps
19 changes: 17 additions & 2 deletions pkg/appimage/build.sh
@@ -1,13 +1,28 @@
#!/bin/bash
set -e

if [ $# -ne 1 ]; then
echo "Usage: ./build.sh <shell|client|server>"
exit 1
fi

mkdir -p out

cd ../..
IMAGE=drawpile2
SRCVOL="$(pwd):/Drawpile:ro"
OUTVOL="$(pwd)/pkg/appimage/out:/out"

docker run --rm -ti -v "$SRCVOL" -v "$OUTVOL" $IMAGE bash /Drawpile/pkg/appimage/Build-client
docker run --rm -ti -v "$SRCVOL" -v "$OUTVOL" $IMAGE bash /Drawpile/pkg/appimage/Build-server
if [ "$1" == "shell" ]; then
CMD=""
elif [ "$1" == "client" ]; then
CMD="/Drawpile/pkg/appimage/Build-client"
elif [ "$1" == "server" ]; then
CMD="/Drawpile/pkg/appimage/Build-server"
else
echo "Unknown build target: $1"
exit 1
fi

docker run --rm -ti -v "$SRCVOL" -v "$OUTVOL" $IMAGE bash $CMD

0 comments on commit cb60c52

Please sign in to comment.