Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port appimage to linuxdeployqt type2 #98

Closed
wants to merge 12 commits into from
27 changes: 18 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ matrix:
- os: linux
dist: xenial
sudo: required
compiler:
- gcc
compiler: gcc
- os: linux
dist: xenial
sudo: required
compiler:
- clang
compiler: clang
- os: osx
compiler: clang
exclude:
Expand All @@ -26,7 +24,6 @@ before_install:
# Linux
- if [ $TRAVIS_OS_NAME == linux ]; then
sudo apt-add-repository ppa:beineri/opt-qt595-xenial -y;
sudo apt-add-repository ppa:as-bahanta/raqm -y;
sudo apt-add-repository ppa:ricotz/testing -y;
sudo apt-get update -qq;
fi
Expand All @@ -37,6 +34,7 @@ before_install:

install:
# Linux
# Build a more recent poppler than Ubuntu Xenial's poppler 0.41.0
- if [ $TRAVIS_OS_NAME == linux ]; then
sudo apt-get install --force-yes cmake libboost-python-dev libcups2-dev libhunspell-dev
libhyphen-dev liblcms2-dev libpodofo-dev libtiff-dev libxml2-dev
Expand All @@ -45,7 +43,6 @@ install:
libopenscenegraph-dev libpoppler-dev libpoppler-cpp-dev libcairo2-dev libwpg-dev
libmspub-dev libcdr-dev libvisio-dev libharfbuzz-dev libharfbuzz-icu0
coreutils binutils python-tk;
# Build a more recent poppler than Ubuntu Xenial's poppler 0.41.0
mkdir deps && pushd deps;
sudo apt-get install --force-yes libopenjpeg-dev;
wget https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz && tar -xf poppler-data-0.4.9.tar.gz;
Expand Down Expand Up @@ -82,8 +79,21 @@ script:
fi;
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWANT_HUNSPELL=1 -DWITH_PODOFO=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_DEBUG=0 -DWANT_SVNVERSION=0 -DWANT_GUI_LANG=en_US;
make -j"$NPROC";
make install;
bash -ex ./AppImage-package/bundle.sh;
make DESTDIR=appdir -j"$NPROC" install ; find appdir/;
cp /usr/lib/python2.7/lib-dynload/_tkinter.so appdir/usr/;
cp -r /usr/lib/tcltk appdir/usr/lib/;
cp -r /usr/share/tcltk appdir/usr/share/;
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage";
chmod a+x linuxdeployqt-continuous-x86_64.AppImage;
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH;
export VERSION=$(git rev-parse --short HEAD);
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -bundle-non-qt-libs -executable=$(ls appdir/usr/lib/scribus/plugins/*.so | sed ':a;N;$!ba;s/\n/ -executable=/g');
./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract;
mv appdir/usr/_tkinter.so appdir/usr/lib/;
( cd appdir/usr/ ; ln -s ./lib/_tkinter.so . );
./squashfs-root/usr/bin/linuxdeployqt -bundle-non-qt-libs appdir/usr/lib/_tkinter.so;
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage;
curl --upload-file "${TRAVIS_BUILD_DIR}/Scribus-${VERSION}-x86_64.AppImage" https://transfer.sh/"Scribus-${VERSION}-x86_64.AppImage";
fi

- if [ $TRAVIS_OS_NAME = osx -a $CC = clang ]; then
Expand All @@ -101,4 +111,3 @@ notifications:
- "%{repository}/%{branch} (%{author}): %{build_url}: %{message}"
on_success: always
on_failure: always

5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,11 @@ if(APPLEBUNDLE)
)
endif()

# Appimage
if (BUILD_APPIMAGE_BUNDLE)
set(DBUILD_APPIMAGE_BUNDLE TRUE)
endif()

##############################################################################################################
########## Install/CPack Setup ##########

Expand Down
33 changes: 32 additions & 1 deletion scribus/scpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ for which a new license (GPL+exception) is in place.
*/
#include "scpaths.h"
#include <QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QProcess>
Expand Down Expand Up @@ -66,6 +67,35 @@ ScPaths::ScPaths() :
m_shareDir(SHAREDIR),
m_templateDir(TEMPLATEDIR)
{

// Build an appimage and redirect the paths to
// ones inside the bundle, relative to the executable.
#ifdef Q_OS_LINUX
// Set the application name expliticly.
QCoreApplication::setApplicationName("scribus");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of this? Are you imagining occasions where the default of "executable name" is wrong?

Copy link
Author

@LyzardKing LyzardKing Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that because the file configs were set in a different location every time I installed a new version.
I can't remember now (I told @aoloe in irc a while back) but I believe the folders were named scribus-<version> or similar

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this fixed it? It feels weird, I would love to have more details about this… @aoloe ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the details should be somewhere in irc...
The issue is that there was no application name set properly...
we could test this again if you want..

QString pathPtr = QCoreApplication::applicationDirPath() + QString("/..");
m_shareDir = QString("%1/share/scribus/").arg(pathPtr);
m_docDir = QString("%1/share/doc/scribus/").arg(pathPtr);
//m_fontDir = QString("%1/share/scribus/fonts/").arg(pathPtr);
m_iconDir = QString("%1/share/scribus/icons/").arg(pathPtr);
m_sampleScriptDir = QString("%1/share/scribus/samples/").arg(pathPtr);
m_scriptDir = QString("%1/share/scribus/scripts/").arg(pathPtr);
m_templateDir = QString("%1/share/scribus/templates/").arg(pathPtr);
m_libDir = QString("%1/lib/scribus/").arg(pathPtr);
m_pluginDir = QString("%1/lib/scribus/plugins/").arg(pathPtr);
m_qmlDir = QString("%1/share/scribus/qml/").arg(pathPtr);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the scribus in the hardcoded paths there should use whatever C++ const is defined by the cmake variable TAG_VERSION.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we add a version number in the folders?
would that not just add a new folder on every update?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is TAG_VERSION defined as. By default it is an empty string, but whoever builds it can use it to be able to build different co-installable builds of scribus.

For example, for the Ubuntu PPA I'm providing 3 builds, 'scribus', 'scribus-ng' and 'scribus-trunk', all of them coinstallable. For example, in the latest TAG_VERSION is -trunk.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why you would be interested in adding a "number", but I am. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I thought it was a value that was not empty by default...
how would I add the cmake value in the cpp code?


qDebug() << QString("scpaths: doc dir=%1").arg(m_docDir);
qDebug() << QString("scpaths: icon dir=%1").arg(m_iconDir);
//qDebug() << QString("scpaths: font dir=%1").arg(m_fontDir);
qDebug() << QString("scpaths: sample dir=%1").arg(m_sampleScriptDir);
qDebug() << QString("scpaths: script dir=%1").arg(m_scriptDir);
qDebug() << QString("scpaths: template dir=%1").arg(m_templateDir);
qDebug() << QString("scpaths: lib dir=%1").arg(m_libDir);
qDebug() << QString("scpaths: plugins dir=%1").arg(m_pluginDir);
qDebug() << QString("scpaths: qml dir=%1").arg(m_qmlDir);
#endif

// On MacOS/X, override the compile-time settings with a location
// obtained from the system.
#ifdef Q_OS_MAC
Expand Down Expand Up @@ -94,8 +124,9 @@ ScPaths::ScPaths() :
qDebug() << QString("scpaths: plugin dir=%1").arg(m_pluginDir);
qDebug() << QString("scpaths: QML dir=%1").arg(m_qmlDir);
qDebug() << QString("scpaths: qtplugins=%1").arg(QApplication::libraryPaths().join(":"));
#endif

#elif defined(_WIN32)
#ifdef defined(_WIN32)
QFileInfo appInfo(qApp->applicationDirPath());
QString appPath = qApp->applicationDirPath();
QString cleanAppPath = appInfo.canonicalFilePath();
Expand Down