1 # Build recipe for bzip2.
3 # Copyright (c) 2016-2018 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.
21 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/compressors"
24 tarname=${program}-${version}.tar.gz
28 http://mirror.fsf.org/dragora/v3/sources/$tarname
29 http://www.bzip.org/${version}/$tarname
33 A high-quality data compressor program.
35 Bzip2 is a high quality compressor that uses the best compression
36 techniques (from the PPM family of statistical compressors).
37 In general, the compression is considerabily better than other
38 compressors, based on LZ77/LZ78 algorithm.
40 The author of bzip2 is Julian Seward.
43 homepage=http://www.bzip.org
46 # Source documentation
47 docs="CHANGES LICENSE README"
48 docsdir="${docdir}/${program}-${version}"
54 unpack "${tardir}/$tarname"
58 # Set sane permissions
59 chmod -R u+w,go-w,a+rX-s .
61 # Apply a patch to install the documentation (thanks to LFS)
62 patch -Np1 -i "${worktree}/patches/bzip2/bzip2-1.0.6-install_docs-1.patch"
64 # Ensure installation of relative symbolic links (thanks to LFS)
65 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
67 # Ensure the man pages are installed into the correct location
68 sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
70 # Ensure location for libraries
71 sed -i "s@(PREFIX)/lib@(PREFIX)/lib${libSuffix}@g" Makefile
75 # Provide shared libraries for third party programs
76 make -f Makefile-libbz2_so
79 # Recompile program for static linking
80 make LDFLAGS="$QILDFLAGS -static"
81 make PREFIX="${destdir}/usr" install
83 # Copy shared libraries into package destination
84 cp -f -p libbz2.so* "${destdir}/usr/lib${libSuffix}"
87 strip -s "${destdir}/usr/lib${libSuffix}/libbz2.so.1.0.6"
89 # Make soft links providing compatibility
91 cd "${destdir}/usr/lib${libSuffix}" || exit 1
92 ln -sf libbz2.so.1.0.6 libbz2.so.1.0
93 ln -sf libbz2.so.1.0.6 libbz2.so
96 # Compress and link man pages (if needed)
97 if test -d "${destdir}/$mandir"
100 cd "${destdir}/$mandir"
101 find . -type f -exec lzip -9 '{}' +
102 find . -type l | while read -r file
104 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
110 # Copy the rest of the documentation
111 mkdir -p "${destdir}${docsdir}"
115 cp -p $file "${destdir}${docsdir}"