This project (on GitLab, GitHub) is my take on setting up JHBuild on macOS in order to build GTK-based apps. It is inspired by and uses components of gtk-osx, but deviates from it in a few significant ways:
-
It uses a FSH-inspired directory layout.
-
It is fully self-contained to its directories, allowing for co-existence of multiple installations in locations of your choosing.
-
It uses a relocatable Python.framework to bootstrap itself until it can build its own Python to become self-sufficient.
Make sure the following prerequisites are met:
-
A clean environment is key. This is the most inconvenient requirement as it will likely conflict with how you are currently using your Mac, but it is vital.
- Software and libraries - usually installed via package managers like Homebrew, MacPorts, Fink etc. - are known to cause problems depending on installation prefix. You cannot have software installed in the following locations:
/usr/local/opt/homebrew/opt/local
- Uninstall Xquartz.
- Undo any customizations in dotfiles like
.profile,.bashrcetc. that interfere with the environment.- If in doubt, use a dedicated user account instead.
- Software and libraries - usually installed via package managers like Homebrew, MacPorts, Fink etc. - are known to cause problems depending on installation prefix. You cannot have software installed in the following locations:
-
There are version recommendations based on known working setups.
- macOS >= 11
- Xcode >= 13
- macOS SDK 11.3 (from Xcode 13.0)
-
An internet connection is required to download all the packages.
-
Clone the latest version of this repository.
git clone https://github.com/dehesselle/jhb cd jhb # checkout tag with highest version number git checkout $(git tag | grep "^v" | sort -V | tail -1) # pull in submodules git submodule update --init --recursive
-
💁 This is an optional step. You are encouraged to skip this!
By default we're going to use/Users/Shared/work(seedirectories.sh) to build and install everything as that is a user-independent but user-writable location present on every macOS installation. If you're not comfortable with that, run e.g.export WRK_DIR=$HOME/my_custom_location
-
Bootstrap JHBuild by running the following command.
usr/bin/bootstrap
This is the equivalent to gtk-osx's
jhbuild bootstrap-gtk-osx, i.e. build and install all the modules fromboostrap.modules. A few additional modules will be built as well (seejhb.modules) to make life easier on macOS.Depending on wether you've skipped step 2 or not, the bootstrapping process will either download and extract an archive containing everything pre-built (and you're done in a minute) or start to build everything from source (this will take a while).
-
Install your own module sets (
*.modules). It is important that you keep them all together in a dedicated directory (including apatchessubdirectory if any local patches are being used) as that whole directory is going to be copied to your bootstrapped jhb.# specify your main file here usr/bin/jhb configure $HOME/my_modulesets/my_main_set.modules
This is not theoretical work but the result of refactoring and outsourcing parts of Inkscape's build pipeline so it can be reused to build other GTK-based apps on macOS. Here you can see this being used in production:
- Inkscape: see inkscape-ci-macos
- Siril: see siril_macos
- Meld: see meld_macos
- Rnote: see rnote_macos
The jhb logo uses modified versions of
- a construction sign, licensed under CC0-1.0
- the GTK logo from Andreas Nilsen, licensed under CC-BY-SA-3.0
