recipes: x-libs/gtk2: make GTK+-2 more stable
[dragora.git] / recipes / x-libs / gtk2 / recipe
blob6f31c816b7593bced8312d990e3a7d153363bf12
1 # Build recipe for GTK+2.
3 # Copyright (C) 2018, MMPG <mmpg@vp.pl>
4 # Copyright (C) 2018-2019 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 program=gtk+
19 version=2.24.32
20 release=4
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/x-libs"
25 # Difference package name with other series
26 pkgname=gtk2
28 tarname=${program}-${version}.tar.xz
30 # Remote source(s)
31 fetch=http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/$tarname
33 description="
34 A multi-platform toolkit for creating graphical user interfaces.
36 Offering a complete set of widgets, GTK+ is suitable for projects
37 ranging from small one-off projects to complete application suites.
40 homepage=http://www.gtk.org
41 license=GPLv2+
43 # Copy documentation
44 docs="AUTHORS COPYING NEWS README* HACKING"
45 docsdir="${docdir}/${pkgname}-${version}"
47 build()
49     set -e
50     unpack "${tardir}/$tarname"
52     cd "$srcdir"
54     # Apply patch series from Debian
55     while read -r line
56     do
57         line="$(echo $line)"
58         echo "Patching with ${worktree}/patches/gtk2/$line ..."
59         patch -Np1 -i "${worktree}/patches/gtk2/$line"
60     done < "${worktree}"/patches/gtk2/series
62     autoreconf -vif
64     # Set sane permissions
65     chmod -R u+w,go-w,a+rX-s .
67     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
68      $configure_args \
69      --libdir=/usr/lib${libSuffix} \
70      --mandir=$mandir \
71      --enable-static=no \
72      --enable-shared=yes \
73      --enable-debug=no \
74      --enable-introspection=yes \
75      --enable-xkb=yes \
76      --with-xinput=yes \
77      --disable-glibtest \
78      --build="$(cc -dumpmachine)"
80     make -j${jobs} V=1 \
81      RUN_QUERY_IMMODULES_TEST=false RUN_QUERY_LOADER_TEST=false
83     make -j${jobs} \
84      RUN_QUERY_IMMODULES_TEST=false RUN_QUERY_LOADER_TEST=false \
85      DESTDIR="$destdir" install-strip
87     # Add a basic configuration
88 cat << EOF > "${destdir}/etc/gtk-2.0/gtkrc"
89 gtk-icon-theme-name = "hicolor"
91 EOF
93     # Manage dot new file(s) via graft(8)
94     touch "${destdir}/etc/gtk-2.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}"