1SUMMARY="A multi-platform toolkit for creating graphical user interfaces"
2DESCRIPTION="GTK is a multi-platform toolkit for creating graphical user \
3interfaces. Offering a complete set of widgets, GTK is suitable for projects \
4ranging from small one-off projects to complete application suites."
5HOMEPAGE="https://www.gtk.org"
6COPYRIGHT="GNOME Desktop"
7LICENSE="GNU LGPL v2"
8REVISION="1"
9SOURCE_URI="https://ftp.gnome.org/pub/gnome/sources/gtk+/3.24/gtk+-$portVersion.tar.xz"
10CHECKSUM_SHA256="27a6ef157743350c807ffea59baa1d70226dbede82a5e953ffd58ea6059fe691"
11SOURCE_DIR="gtk+-$portVersion"
12SOURCE_URI_2="https://github.com/lah7/gtk3-classic/archive/refs/tags/$portVersion.tar.gz"
13CHECKSUM_SHA256_2="38b804f6079aa9f37fd747bb02cf0f31a9694dde276c263dd9f69c3700afd5f9"
14SOURCE_DIR_2="gtk3-classic-$portVersion"
15PATCHES="gtk3-$portVersion.patchset"
16PATCHES_2="gtk3-classic-$portVersion.patchset"
17ADDITIONAL_FILES="compile-schemas.sh"
18
19ARCHITECTURES="all !x86_gcc2"
20SECONDARY_ARCHITECTURES="x86"
21
22GLOBAL_WRITABLE_FILES="
23	settings/gtk-3.0/im-multipress.conf keep-old
24	"
25
26POST_INSTALL_SCRIPTS="
27	$relativePostInstallDir/compile-schemas.sh
28	"
29
30commandSuffix=$secondaryArchSuffix
31commandBinDir=$binDir
32if [ "$targetArchitecture" = x86_gcc2 ]; then
33	commandSuffix=
34	commandBinDir=$prefix/bin
35fi
36
37PROVIDES="
38	gtk3$secondaryArchSuffix = $portVersion compat >= 3
39	cmd:gtk_builder_tool$commandSuffix
40	cmd:gtk_encode_symbolic_svg$commandSuffix
41	cmd:gtk_launch$commandSuffix
42	cmd:gtk_query_immodules_3.0$commandSuffix
43	cmd:gtk_query_settings$commandSuffix
44	cmd:gtk_update_icon_cache$commandSuffix
45	cmd:gtk3_demo_application$commandSuffix
46	cmd:gtk3_demo$commandSuffix
47	cmd:gtk3_icon_browser$commandSuffix
48	cmd:gtk3_widget_factory$commandSuffix
49	lib:libgailutil_3$secondaryArchSuffix = 0.0.0 compat >= 0
50	lib:libgdk_3$secondaryArchSuffix = 3.2404.30 compat >= 3
51	lib:libgtk_3$secondaryArchSuffix = 3.2404.30 compat >= 3
52	"
53REQUIRES="
54	haiku$secondaryArchSuffix
55	adwaita_icon_theme
56	haiku_svg_icon_theme
57	iso_codes
58	gsettings_desktop_schemas$secondaryArchSuffix
59	shared_mime_info$secondaryArchSuffix
60	lib:libatk_1.0$secondaryArchSuffix
61	lib:libcairo$secondaryArchSuffix
62	lib:libcairo_gobject$secondaryArchSuffix
63	lib:libepoxy$secondaryArchSuffix
64	lib:libfontconfig$secondaryArchSuffix
65	lib:libfreetype$secondaryArchSuffix
66	lib:libfribidi$secondaryArchSuffix
67	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
68	lib:libgirepository_1.0$secondaryArchSuffix
69	lib:libglib_2.0$secondaryArchSuffix
70	lib:libGL$secondaryArchSuffix
71	lib:libharfbuzz$secondaryArchSuffix
72	lib:libharfbuzz_gobject$secondaryArchSuffix
73	lib:libiconv$secondaryArchSuffix
74	lib:libintl$secondaryArchSuffix
75	lib:libpango_1.0$secondaryArchSuffix
76	lib:libpangocairo_1.0$secondaryArchSuffix
77	lib:libpangoft2_1.0$secondaryArchSuffix
78	lib:librsvg_2$secondaryArchSuffix
79	lib:libwayland_client$secondaryArchSuffix
80	lib:libwayland_server$secondaryArchSuffix
81	lib:libxkbcommon$secondaryArchSuffix
82	lib:libz$secondaryArchSuffix
83	lib:wayland_server_inproc$secondaryArchSuffix
84	"
85
86PROVIDES_devel="
87	gtk3${secondaryArchSuffix}_devel
88	devel:libgailutil_3$secondaryArchSuffix = 0.0.0 compat >= 0
89	devel:libgtk_3$secondaryArchSuffix = 3.2404.30 compat >= 3
90	devel:libgdk_3$secondaryArchSuffix = 3.2404.30 compat >= 3
91	"
92REQUIRES_devel="
93	gtk3$secondaryArchSuffix == $portVersion base
94	devel:libatk_1.0$secondaryArchSuffix
95	devel:libcairo$secondaryArchSuffix
96	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
97	devel:libgirepository_1.0$secondaryArchSuffix
98	devel:libGL$secondaryArchSuffix
99	devel:libglib_2.0$secondaryArchSuffix
100	devel:libepoxy$secondaryArchSuffix
101	devel:libpango_1.0$secondaryArchSuffix
102	devel:libwayland_client$secondaryArchSuffix
103	devel:libwayland_server$secondaryArchSuffix
104	devel:libxkbcommon$secondaryArchSuffix
105	devel:libz$secondaryArchSuffix
106	"
107
108BUILD_REQUIRES="
109	haiku${secondaryArchSuffix}_devel
110	harfbuzz${secondaryArchSuffix}_glib
111	iso_codes
112	wayland_protocols
113	devel:libatk_1.0$secondaryArchSuffix
114	devel:libcairo$secondaryArchSuffix
115	devel:libGL$secondaryArchSuffix
116	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
117	devel:libgirepository_1.0$secondaryArchSuffix
118	devel:libglib_2.0$secondaryArchSuffix
119	devel:libharfbuzz_gobject$secondaryArchSuffix
120	devel:libepoxy$secondaryArchSuffix
121	devel:libpango_1.0$secondaryArchSuffix
122	devel:libwayland_client$secondaryArchSuffix
123	devel:libwayland_server$secondaryArchSuffix
124	devel:libxkbcommon$secondaryArchSuffix
125	devel:libz$secondaryArchSuffix
126	"
127BUILD_PREREQUIRES="
128	cmd:gcc$secondaryArchSuffix
129	cmd:glib_compile_schemas
130	cmd:ld$secondaryArchSuffix
131	cmd:meson
132	cmd:ninja
133	cmd:patch
134	cmd:pkg_config$secondaryArchSuffix
135	cmd:wayland_scanner
136	cmd:which
137	cmd:update_mime_database$secondaryArchSuffix
138	"
139
140PATCH()
141{
142	cd $sourceDir
143	for file in $sourceDir2/*.patch; do patch -p1 < $file; done
144}
145
146BUILD()
147{
148	CFLAGS="-D_BSD_SOURCE" \
149	LDFLAGS="-lbsd -lgnu -lnetwork" \
150	meson Build \
151		--buildtype=release \
152		--prefix="$prefix" \
153		--libdir="$libDir" \
154		--includedir="$includeDir" \
155		--bindir="$commandBinDir" \
156		--libexecdir="$commandBinDir" \
157		--datadir="$dataDir" \
158		--localedir="$dataDir/locale" \
159		--sysconfdir="$settingsDir" \
160		-Dx11_backend=false \
161		-Dwayland_backend=true \
162		-Dbroadway_backend=false \
163		-Dintrospection=true
164
165	ninja -C Build
166}
167
168INSTALL()
169{
170	ninja install -C Build
171
172	rm -rf $dataDir/glib-2.0/schemas/gschemas.compiled
173	rm -rf $dataDir/icons/hicolor/icon-theme.cache
174
175	mkdir -p $postInstallDir
176	cp -f $portDir/additional-files/compile-schemas.sh $postInstallDir
177	chmod -v a+rx $postInstallDir/compile-schemas.sh
178
179	fixPkgconfig
180	prepareInstalledDevelLibs \
181		libgdk-3 \
182		libgtk-3 \
183		libgailutil-3
184
185	packageEntries devel \
186		$developDir
187}
188