Last active
July 30, 2024 18:55
-
-
Save chergert/7db3cafc4bbc909d52ce773686bc456e to your computer and use it in GitHub Desktop.
install gtk4 macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## NOTE ## | |
If you just need to build, and you don't need to hack on GTK 4 itself, you can | |
probably just use brew. That is the simplest and fastest way to get started. | |
``` | |
brew install gtk4 | |
``` | |
At that point, /usr/local/bin/gtk4-demo is there, and all the others. | |
/usr/local/lib/girepository-1.0 has all the typelibs. | |
Otherwise, ... its a bit more involved if you dont want to use anything to bootstrap like jhbuild or brew. | |
# Where we will install to | |
export INSTALL_PREFIX=$HOME/.local | |
# Make sure we have access to your python script dir | |
export PATH="$INSTALL_PREFIX/bin:$HOME/Library/Python/3.8/bin:$PATH" | |
# Clone repos | |
git clone https://gitlab.gnome.org/GNOME/gtk.git | |
git clone https://gitlab.gnome.org/GNOME/gobject-introspection.git | |
git clone https://github.com/pkgconf/pkgconf.git | |
# Install Python3 from python.org for Mac OS, unless you have a Python | |
# install already with headers available. This is needed for the | |
# gobject-introspection scanner which links against python using | |
# the venerable Python.h. | |
https://www.python.org/ftp/python/3.9.1/python-3.9.1-macosx10.9.pkg | |
# Install python build deps | |
pip3 install --user ninja | |
pip3 install --user meson=0.56 | |
pip3 install --user pygments | |
# Install pkgconf (which has replaced pkg-config in most places) | |
cd pkgconf | |
meson _build \ | |
--prefix=$INSTALL_PREFIX \ | |
--libdir=lib \ | |
-Dtests=false | |
cd _build | |
ninja install | |
ln -s $INSTALL_ROOT/bin/pkgconf $INSTALL_ROOT/bin/pkg-config | |
cd ../.. | |
# Build GTK w/ introspection disabled (until build integration is fixed) | |
cd gtk | |
meson _build \ | |
--prefix=$INSTALL_PREFIX \ | |
--libdir=lib \ | |
-Dcpp_std=c++11 \ | |
-Dintrospection=disabled \ | |
-Dharfbuzz:coretext=disabled \ | |
-Dpixman:tests=disabled \ | |
-Dx11-backend=false | |
cd _build | |
ninja install | |
cd ../.. | |
# Note, to get fontconfig to install correctly, i had to change the order of the | |
# FileExistsError to be above OSError in the fontconfig install python script?!? | |
# Bison on macOS is not new enough, so it gets scanner errors | |
curl -o http://ftp.wayne.edu/gnu/bison/bison-3.7.tar.xz | |
tar xf bison-3.7.tar.xz | |
cd bison-3.7 | |
./configure --prefix=$INSTALL_PREFIX | |
make install | |
cd .. | |
# Now build G-I manually into same prefix. pkgconf/meson seem to hide our | |
# installation include prefix to be less spammy, but that breaks ffi.h | |
# includes here! override with CFLAGS cause blah | |
cd gobject-introspection | |
CFLAGS="-I$INSTALL_PREFIX/include" meson _build \ | |
--prefix=$INSTALL_PREFIX \ | |
--libdir=lib | |
cd _build | |
ninja install | |
cd ../.. | |
# Now rebuild GTK w/ introspection enabled | |
cd gtk/_build | |
meson configure -Dintrospection=enabled | |
ninja install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment