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

Continuous AppImage build for each git push #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[submodule "thirdparty/jbig2dec"]
path = thirdparty/jbig2dec
url = ../jbig2dec.git
url = https://github.com/ArtifexSoftware/jbig2dec
[submodule "thirdparty/mujs"]
path = thirdparty/mujs
url = ../mujs.git
url = https://github.com/ArtifexSoftware/mujs
[submodule "thirdparty/freetype"]
path = thirdparty/freetype
url = ../thirdparty-freetype2.git
url = https://github.com/ArtifexSoftware/thirdparty-freetype2
[submodule "thirdparty/harfbuzz"]
path = thirdparty/harfbuzz
url = ../thirdparty-harfbuzz.git
url = https://github.com/ArtifexSoftware/thirdparty-harfbuzz
[submodule "thirdparty/jpeg"]
path = thirdparty/libjpeg
url = ../thirdparty-libjpeg.git
url = https://github.com/ArtifexSoftware/thirdparty-libjpeg
[submodule "thirdparty/lcms2"]
path = thirdparty/lcms2
url = ../thirdparty-lcms2.git
url = https://github.com/ArtifexSoftware/thirdparty-lcms2
[submodule "thirdparty/openjpeg"]
path = thirdparty/openjpeg
url = ../thirdparty-openjpeg.git
url = https://github.com/ArtifexSoftware/thirdparty-openjpeg
[submodule "thirdparty/zlib"]
path = thirdparty/zlib
url = ../thirdparty-zlib.git
url = https://github.com/ArtifexSoftware/thirdparty-zlib
[submodule "thirdparty/curl"]
path = thirdparty/curl
url = ../thirdparty-curl.git
url = https://github.com/ArtifexSoftware/thirdparty-curl
[submodule "thirdparty/freeglut"]
path = thirdparty/freeglut
url = ../thirdparty-freeglut.git
url = https://git.ghostscript.com/thirdparty-freeglut.git
50 changes: 50 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
language: cpp
compiler: gcc
sudo: require
dist: trusty

install:
- sudo apt-get -y install xorg-dev mesa-common-dev libgl1-mesa-dev libxcursor-dev libxrandr-dev libxinerama-dev libgtk2.0-dev

script:
- gcc -Wl,--no-as-needed `pkg-config --cflags --libs gtk+-2.0` platform/x11/file_chooser.c -o file_chooser ; strip file_chooser
- ( cd thirdparty/ ; git submodule init ; git submodule update )
- make prefix=/usr install DESTDIR=$(readlink -f appdir) ; find appdir/

- mkdir -p ./appdir/usr/share/hicolor/scalable/apps ; wget -c "https://ghostscript.com/~tor/mupdf-logo/mupdf-logo.svg" -O ./appdir/usr/share/hicolor/scalable/apps/mupdf.svg
- rm -rf ./appdir/usr/include appdir/usr/lib/*.a # Don't need to ship developer files in AppImage

- # First, MuPDF
- cp -r appdir mupdf.AppDir
- cp file_chooser mupdf.AppDir/usr/bin
- mkdir -p ./mupdf.AppDir/usr/share/applications ; cp platform/x11/mupdf.desktop ./mupdf.AppDir/usr/share/applications/
- rm ./mupdf.AppDir/usr/bin/{mjsgen,mujstest,mupdf-x11,mupdf-x11-curl,muraster,mutool}
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file
- ./linuxdeployqt*.AppImage ./mupdf.AppDir/usr/bin/file_chooser -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./mupdf.AppDir/usr/share/applications/*.desktop -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./mupdf.AppDir/usr/share/applications/*.desktop -appimage
- # Next, mutool
- cp -r appdir mutool.AppDir
- rm ./mutool.AppDir/usr/bin/{mjsgen,mujstest,muraster,mupdf*}
- mkdir -p ./mutool.AppDir/usr/share/applications ; cp platform/x11/mutool.desktop ./mutool.AppDir/usr/share/applications/
- ./linuxdeployqt*.AppImage ./mutool.AppDir/usr/share/applications/*.desktop -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./mutool.AppDir/usr/share/applications/*.desktop -appimage
- # Next, mujstest
- cp -r appdir mujstest.AppDir
- rm ./mujstest.AppDir/usr/bin/{mjsgen,mutool,muraster,mupdf*}
- mkdir -p ./mujstest.AppDir/usr/share/applications ; cp platform/x11/mujstest.desktop ./mujstest.AppDir/usr/share/applications/
- ./linuxdeployqt*.AppImage ./mujstest.AppDir/usr/share/applications/*.desktop -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./mujstest.AppDir/usr/share/applications/*.desktop -appimage

after_success:
- rm ./linuxdeployqt*.AppImage
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
- bash upload.sh ./*.AppImage*

branches:
except:
- # Do not build tags that we create when we upload to GitHub Releases
- /^(?i:continuous)$/
45 changes: 45 additions & 0 deletions platform/x11/file_chooser.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* Shows file chooser dialog and returns selected file.
* THIS IS A STUB. FEEL FREE TO CHANGE AS YOU SEE FIT.
* Compile:
* sudo apt install libgtk2.0-dev
* gcc -Wl,--no-as-needed `pkg-config --cflags --libs gtk+-2.0` file_chooser.c -o file_chooser */

#include <gtk/gtk.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <dirent.h>


int main(int argc, char *argv[])
{
gchar *path;
GtkWidget *dialog;
int dlg_ret = 0;

char command[255];
char *dir = realpath( "/proc/self/exe", NULL );
if (!dir)
{
exit(1);
}

sprintf(command, "%s/mupdf-gl", dirname(dir));

gtk_init(&argc, &argv);
dialog = gtk_file_chooser_dialog_new("Select file", NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
dlg_ret = gtk_dialog_run(GTK_DIALOG(dialog));
if(dlg_ret == GTK_RESPONSE_ACCEPT)
{
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
if( path!=NULL )
{
return execlp(command, command, path, NULL);
}
}
gtk_widget_destroy(dialog);
gtk_exit(0);
return 0;
}
9 changes: 9 additions & 0 deletions platform/x11/mujstest.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=mujstest
Comment=Test tool for PDF files
Exec=mujstest %f
Icon=mupdf
Terminal=true
Type=Application
MimeType=application/pdf;application/x-pdf
Categories=Graphics;
9 changes: 9 additions & 0 deletions platform/x11/mupdf.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=MuPDF
Comment=Lightweight PDF, XPS, and E-book viewer
Exec=file_chooser %f
Icon=mupdf
Terminal=false
Type=Application
MimeType=application/pdf;application/x-pdf;application/x-cbz;application/oxps;application/vnd.ms-xpsdocument;image/jpeg;image/pjpeg;image/png;image/tiff;image/x-tiff
Categories=Viewer;Graphics;
9 changes: 9 additions & 0 deletions platform/x11/mutool.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=mutool
Comment=All purpose tool for dealing with PDF files
Exec=mutool %f
Icon=mupdf
Terminal=true
Type=Application
MimeType=application/pdf;application/x-pdf
Categories=Graphics;