### this file is sourced not run
PKGVER=3.24.42
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 11.3 updated to r12.1-1099 
TARBALL=gtk+-$PKGVER.tar.xz
MD5SUM=78327e792d50d98e450791387b5c5a08
SRC_URL=https://download.gnome.org/sources/gtk+/3.24/$TARBALL
BUNDLE=

SLACKREQ='at-spi2-core gdk-pixbuf libepoxy pango cups libxkbcommon libwayland'
SLACKDESC="gtk3: gtk3 $PKGVER (GTK GUI Toolkit)
gtk3:  
gtk3: The GTK+ 3 package contains libraries used for creating graphical user 
gtk3: interfaces for applications. 
gtk3: 
gtk3: This is version 3 of the library. It is not compatible with GTK2, but
gtk3: it can be installed side-by-side with it.
gtk3: 
gtk3: This package includes support for the wayland backend.
gtk3: 
gtk3:
"
SLACKINSTALL='glib-compile-schemas ./usr/share/glib-2.0/schemas'
SLACKUNINSTALL='glib-compile-schemas ./usr/share/glib-2.0/schemas'

DEBUG= # yes to enable debug

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/gtk+* &&
	sed -i '/sort-directories-first/{n;s/false/true/;}' gtk/org.gtk.Settings.FileChooser.gschema.xml &&
	true
}

### default pkg_package
### build
pkg_build() {
	export CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CAST_CHECKS"
	# we want -g permanently, -O0 when debugging
	CFLAGS="$CFLAGS -g"
	[ $DEBUG ] && CFLAGS="$CFLAGS -O0"
	
	MESONFLAGS="$MESONFLAGS     \
		-Dman=true              \
		-Dbroadway_backend=true \
		-Dtests=false           \
		-Dinstalled_tests=false \
		-Dexamples=false        \
		-Dgtk_doc=true          \
	"
	pkg_build_meson &&
	pkg_build_slackdesc &&
	rm -f /usr/share/glib-2.0/schemas/gschemas.compiled &&
	
	# gtk2 compat
	mv /usr/bin/gtk{,3}-update-icon-cache &&
	mv /usr/share/man/man1/gtk{,3}-update-icon-cache.1 &&

	# remove cache
	rm -f /usr/share/icons/*/icon-theme.cache &&

	# multilib
	mv -v /usr/bin/gtk-query-immodules-3.0{,-64} &&
	ln -sfv multiarch_wrapper /usr/bin/gtk-query-immodules-3.0 &&
	mv -v /usr/share/gir-1.0/* /usr/share/gir-1.0-64 &&
	rm -r /usr/share/gir-1.0/ &&

	# keep debug symbols in devx
	cd /usr/$LIBDIR &&
	for LIB in \
		libgdk-3.so.0.2410.32   \
		libgailutil-3.so.0.0.0  \
		libgtk-3.so.0.2410.32;
	do
		objcopy --only-keep-debug $LIB $LIB.dbg &&
		strip --strip-unneeded $LIB &&
		objcopy --add-gnu-debuglink=$LIB.dbg $LIB || return 1
	done

<< "INFO-ONLY"

Configuration Information

GTK+ 3 themes change the way a GTK+ 3 application looks. 
An icon theme can be used to change the icons that appear on the application's toolbar. 
If you have installed a GTK+ 3 theme (eg gnome-themes-standard-3.18.0), 
an icon theme (such as oxygen-icons-15.04.3) and/or a font 
(such as DejaVu fonts), you can set your prefences in ~/.config/gtk-3.0/settings.ini 
or the default system wide configuration file (as the root user), in /etc/gtk-3.0/settings.ini

mkdir -p /etc/gtk-3.0
> /etc/gtk-3.0/settings.ini cat << "EOF"
[Settings]
gtk-theme-name = Adwaita
gtk-icon-theme-name = oxygen
gtk-font-name = DejaVu Sans 12
gtk-cursor-theme-size = 18
gtk-toolbar-style = GTK_TOOLBAR_BOTH_HORIZ
gtk-xft-antialias = 1
gtk-xft-hinting = 1
gtk-xft-hintstyle = hintslight
gtk-xft-rgba = rgb
gtk-cursor-theme-name = Adwaita
EOF

There are many settings keys, some with default values. 
You can find them at Settings: GTK+ 3 Reference Manual https://developer.gnome.org/gtk3/stable/GtkSettings.html
There are many more themes available at https://www.gnome-look.org/browse/ and other places.

 As part of GTK+-3.0's redesign, the scroll bar buttons are no longer visible on the scrollbar in many applications. If this functionality is desired, modify the gtk.css file and restore them using the following command:

cat > ~/.config/gtk-3.0/gtk.css << "EOF"
*  {
   -GtkScrollbar-has-backward-stepper: 1;
   -GtkScrollbar-has-forward-stepper: 1;
}
EOF

INFO-ONLY
}

