gettext-tiny upgraded to snapshot ece94b7
[dragora.git] / recipes / tools / gettext-tiny / recipe
blob90d0441beb3d36a1ac4b94c35bc7dad743c7be25
1 # Build recipe for gettext-tiny.
3 # Copyright (c) 2018-2019 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 program=gettext-tiny
18 version=ece94b7de3f051a4a417599f1cbf1e5cb6bfbb74
19 pkgversion=ece94b7
20 release=1
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/tools"
25 tarname=${program}-${version}.tar.lz
27 # Remote source(s)
28 fetch=http://rsync.dragora.org/current/sources/$tarname
30 description="
31 An internationalisation and localisation system.
33 gettext-tiny provides lightweight replacements for tools typically used
34 from the GNU gettext suite, which is incredibly bloated and takes a lot
35 of time to build (in the order of an hour on slow devices).  The most
36 notable component is msgfmt which is used to create binary translation
37 files in the .mo format out of textual input files in .po format.
38 This is the most important tool for building software from source,
39 because it is used from the build processes of many software packages.
41 The gettext-tiny package is compatible with the Musl C Library.
44 homepage=http://github.com/sabotage-linux/gettext-tiny/
45 license=MIT
47 # Source documentation
48 docs="LICENSE README.md"
49 docsdir="${docdir}/${program}-${pkgversion}"
51 # Limit paralell jobs to '1'
52 jobs=1
54 build()
56     set -e
58     unpack "${tardir}/$tarname"
60     cd "$srcdir"
62     # Set sane permissions
63     chmod -R u+w,go-w,a+rX-s .
65     # Do not force to some tools to be static
66     sed -i 's/-static//g' Makefile
68     make -j${jobs} LIBINTL=MUSL \
69      CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
70      prefix=/usr libdir=/usr/lib${libSuffix} \
71      DESTDIR="$destdir" install
73     strip --strip-unneeded "${destdir}/usr/bin"/* 2> /dev/null || true;
74     strip --strip-debug "${destdir}/usr/lib${libSuffix}/libintl.a"
76     # Introduce our custom version of 'autopoint' which
77     # works well under busybox's ash, mksh shells.
79     cp -p "${worktree}/archive/gettext-tiny/autopoint" \
80           "${destdir}/usr/bin/"
81     chmod 755 "${destdir}/usr/bin/autopoint"
83     # Compress and link man pages (if needed)
84     if test -d "${destdir}/$mandir"
85     then
86         (
87             cd "${destdir}/$mandir"
88             find . -type f -exec lzip -9 '{}' +
89             find . -type l | while read -r file
90             do
91                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
92                 rm -- "$file"
93             done
94         )
95     fi
97     # Copy documentation
98     mkdir -p "${destdir}${docsdir}"
99     cp -p $docs "${destdir}${docsdir}"/