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