Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/bzip2/
Date: Thu, 01 Dec 2022 01:39:42
Message-Id: 1669858770.90657783651efa366c78e2dfdd44e15a4f372e49.sam@gentoo
1 commit: 90657783651efa366c78e2dfdd44e15a4f372e49
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 30 16:04:15 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 01:39:30 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90657783
7
8 app-arch/bzip2: Support app-alternatives/bzip2
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11 Closes: https://github.com/gentoo/gentoo/pull/28481
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 app-arch/bzip2/bzip2-1.0.8-r4.ebuild | 135 +++++++++++++++++++++++++++++++++++
15 app-arch/bzip2/bzip2-9999.ebuild | 21 +++---
16 2 files changed, 145 insertions(+), 11 deletions(-)
17
18 diff --git a/app-arch/bzip2/bzip2-1.0.8-r4.ebuild b/app-arch/bzip2/bzip2-1.0.8-r4.ebuild
19 new file mode 100644
20 index 000000000000..3ac96e3d4ef2
21 --- /dev/null
22 +++ b/app-arch/bzip2/bzip2-1.0.8-r4.ebuild
23 @@ -0,0 +1,135 @@
24 +# Copyright 1999-2022 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +# XXX: atm, libbz2.a is always PIC :(, so it is always built quickly
28 +# (since we're building shared libs) ...
29 +
30 +EAPI=7
31 +
32 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/bzip2.gpg
33 +inherit toolchain-funcs multilib-minimal usr-ldscript verify-sig
34 +
35 +DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux"
36 +HOMEPAGE="https://sourceware.org/bzip2/"
37 +SRC_URI="https://sourceware.org/pub/${PN}/${P}.tar.gz"
38 +SRC_URI+=" verify-sig? ( https://sourceware.org/pub/${PN}/${P}.tar.gz.sig )"
39 +
40 +LICENSE="BZIP2"
41 +SLOT="0/1" # subslot = SONAME
42 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
43 +IUSE="static static-libs"
44 +
45 +BDEPEND="
46 + verify-sig? ( sec-keys/openpgp-keys-bzip2 )
47 +"
48 +PDEPEND="
49 + app-alternatives/bzip2
50 +"
51 +
52 +PATCHES=(
53 + "${FILESDIR}"/${PN}-1.0.4-makefile-CFLAGS.patch
54 + "${FILESDIR}"/${PN}-1.0.8-saneso.patch
55 + "${FILESDIR}"/${PN}-1.0.4-man-links.patch #172986
56 + "${FILESDIR}"/${PN}-1.0.6-progress.patch
57 + "${FILESDIR}"/${PN}-1.0.3-no-test.patch
58 + "${FILESDIR}"/${PN}-1.0.8-mingw.patch #393573
59 + "${FILESDIR}"/${PN}-1.0.8-out-of-tree-build.patch
60 +)
61 +
62 +DOCS=( CHANGES README{,.COMPILATION.PROBLEMS,.XML.STUFF} manual.pdf )
63 +HTML_DOCS=( manual.html )
64 +
65 +src_prepare() {
66 + default
67 +
68 + # - Use right man path
69 + # - Generate symlinks instead of hardlinks
70 + # - pass custom variables to control libdir
71 + sed -i \
72 + -e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \
73 + -e 's:ln -s -f $(PREFIX)/bin/:ln -s -f :' \
74 + -e 's:$(PREFIX)/lib:$(PREFIX)/$(LIBDIR):g' \
75 + Makefile || die
76 +}
77 +
78 +bemake() {
79 + emake \
80 + VPATH="${S}" \
81 + CC="$(tc-getCC)" \
82 + AR="$(tc-getAR)" \
83 + RANLIB="$(tc-getRANLIB)" \
84 + "$@"
85 +}
86 +
87 +multilib_src_compile() {
88 + bemake -f "${S}"/Makefile-libbz2_so all
89 + # Make sure we link against the shared lib #504648
90 + ln -s libbz2.so.${PV} libbz2.so || die
91 + bemake -f "${S}"/Makefile all LDFLAGS="${LDFLAGS} $(usex static -static '')"
92 +}
93 +
94 +multilib_src_test() {
95 + cp "${S}"/sample* "${BUILD_DIR}" || die
96 + bemake -f "${S}"/Makefile check
97 +}
98 +
99 +multilib_src_install() {
100 + into /usr
101 +
102 + # Install the shared lib manually. We install:
103 + # .x.x.x - standard shared lib behavior
104 + # .x.x - SONAME some distros use #338321
105 + # .x - SONAME Gentoo uses
106 + dolib.so libbz2.so.${PV}
107 + local v
108 + for v in libbz2.so{,.{${PV%%.*},${PV%.*}}} ; do
109 + dosym libbz2.so.${PV} /usr/$(get_libdir)/${v}
110 + done
111 +
112 + use static-libs && dolib.a libbz2.a
113 +
114 + if multilib_is_native_abi ; then
115 + gen_usr_ldscript -a bz2
116 +
117 + dobin bzip2recover
118 + into /
119 + newbin bzip2 bzip2-reference
120 + fi
121 +}
122 +
123 +multilib_src_install_all() {
124 + # `make install` doesn't cope with out-of-tree builds, nor with
125 + # installing just non-binaries, so handle things ourselves.
126 + insinto /usr/include
127 + doins bzlib.h
128 + into /usr
129 + dobin bz{diff,grep,more}
130 + doman bz{diff,grep,more}.1
131 + newman bzip2.1 bzip2-reference.1
132 +
133 + dosym bzdiff /usr/bin/bzcmp
134 + dosym bzdiff.1 /usr/share/man/man1/bzcmp.1
135 +
136 + dosym bzmore /usr/bin/bzless
137 + dosym bzmore.1 /usr/share/man/man1/bzless.1
138 +
139 + dosym bzip2-reference.1 /usr/share/man/man1/bzip2recover.1
140 + local x
141 + for x in bz{e,f}grep ; do
142 + dosym bzgrep /usr/bin/${x}
143 + dosym bzgrep.1 /usr/share/man/man1/${x}.1
144 + done
145 +
146 + einstalldocs
147 +}
148 +
149 +pkg_postinst() {
150 + # ensure to preserve the symlinks before app-alternatives/bzip2
151 + # is installed
152 + local x
153 + for x in bzip2 bunzip2 bzcat; do
154 + if [[ ! -h ${EROOT}/bin/${x} ]]; then
155 + ln -s bzip2-reference "${EROOT}/bin/${x}" || die
156 + fi
157 + done
158 +}
159
160 diff --git a/app-arch/bzip2/bzip2-9999.ebuild b/app-arch/bzip2/bzip2-9999.ebuild
161 index e463fbf759d7..025f6378d542 100644
162 --- a/app-arch/bzip2/bzip2-9999.ebuild
163 +++ b/app-arch/bzip2/bzip2-9999.ebuild
164 @@ -19,9 +19,8 @@ SLOT="0/1" # subslot = SONAME
165
166 IUSE="static-libs"
167
168 -RDEPEND="
169 - !app-arch/lbzip2[symlink(-)]
170 - !app-arch/pbzip2[symlink(-)]
171 +PDEPEND="
172 + app-alternatives/bzip2
173 "
174
175 multilib_src_configure() {
176 @@ -39,16 +38,17 @@ multilib_src_install() {
177
178 if multilib_is_native_abi ; then
179 gen_usr_ldscript -a bz2
180 -
181 - dodir /bin
182 - mv "${ED}"/usr/bin/bzip2 "${ED}"/bin || die
183 fi
184 }
185
186 multilib_src_install_all() {
187 - # Move "important" bzip2 binaries to /bin and use the shared libbz2.so
188 - dosym bzip2 /bin/bzcat
189 - dosym bzip2 /bin/bunzip2
190 + dodir /bin
191 + mv "${ED}"/usr/bin/bzip2 "${ED}"/bin/bzip2-reference || die
192 + mv "${ED}"/usr/share/man/man1/bzip2{,-reference}.1 || die
193 +
194 + # moved to app-alternatives/bzip2
195 + rm "${ED}"/usr/bin/{bzcat,bunzip2} || die
196 + rm "${ED}"/usr/share/man/man1/{bzcat,bunzip2.1} || die
197
198 dosym bzdiff /usr/bin/bzcmp
199 dosym bzmore /usr/bin/bzless
200 @@ -57,8 +57,7 @@ multilib_src_install_all() {
201 dosym bzgrep /usr/bin/${x}
202 done
203
204 - dosym bzip2.1 /usr/share/man/man1/bzip2recover.1
205 + dosym bzip2-reference.1 /usr/share/man/man1/bzip2recover.1
206
207 - local DOCS=( AUTHORS NEWS{,-pre-1.0.7} README.md )
208 einstalldocs
209 }