From 34186d9a20383fb926af37af23f8947d4d17321a Mon Sep 17 00:00:00 2001 From: luzpaz Date: Fri, 23 Dec 2016 07:12:49 -0500 Subject: [PATCH 1/7] Create bundle.sh --- AppImage-package/bundle.sh | 113 +++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 AppImage-package/bundle.sh diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh new file mode 100644 index 0000000000..7c58ba95fb --- /dev/null +++ b/AppImage-package/bundle.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +######################################################################## +# Package the binaries built on Travis-CI as an AppImage +# By Simon Peter 2016 +# For more information, see http://appimage.org/ +######################################################################## + +export ARCH=$(arch) + +APP=Scribus +LOWERAPP=${APP,,} + +GIT_REV=$(git rev-parse --short HEAD) +echo $GIT_REV +make install DESTDIR=/home/travis/$APP/$APP.AppDir + +cd $HOME/$APP/ + +wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh +. ./functions.sh + +cd $APP.AppDir + +######################################################################## +# Copy desktop and icon file to AppDir for AppRun to pick them up +######################################################################## + +get_apprun + +find . -name *desktop -exec cp {} $LOWERAPP.desktop \; + +cp ./usr/share/scribus/icons/1_5_1/scribus.png . +rm -rf usr/share/icons/hicolor/48x48/ + +######################################################################## +# Copy in the dependencies that cannot be assumed to be available +# on all target systems +######################################################################## + +# FIXME: How to find out which subset of plugins is really needed? +mkdir -p ./usr/lib/qt5/plugins/ +PLUGINS=/opt/qt57/plugins/ +cp -r $PLUGINS/* ./usr/lib/qt5/plugins/ + +# Tcl/Tk, Tkinter (for Calendar script) +cp /usr/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime +ldd usr/_tkinter.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true +cp -r /usr/lib/tcltk usr/lib/ +cp -r /usr/share/tcltk usr/share/ + +export LD_LIBRARY_PATH=/opt/qt57/lib/:LD_LIBRARY_PATH +copy_deps + +# Move the libraries to usr/bin +move_lib +mv ./opt/qt57/lib/* usr/lib ; rm -rf ./opt +( cd usr/lib/qt5/plugins/platforms/../../ ; ln -s ../../lib/ . ) +mv usr/lib/x86_64-linux-gnu/* usr/lib/ + +######################################################################## +# Delete stuff that should not go into the AppImage +######################################################################## + +# Delete dangerous libraries; see +# https://github.com/probonopd/AppImages/blob/master/excludelist +delete_blacklisted + +# We don't bundle the developer stuff +rm -rf usr/include || true +rm -rf usr/lib/cmake || true +rm -rf usr/lib/pkgconfig || true +find . -name '*.la' | xargs -i rm {} +strip usr/bin/* usr/lib/* || true + +######################################################################## +# desktopintegration asks the user on first run to install a menu item +######################################################################## + +get_desktopintegration $LOWERAPP + +######################################################################## +# Determine the version of the app; also include needed glibc version +######################################################################## + +GLIBC_NEEDED=$(glibc_needed) +VERSION=git$GIT_REV-glibc$GLIBC_NEEDED + +######################################################################## +# Patch away absolute paths; it would be nice if they were relative +######################################################################## + +sed -i -e 's|/usr/share/scribus|././/share/scribus|g' usr/bin/scribus +sed -i -e 's|/usr/lib/scribus|././/lib/scribus|g' usr/bin/scribus +sed -i -e 's|/usr/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus +# Possibly need to patch additional hardcoded paths away, replace +# "/usr" with "././" which means "usr/ in the AppDir" + +######################################################################## +# AppDir complete +# Now packaging it as an AppImage +######################################################################## + +cd .. # Go out of AppImage + +mkdir -p ../out/ +generate_appimage + +######################################################################## +# Upload the AppDir +######################################################################## + +transfer ../out/* From 20a0a887745e5147ede03e3d45c7779706cf5f1d Mon Sep 17 00:00:00 2001 From: luzpaz Date: Fri, 23 Dec 2016 07:17:16 -0500 Subject: [PATCH 2/7] add appimage generator to .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e09cddf754..de55d22807 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,6 +65,7 @@ script: cmake . -DWANT_HUNSPELL=1 -DWITH_PODOFO=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_DEBUG=0 -DWANT_SVNVERSION=0 -DWANT_GUI_LANG=en_US -DCMAKE_INSTALL_PREFIX=~/.local; make -j"$NPROC"; make install; + bash -ex ./AppImage-package/bundle.sh; fi - if [ $TRAVIS_OS_NAME = osx -a $CC = clang ]; then From 8665913a176c3cc1b62cd92587c6afe1f2d35ef4 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Fri, 23 Dec 2016 08:06:15 -0500 Subject: [PATCH 3/7] changed from /usr to /.local/ --- AppImage-package/bundle.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh index 7c58ba95fb..39ce652725 100644 --- a/AppImage-package/bundle.sh +++ b/AppImage-package/bundle.sh @@ -30,8 +30,8 @@ get_apprun find . -name *desktop -exec cp {} $LOWERAPP.desktop \; -cp ./usr/share/scribus/icons/1_5_1/scribus.png . -rm -rf usr/share/icons/hicolor/48x48/ +cp ./.local/share/scribus/icons/1_5_1/scribus.png . +rm -rf .local/share/icons/hicolor/48x48/ ######################################################################## # Copy in the dependencies that cannot be assumed to be available @@ -39,15 +39,15 @@ rm -rf usr/share/icons/hicolor/48x48/ ######################################################################## # FIXME: How to find out which subset of plugins is really needed? -mkdir -p ./usr/lib/qt5/plugins/ +mkdir -p ./.local/lib/qt5/plugins/ PLUGINS=/opt/qt57/plugins/ -cp -r $PLUGINS/* ./usr/lib/qt5/plugins/ +cp -r $PLUGINS/* ./local/lib/qt5/plugins/ # Tcl/Tk, Tkinter (for Calendar script) -cp /usr/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime -ldd usr/_tkinter.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true -cp -r /usr/lib/tcltk usr/lib/ -cp -r /usr/share/tcltk usr/share/ +cp /.local/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime +ldd .local/_tkinter.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./.local/lib || true +cp -r /.local/lib/tcltk usr/lib/ +cp -r /.local/share/tcltk usr/share/ export LD_LIBRARY_PATH=/opt/qt57/lib/:LD_LIBRARY_PATH copy_deps @@ -55,7 +55,7 @@ copy_deps # Move the libraries to usr/bin move_lib mv ./opt/qt57/lib/* usr/lib ; rm -rf ./opt -( cd usr/lib/qt5/plugins/platforms/../../ ; ln -s ../../lib/ . ) +( cd .local/lib/qt5/plugins/platforms/../../ ; ln -s ../../lib/ . ) mv usr/lib/x86_64-linux-gnu/* usr/lib/ ######################################################################## @@ -67,11 +67,11 @@ mv usr/lib/x86_64-linux-gnu/* usr/lib/ delete_blacklisted # We don't bundle the developer stuff -rm -rf usr/include || true -rm -rf usr/lib/cmake || true -rm -rf usr/lib/pkgconfig || true +rm -rf .local/include || true +rm -rf .local/lib/cmake || true +rm -rf .local/lib/pkgconfig || true find . -name '*.la' | xargs -i rm {} -strip usr/bin/* usr/lib/* || true +strip .local/bin/* .local/lib/* || true ######################################################################## # desktopintegration asks the user on first run to install a menu item @@ -90,11 +90,11 @@ VERSION=git$GIT_REV-glibc$GLIBC_NEEDED # Patch away absolute paths; it would be nice if they were relative ######################################################################## -sed -i -e 's|/usr/share/scribus|././/share/scribus|g' usr/bin/scribus -sed -i -e 's|/usr/lib/scribus|././/lib/scribus|g' usr/bin/scribus -sed -i -e 's|/usr/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus +sed -i -e 's|/.local/share/scribus|././/share/scribus|g' usr/bin/scribus +sed -i -e 's|/.local/lib/scribus|././/lib/scribus|g' usr/bin/scribus +sed -i -e 's|/.local/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus # Possibly need to patch additional hardcoded paths away, replace -# "/usr" with "././" which means "usr/ in the AppDir" +# "/.local" with "././" which means ".local/ in the AppDir" ######################################################################## # AppDir complete From 295da14b7941972ba4e01bd8ce34237375d3b613 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Mon, 26 Dec 2016 14:50:17 -0500 Subject: [PATCH 4/7] Linux builds back to -DCMAKE_INSTALL_PREFIX=/usr --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index de55d22807..ca1e3097c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,7 @@ script: else export NPROC=1; fi; - cmake . -DWANT_HUNSPELL=1 -DWITH_PODOFO=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_DEBUG=0 -DWANT_SVNVERSION=0 -DWANT_GUI_LANG=en_US -DCMAKE_INSTALL_PREFIX=~/.local; + 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; From ee9ac5150935e938d4c1c46b397b3d847a9df3bb Mon Sep 17 00:00:00 2001 From: luzpaz Date: Mon, 26 Dec 2016 14:51:26 -0500 Subject: [PATCH 5/7] changed back to /usr --- AppImage-package/bundle.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh index 39ce652725..a1485ffdd5 100644 --- a/AppImage-package/bundle.sh +++ b/AppImage-package/bundle.sh @@ -30,8 +30,8 @@ get_apprun find . -name *desktop -exec cp {} $LOWERAPP.desktop \; -cp ./.local/share/scribus/icons/1_5_1/scribus.png . -rm -rf .local/share/icons/hicolor/48x48/ +cp ./usr/share/scribus/icons/1_5_1/scribus.png . +rm -rf usr/share/icons/hicolor/48x48/ ######################################################################## # Copy in the dependencies that cannot be assumed to be available @@ -39,15 +39,15 @@ rm -rf .local/share/icons/hicolor/48x48/ ######################################################################## # FIXME: How to find out which subset of plugins is really needed? -mkdir -p ./.local/lib/qt5/plugins/ +mkdir -p ./usr/lib/qt5/plugins/ PLUGINS=/opt/qt57/plugins/ cp -r $PLUGINS/* ./local/lib/qt5/plugins/ # Tcl/Tk, Tkinter (for Calendar script) -cp /.local/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime -ldd .local/_tkinter.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./.local/lib || true -cp -r /.local/lib/tcltk usr/lib/ -cp -r /.local/share/tcltk usr/share/ +cp /usr/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime +ldd usr/_tkinter.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true +cp -r /usr/lib/tcltk usr/lib/ +cp -r /usr/share/tcltk usr/share/ export LD_LIBRARY_PATH=/opt/qt57/lib/:LD_LIBRARY_PATH copy_deps @@ -55,7 +55,7 @@ copy_deps # Move the libraries to usr/bin move_lib mv ./opt/qt57/lib/* usr/lib ; rm -rf ./opt -( cd .local/lib/qt5/plugins/platforms/../../ ; ln -s ../../lib/ . ) +( cd usr/lib/qt5/plugins/platforms/../../ ; ln -s ../../lib/ . ) mv usr/lib/x86_64-linux-gnu/* usr/lib/ ######################################################################## @@ -67,11 +67,11 @@ mv usr/lib/x86_64-linux-gnu/* usr/lib/ delete_blacklisted # We don't bundle the developer stuff -rm -rf .local/include || true -rm -rf .local/lib/cmake || true -rm -rf .local/lib/pkgconfig || true +rm -rf usr/include || true +rm -rf usr/lib/cmake || true +rm -rf usr/lib/pkgconfig || true find . -name '*.la' | xargs -i rm {} -strip .local/bin/* .local/lib/* || true +strip usr/bin/* usr/lib/* || true ######################################################################## # desktopintegration asks the user on first run to install a menu item @@ -90,11 +90,11 @@ VERSION=git$GIT_REV-glibc$GLIBC_NEEDED # Patch away absolute paths; it would be nice if they were relative ######################################################################## -sed -i -e 's|/.local/share/scribus|././/share/scribus|g' usr/bin/scribus -sed -i -e 's|/.local/lib/scribus|././/lib/scribus|g' usr/bin/scribus -sed -i -e 's|/.local/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus +sed -i -e 's|/usr/share/scribus|././/share/scribus|g' usr/bin/scribus +sed -i -e 's|/usr/lib/scribus|././/lib/scribus|g' usr/bin/scribus +sed -i -e 's|/usr/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus # Possibly need to patch additional hardcoded paths away, replace -# "/.local" with "././" which means ".local/ in the AppDir" +# "/usr" with "././" which means "usr/ in the AppDir" ######################################################################## # AppDir complete From 4814bb6b1298426c3d6e18b8e082e666cce0a119 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Mon, 26 Dec 2016 14:55:21 -0500 Subject: [PATCH 6/7] missed a usr/ --- AppImage-package/bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh index a1485ffdd5..7c58ba95fb 100644 --- a/AppImage-package/bundle.sh +++ b/AppImage-package/bundle.sh @@ -41,7 +41,7 @@ rm -rf usr/share/icons/hicolor/48x48/ # FIXME: How to find out which subset of plugins is really needed? mkdir -p ./usr/lib/qt5/plugins/ PLUGINS=/opt/qt57/plugins/ -cp -r $PLUGINS/* ./local/lib/qt5/plugins/ +cp -r $PLUGINS/* ./usr/lib/qt5/plugins/ # Tcl/Tk, Tkinter (for Calendar script) cp /usr/li*/python2.7/lib-dynload/_tkinter.so usr/ # It is indeed picked up here because we cd there at runtime From 6f72aa9dce58aba5f6d56f7e2dbfaf4fa429d488 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Sat, 31 Dec 2016 13:08:32 -0500 Subject: [PATCH 7/7] fix absolute path per https://github.com/scribusproject/scribus/pull/78#issuecomment-269864187 --- AppImage-package/bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh index 7c58ba95fb..759e46811c 100644 --- a/AppImage-package/bundle.sh +++ b/AppImage-package/bundle.sh @@ -90,7 +90,7 @@ VERSION=git$GIT_REV-glibc$GLIBC_NEEDED # Patch away absolute paths; it would be nice if they were relative ######################################################################## -sed -i -e 's|/usr/share/scribus|././/share/scribus|g' usr/bin/scribus +cd usr/ ; find . -type f -exec sed -i -e 's|/usr|././|g' {} \; ; cd .. sed -i -e 's|/usr/lib/scribus|././/lib/scribus|g' usr/bin/scribus sed -i -e 's|/usr/share/doc/scribus/|././/share/doc/scribus/|g' usr/bin/scribus # Possibly need to patch additional hardcoded paths away, replace