diff --git a/README.md b/README.md index dbdaff5a9..8d0649743 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,12 @@ You can customize all key bindings and some UI elements by editing `keys_user.co ### Linux +#### Arch Linux + +``` +sudo pacman -Syu qt5-3d mupdf libmupdf +``` + #### Fedora Run the following commands to install dependencies, clone the repository and compile sioyek on Fedora (tested on Fedora Workstation 36). @@ -130,15 +136,17 @@ cd sioyek Run `qmake --version` to make sure the `qmake` in path is using Qt 5.x. 2. Install `libharfbuzz`: -``` -sudo apt install libharfbuzz-dev -``` -3. Clone the repository and build: -``` -git clone --recursive https://github.com/ahrm/sioyek -cd sioyek -./build_linux.sh -``` + ``` + sudo apt install libharfbuzz-dev + ``` +3. Clone the repository: + ``` + git clone --recursive https://github.com/ahrm/sioyek + cd sioyek + ``` +4. Build it: + - If you want to build a portable version, call `./build_linux.sh portable`. All the files you need will be built under the `build/` subdirectory. You can move this directory around and sioyek will still work. + - If instead you want to install it locally on your system, run `/build_linux.sh local`. This will install sioyek under `/usr/bin`. NOTE: This will link sioyek against the mupdf and zlib libraries provided by your system, not the sioyek-supplied ones. ### Windows 1. Install Visual Studio (tested on 2019, other relatively recent versions should work too) diff --git a/build_linux.sh b/build_linux.sh index 1f1e4b2ac..71ddd60bc 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -1,12 +1,24 @@ #!/usr/bin/env bash set -e -# Compile mupdf -cd mupdf -make USE_SYSTEM_HARFBUZZ=yes -cd .. +if [ -z $1 ]; +then + echo "Defaulting to portable build" + export MODE="portable" +elif [ $1 == "local" ]; +then + echo "Local build" + export MODE="local" +elif [ $1 == "portable" ]; +then + echo "Portable build" + export MODE="portable" +else + echo "Call with 'local' for a local build, or with 'portable' for a portable build" + exit +fi -# Compile sioyek +# Get qmake path if [ -f "/usr/bin/qmake-qt5" ]; then QMAKE="/usr/bin/qmake-qt5" @@ -17,16 +29,38 @@ else QMAKE="qmake" fi -$QMAKE "CONFIG+=linux_app_image" pdf_viewer_build_config.pro -make +# Clean old build +# make clean +# rm Makefile + +# Local build +if [ $MODE == "local" ]; +then + echo "Calling QMake" + $QMAKE pdf_viewer_build_config.pro + echo "Calling make" + make + echo "Calling make install" + sudo make install +# Portable build +elif [ $MODE == "portable" ]; +then + # Compile sioyek-shipped version of mupdf + cd mupdf + make USE_SYSTEM_HARFBUZZ=yes + cd .. + # Configure sioyek build + $QMAKE "CONFIG+=linux_app_image" pdf_viewer_build_config.pro + make + # Copy files in build/ subdirectory + rm -r build 2> /dev/null + mkdir build + mv sioyek build/sioyek + cp pdf_viewer/prefs.config build/prefs.config + cp pdf_viewer/prefs_user.config build/prefs_user.config + cp pdf_viewer/keys.config build/keys.config + cp pdf_viewer/keys_user.config build/keys_user.config + cp -r pdf_viewer/shaders build/shaders + cp tutorial.pdf build/tutorial.pdf +fi -# Copy files in build/ subdirectory -rm -rf build 2> /dev/null -mkdir build -mv sioyek build/sioyek -cp pdf_viewer/prefs.config build/prefs.config -cp pdf_viewer/prefs_user.config build/prefs_user.config -cp pdf_viewer/keys.config build/keys.config -cp pdf_viewer/keys_user.config build/keys_user.config -cp -r pdf_viewer/shaders build/shaders -cp tutorial.pdf build/tutorial.pdf diff --git a/pdf_viewer_build_config.pro b/pdf_viewer_build_config.pro index a09b861a4..e85817888 100644 --- a/pdf_viewer_build_config.pro +++ b/pdf_viewer_build_config.pro @@ -1,10 +1,7 @@ TEMPLATE = app TARGET = sioyek VERSION = 2.0.0 -INCLUDEPATH += ./pdf_viewer\ - mupdf/include \ - zlib - +INCLUDEPATH += ./pdf_viewer QT += core opengl gui widgets network 3dinput @@ -76,6 +73,7 @@ SOURCES += pdf_viewer/book.cpp \ win32{ + INCLUDEPATH += mupdf/include zlib DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE RC_ICONS = pdf_viewer\icon2.ico LIBS += -Lmupdf\platform\win32\x64\Release -llibmupdf -Lzlib -lzlib @@ -88,8 +86,11 @@ unix:!mac { QMAKE_CXXFLAGS += -std=c++17 CONFIG(linux_app_image){ + INCLUDEPATH += mupdf/include zlib LIBS += -ldl -Lmupdf/build/release -lmupdf -lmupdf-third -lmupdf-threads -lharfbuzz -lz - } else { + } + else { + # We use mupdf and zlib provided by the system DEFINES += NON_PORTABLE DEFINES += LINUX_STANDARD_PATHS LIBS += -ldl -lmupdf -lmupdf-third -lgumbo -lharfbuzz -lfreetype -ljbig2dec -ljpeg -lmujs -lopenjp2 -lz @@ -108,21 +109,22 @@ unix:!mac { tutorial.files = tutorial.pdf tutorial.path = $$PREFIX/share/sioyek/ keys.files = pdf_viewer/keys.config - keys.path = $$PREFIX/etc/sioyek + keys.path = /etc/sioyek prefs.files = pdf_viewer/prefs.config - prefs.path = $$PREFIX/etc/sioyek + prefs.path = /etc/sioyek INSTALLS += target INSTALLS += shortcutfiles INSTALLS += icon INSTALLS += shaders INSTALLS += tutorial INSTALLS += keys - INSTALLS += prefs + INSTALLS += prefs DISTFILES += resources/sioyek.desktop\ resources/sioyek-icon-linux.png } mac { + INCLUDEPATH += mupdf/include zlib QMAKE_CXXFLAGS += -std=c++17 LIBS += -ldl -Lmupdf/build/release -lmupdf -lmupdf-third -lmupdf-threads -lz CONFIG+=sdk_no_version_check