recipes: db/*: Upgraded
[dragora.git] / recipes / db / tzdb / recipe
blob645c7fc9509993d0274460f16f5c9bb30ea5eba9
1 # Build recipe for tzdb.
3 # Copyright (c) 2017-2022 Matias Fonzo, <selk@dragora.org>.
4 # Copyright (c) 2018 Mateus P. Rodrigues, <mprodrigues@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=tzdb
22 version=2022g
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=db
28 tarname=${program}-${version}.tar.lz
30 # Remote source(s)
31 fetch=https://data.iana.org/time-zones/releases/$tarname
33 description="
34 Time zone database.
36 The Time Zone Database (often called tz or zoneinfo) contains code and
37 data that represent the history of local time for many representative
38 locations around the globe.  It is updated periodically to reflect
39 changes made by political bodies to time zone boundaries, UTC offsets,
40 and daylight-saving rules.  Its management procedure is documented in
41 BCP 175: Procedures for Maintaining the Time Zone Database.
44 homepage=https://www.iana.org/time-zones
45 license="Public domain | BSD"
47 # Source documentation
48 docs="CONTRIBUTING LICENSE NEWS README"
49 docsdir="${docdir}/${program}-${version}"
51 # Force parallel jobs to '1'
52 jobs=1
54 build()
56     unpack "${tardir}/$tarname"
58     cd "$srcdir"
60     # Set sane permissions
61     chmod -R u+w,go-w,a+rX-s .
63     make -j${jobs} CPPFLAGS="$QICPPFLAGS" \
64      CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
65      TOPDIR=/ \
66      TZDIR=/etc/zoneinfo \
67      ETCDIR=/usr/sbin \
68      LIBDIR=/usr/lib${libSuffix} \
69      MANDIR=$mandir \
70      KSHELL="/bin/sh -" \
71      DESTDIR="$destdir" install
73     # 1. We do not offer 'tzselect'.
74     # 2. To set default localtime.
75     # 3. To be linked via post-install.
76     rm -f \
77      "${destdir}/usr/bin/tzselect" \
78      "${destdir}/etc/localtime" \
79      "${destdir}/etc/zoneinfo-posix"
81     # Create .nograft to copy via post-installation the time zone files
82     # instead of being linked to the package directory; this is to ensure
83     # that the database is always up to date after a package update.  :-)
85     find "${destdir}"/etc/zoneinfo* -type d -print | \
86      while read -r directory
87      do
88          ( cd -- "$directory" && touch .nograft )
89      done
91     # Compress and link man pages (if needed)
92     if test -d "${destdir}/$mandir"
93     then
94         (
95             cd "${destdir}/$mandir"
96             find . -type f -exec lzip -9 {} +
97             find . -type l | while read -r file
98             do
99                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
100                 rm -- "$file"
101             done
102         )
103     fi
105     # Copy documentation
106     mkdir -p "${destdir}/$docsdir"
107     cp -p $docs "${destdir}/$docsdir"