recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / libs / glib2 / recipe
blobbe53878536db61d754fe4f0b9df9d9361fe95702
1 # Build recipe for glib (release 2).
3 # Copyright (c) 2017-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=glib
21 version=2.70.2
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=libs
27 # Set a custom name for this package
28 pkgname=glib2
30 # The installation of this package replaces to
31 replace=glib2-pass1
33 tarname=${program}-${version}.tar.xz
35 # Remote source(s)
36 fetch="https://download.gnome.org/sources/glib/${version%.*}/$tarname"
38 description="
39 General purpose library of C routines.
41 GLib is the low-level core library that forms the basis for projects
42 such as GTK+ and GNOME.  It provides data structure handling for C,
43 portability wrappers, and interfaces for such runtime functionality
44 as an event loop, threads, dynamic loading, and an object system.
47 homepage=https://wiki.gnome.org/Projects/GLib
48 license=LGPLv2.1
50 # Source documentation
51 docs="AUTHORS COPYING HACKING NEWS README"
52 docsdir="${docdir}/${pkgname}-${version}"
54 build()
56     unpack "${tardir}/$tarname"
58     cd "$srcdir"
60     # Apply patch from "Beyond Linux From Scratch" to support 'GLIB_LOG_LEVEL'
61     # which enables several warnings levels (Thank you!)
62     patch -Np1 -i "${worktree}/patches/glib2/glib-2.70.2-skip_warnings-1.patch"
64     # Set sane permissions
65     chmod -R u+w,go-w,a+rX-s .
67     rm -rf BUILD
68     mkdir BUILD
69     cd BUILD
71     CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
72     meson setup $configure_args \
73      --libdir /usr/lib${libSuffix} \
74      --buildtype=release \
75      --strip \
76      -Diconv=auto \
77      -Dxattr=true \
78      -Dlibmount=enabled \
79      -Dman=true \
80      -Dgtk_doc=false \
81      -Dfam=false \
82      -Dselinux=disabled \
83      ..
85     ninja -j${jobs}
86     DESTDIR="$destdir" ninja -j${jobs} install
88     cd ..
90     # Delete generated charset.alias
91     rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
93     # Include profile file
94     mkdir -p "${destdir}/etc/profile.d"
95     cp -p "${worktree}/archive/glib2/etc/profile.d/glib2.sh" \
96            "${destdir}/etc/profile.d/"
97     chmod 644 "${destdir}/etc/profile.d/glib2.sh"
99     # To handle config file(s)
100     touch "${destdir}/etc/profile.d/.graft-config"
102     # Compress and link man pages (if needed)
103     if test -d "${destdir}/$mandir"
104     then
105         (
106             cd "${destdir}/$mandir"
107             find . -type f -exec lzip -9 {} +
108             find . -type l | while read -r file
109             do
110                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
111                 rm -- "$file"
112             done
113         )
114     fi
116     # Copy documentation
117     mkdir -p "${destdir}/$docsdir"
118     cp -p $docs "${destdir}/$docsdir"