Skip to content

Commit

Permalink
New build scripts for linux
Browse files Browse the repository at this point in the history
Allow either portable build or local build, and clearly document the
two.
  • Loading branch information
raffaem committed Dec 1, 2022
1 parent 415d00a commit 38fc19b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,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)
Expand Down
54 changes: 41 additions & 13 deletions build_linux.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#!/usr/bin/env bash

if [ -z $1 ];
then
echo "Call with 'local' for a local build, or with 'portable' for a portable build"
exit
elif [ $1 == "local" ];
then
echo "local build"
elif [ $1 == "portable" ];
then
echo "portable build"
else
echo "Call with 'local' for a local build, or with 'portable' for a portable build"
exit
fi

# Compile mupdf
cd mupdf
make USE_SYSTEM_HARFBUZZ=yes
cd ..

# Compile sioyek
# Get qmake path
if [ -f "/usr/bin/qmake-qt5" ];
then
QMAKE="/usr/bin/qmake-qt5"
Expand All @@ -16,16 +31,29 @@ 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 [ $1 == "local" ];
then
$QMAKE pdf_viewer_build_config.pro
make
sudo make install
elif [ $1 == "portable" ];
then
$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 -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
6 changes: 2 additions & 4 deletions pdf_viewer_build_config.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
TEMPLATE = app
TARGET = sioyek
VERSION = 1.5.0
INCLUDEPATH += ./pdf_viewer\
mupdf/include \
zlib

INCLUDEPATH += ./pdf_viewer

QT += core opengl gui widgets network 3dinput openglextensions
CONFIG += c++17
Expand Down Expand Up @@ -78,6 +75,7 @@ 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 {
DEFINES += NON_PORTABLE
Expand Down

0 comments on commit 38fc19b

Please sign in to comment.