diff --git a/.gitmodules b/.gitmodules index acbc914b34..91f5ca18fa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..efb73eec9a --- /dev/null +++ b/.travis.yml @@ -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)$/ diff --git a/platform/x11/file_chooser.c b/platform/x11/file_chooser.c new file mode 100644 index 0000000000..1c5dcfdd87 --- /dev/null +++ b/platform/x11/file_chooser.c @@ -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 +#include +#include +#include +#include +#include +#include + + +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; +} diff --git a/platform/x11/mujstest.desktop b/platform/x11/mujstest.desktop new file mode 100644 index 0000000000..86aaa917c5 --- /dev/null +++ b/platform/x11/mujstest.desktop @@ -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; diff --git a/platform/x11/mupdf.desktop b/platform/x11/mupdf.desktop new file mode 100644 index 0000000000..3495c6693c --- /dev/null +++ b/platform/x11/mupdf.desktop @@ -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; diff --git a/platform/x11/mutool.desktop b/platform/x11/mutool.desktop new file mode 100644 index 0000000000..442cac0ddf --- /dev/null +++ b/platform/x11/mutool.desktop @@ -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;