recipes: Honor CPPFLAGS (through QICPPFLAGS) whenever is possible
[dragora.git] / recipes / x-libs / gtk3 / recipe
blob5879601640b75b21d640120bfe14a3f31c2075f7
1 # Build recipe for GTK+3.
3 # Copyright (C) 2018, MMPG <mmpg@vp.pl>
4 # Copyright (C) 2018-2019, 2021 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 #    http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Exit immediately on any error
19 set -e
21 program=gtk+
22 version=3.24.24
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=x-libs
28 # Difference package name with other series
29 pkgname=gtk3
31 tarname=${program}-${version}.tar.xz
33 # Remote source(s)
34 fetch="
35   http://ftp.gnome.org/pub/gnome/sources/gtk+/${version%.*}/$tarname
36   ftp://ftp.acc.umu.se/pub/gnome/sources/gtk+/${version%.*}/$tarname
39 description="
40 The version 3 of the GTK+ toolkit.
42 The GTK+3 package contains libraries used for creating graphical user
43 interfaces for applications.
46 homepage=http://www.gtk.org
47 license=GPLv2+
49 # Copy documentation
50 docs="AUTHORS COPYING NEWS README* HACKING"
51 docsdir="${docdir}/${pkgname}-${version}"
53 build()
55     unpack "${tardir}/$tarname"
57     cd "$srcdir"
59     # Set sane permissions
60     chmod -R u+w,go-w,a+rX-s .
62     mkdir BUILD
63     cd BUILD
65     # TODO: cups: -Dprint_backends="file,lpr,cups"
67     CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
68     meson setup $configure_args \
69      --libdir=lib${libSuffix} \
70      --mandir=$mandir \
71      --buildtype=release \
72      --strip \
73      -Dcolord=no \
74      -Dgtk_doc=false \
75      -Dman=true \
76      -Dx11_backend=true \
77      -Dbroadway_backend=true \
78      -Dwayland_backend=false \
79      -Dxinerama=yes \
80      ..
82     ninja -j${jobs}
83     DESTDIR="$destdir" ninja -j${jobs} install
85     cd ..
87     # Add a basic configuration
88 cat << EOF > "${destdir}/etc/gtk-3.0/gtkrc"
89 gtk-theme-name = "gnome"
91 EOF
93     # Manage dot new file(s) via graft(8)
94     touch "${destdir}/etc/gtk-3.0/.graft-config"
96     # Compress and link man pages (if needed)
97     if test -d "${destdir}/$mandir"
98     then
99         (
100             cd "${destdir}/$mandir"
101             find . -type f -exec lzip -9 {} +
102             find . -type l | while read -r file
103             do
104                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
105                 rm -- "$file"
106             done
107         )
108     fi
110     # Copy documentation
111     mkdir -p "${destdir}${docsdir}"
112     cp -p $docs "${destdir}${docsdir}"