Skip to content

Instantly share code, notes, and snippets.

@FliiFe
Last active April 27, 2024 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FliiFe/9c058bee1b7cfedad6c724fd3e337851 to your computer and use it in GitHub Desktop.
Save FliiFe/9c058bee1b7cfedad6c724fd3e337851 to your computer and use it in GitHub Desktop.
An almost self-contained bash script that builds sioyek from scratch
#!/usr/bin/env bash
COLOR='\033[1;32m'
NC='\033[0m' # No Color
log() {
echo -e "${COLOR}#" $@ "${NC}"
}
WD=$(mktemp -d)
log "Working in: $WD"
cd $WD
log "Install dependencies"
brew install --quiet freeglut mesa harfbuzz openssl
log "Cloning source code"
git clone --quiet -b development --recurse-submodules -j8 https://github.com/ahrm/sioyek.git .
TARGET=$(sw_vers -productVersion | cut -d. -f1)
log "macOS target: $TARGET"
log "Modifying build script to use new target"
sed -Ei '' "s/QMAKE_MACOSX_DEPLOYMENT_TARGET.=.[0-9]+/QMAKE_MACOSX_DEPLOYMENT_TARGET = $TARGET/" pdf_viewer_build_config.pro
log "Making python virtual environment in directory venv"
python3 -m venv venv
source venv/bin/activate
log "Installing aqtinstall"
pip install aqtinstall
log "Installing qt 6.6.1 with all modules"
aqt install-qt mac desktop 6.6.1 clang_64 -m all
log "Deactivating venv"
deactivate
log "Defining QT-related environment variables"
export Qt6_DIR=$PWD/6.6.1/macos/
export QT_PLUGIN_PATH=$PWD/6.6.1/macos/plugins
export PKG_CONFIG_PATH=$PWD/6.6.1/macos/lib/pkgconfig
export QML2_IMPORT_PATH=$PWD/6.6.1/macos/qml
export PATH="$PWD/6.6.1/macos/bin:$PATH"
THREADS=$(sysctl -n hw.ncpu)
log "Starting the building process with $THREADS parallel threads"
env MAKE_PARALLEL=$THREADS ./build_mac.sh
log "Extracting build artifact into /tmp/sioyek.app"
mv build/sioyek.app /tmp/sioyek.app
log "Signing app package"
sudo codesign --force --sign - --deep /tmp/sioyek.app
log "Remove all source code and intermediary objects"
cd /tmp
rm -rf $WD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment