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.
17 # Exit immediately on any error
24 # Define a category for the output of the package name
25 pkgcategory=compressors
27 tarname=${program}-${version}.tar.gz
31 https://mirror.fsf.org/dragora/v3/sources/$tarname
32 https://www.bzip.org/${version}/$tarname
36 A high-quality data compressor program.
38 Bzip2 is a high quality compressor that uses the best compression
39 techniques (from the PPM family of statistical compressors).
40 In general, the compression is considerabily better than other
41 compressors, based on LZ77/LZ78 algorithm.
43 The author of bzip2 is Julian Seward.
46 homepage=https://www.bzip.org
49 # Source documentation
50 docs="CHANGES LICENSE README"
51 docsdir="${docdir}/${program}-${version}"
55 unpack "${tardir}/$tarname"
59 # Set sane permissions
60 chmod -R u+w,go-w,a+rX-s .
62 # Apply a patch to install the documentation (thanks to LFS)
63 patch -Np1 -i "${worktree}/patches/bzip2/bzip2-1.0.6-install_docs-1.patch"
65 # Ensure installation of relative symbolic links (thanks to LFS)
66 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
68 # Ensure the man pages are installed into the correct location
69 sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
71 # Ensure location for libraries
72 sed -i "s@(PREFIX)/lib@(PREFIX)/lib${libSuffix}@g" Makefile
76 # Provide shared libraries for third party programs
77 make -f Makefile-libbz2_so
80 # Recompile program for static linking
81 make LDFLAGS="$QILDFLAGS -static"
82 make PREFIX="${destdir}/usr" install
84 # Copy shared libraries into package destination
85 cp -f -p libbz2.so* "${destdir}/usr/lib${libSuffix}"
88 strip -s "${destdir}/usr/lib${libSuffix}/libbz2.so.1.0.6"
90 # Make soft links providing compatibility
92 cd "${destdir}/usr/lib${libSuffix}" || exit 1
93 ln -sf libbz2.so.1.0.6 libbz2.so.1.0
94 ln -sf libbz2.so.1.0.6 libbz2.so
97 # Compress and link man pages (if needed)
98 if test -d "${destdir}/$mandir"
101 cd "${destdir}/$mandir"
102 find . -type f -exec lzip -9 {} +
103 find . -type l | while read -r file
105 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
111 # Copy the rest of the documentation
112 mkdir -p "${destdir}/$docsdir"
116 cp -p $file "${destdir}/$docsdir"