Diff bzip2-1.0.8-r1 with a bzip2-9999

/usr/portage/app-arch/bzip2/bzip2-9999.ebuild 2020-04-11 21:09:00.000000000 +0300
1
# Copyright 1999-2021 Gentoo Authors
1
# Copyright 1999-2020 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
# XXX: atm, libbz2.a is always PIC :(, so it is always built quickly
5
#      (since we're building shared libs) ...
6

  
7 4
EAPI=7
8 5

  
9
inherit toolchain-funcs multilib-minimal usr-ldscript
6
inherit meson multilib-minimal usr-ldscript
10 7

  
11 8
DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux"
12
HOMEPAGE="https://sourceware.org/bzip2/"
13
SRC_URI="https://sourceware.org/pub/${PN}/${P}.tar.gz"
14

  
9
HOMEPAGE="https://gitlab.com/federicomenaquintero/bzip2"
10
if [[ "${PV}" == 9999 ]] ; then
11
	inherit git-r3
12
	EGIT_REPO_URI="https://gitlab.com/federicomenaquintero/bzip2.git"
13
else
14
	SRC_URI=""
15
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
16
fi
15 17
LICENSE="BZIP2"
16 18
SLOT="0/1" # subslot = SONAME
17
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
18
IUSE="static static-libs"
19 19

  
20
PATCHES=(
21
	"${FILESDIR}"/${PN}-1.0.4-makefile-CFLAGS.patch
22
	"${FILESDIR}"/${PN}-1.0.8-saneso.patch
23
	"${FILESDIR}"/${PN}-1.0.4-man-links.patch #172986
24
	"${FILESDIR}"/${PN}-1.0.6-progress.patch
25
	"${FILESDIR}"/${PN}-1.0.3-no-test.patch
26
	"${FILESDIR}"/${PN}-1.0.8-mingw.patch #393573
27
	"${FILESDIR}"/${PN}-1.0.8-out-of-tree-build.patch
28
)
29

  
30
DOCS=( CHANGES README{,.COMPILATION.PROBLEMS,.XML.STUFF} manual.pdf )
31
HTML_DOCS=( manual.html )
32

  
33
src_prepare() {
34
	default
35

  
36
	# - Use right man path
37
	# - Generate symlinks instead of hardlinks
38
	# - pass custom variables to control libdir
39
	sed -i \
40
		-e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \
41
		-e 's:ln -s -f $(PREFIX)/bin/:ln -s -f :' \
42
		-e 's:$(PREFIX)/lib:$(PREFIX)/$(LIBDIR):g' \
43
		Makefile || die
44
}
20
IUSE="static-libs"
45 21

  
46
bemake() {
47
	emake \
48
		VPATH="${S}" \
49
		CC="$(tc-getCC)" \
50
		AR="$(tc-getAR)" \
51
		RANLIB="$(tc-getRANLIB)" \
52
		"$@"
22
multilib_src_configure() {
23
	local emesonargs=(
24
		-Ddefault_library=$(usex static-libs both shared)
25
		# Requires whole tex stack
26
		-Ddocs="disabled"
27
	)
28

  
29
	meson_src_configure
53 30
}
54 31

  
55 32
multilib_src_compile() {
56
	bemake -f "${S}"/Makefile-libbz2_so all
57
	# Make sure we link against the shared lib #504648
58
	ln -s libbz2.so.${PV} libbz2.so || die
59
	bemake -f "${S}"/Makefile all LDFLAGS="${LDFLAGS} $(usex static -static '')"
33
	meson_src_compile
60 34
}
61 35

  
62 36
multilib_src_install() {
63
	into /usr
64

  
65
	# Install the shared lib manually.  We install:
66
	#  .x.x.x - standard shared lib behavior
67
	#  .x.x   - SONAME some distros use #338321
68
	#  .x     - SONAME Gentoo uses
69
	dolib.so libbz2.so.${PV}
70
	local v
71
	for v in libbz2.so{,.{${PV%%.*},${PV%.*}}} ; do
72
		dosym libbz2.so.${PV} /usr/$(get_libdir)/${v}
73
	done
37
	meson_src_install
74 38

  
75 39
	# Install libbz2.so.1.0 due to accidental soname change in 1.0.7.
76 40
	# Reference: 98da0ad82192d21ad74ae52366ea8466e2acea24.
77 41
	# OK to remove one year after 2020-04-11.
78 42
	if [[ ! -L "${ED}/usr/$(get_libdir)/libbz2.so.1.0" ]]; then
79
		dosym libbz2.so.${PV} "/usr/$(get_libdir)/libbz2.so.1.0"
43
		dosym libbz2.so.1 "/usr/$(get_libdir)/libbz2.so.1.0"
80 44
	fi
81 45

  
82
	use static-libs && dolib.a libbz2.a
83

  
84 46
	if multilib_is_native_abi ; then
85 47
		gen_usr_ldscript -a bz2
86 48

  
87
		dobin bzip2recover
88
		into /
89
		dobin bzip2
49
		dodir /bin
50
		mv "${ED}"/usr/bin/bzip2 "${ED}"/bin || die
90 51
	fi
91 52
}
92 53

  
93 54
multilib_src_install_all() {
94
	# `make install` doesn't cope with out-of-tree builds, nor with
95
	# installing just non-binaries, so handle things ourselves.
96
	insinto /usr/include
97
	doins bzlib.h
98
	into /usr
99
	dobin bz{diff,grep,more}
100
	doman *.1
55
	# move "important" bzip2 binaries to /bin and use the shared libbz2.so
56
	dosym bzip2 /bin/bzcat
57
	dosym bzip2 /bin/bunzip2
101 58

  
102 59
	dosym bzdiff /usr/bin/bzcmp
103
	dosym bzdiff.1 /usr/share/man/man1/bzcmp.1
104

  
105 60
	dosym bzmore /usr/bin/bzless
106
	dosym bzmore.1 /usr/share/man/man1/bzless.1
107

  
108 61
	local x
109
	for x in bunzip2 bzcat bzip2recover ; do
110
		dosym bzip2.1 /usr/share/man/man1/${x}.1
111
	done
112 62
	for x in bz{e,f}grep ; do
113 63
		dosym bzgrep /usr/bin/${x}
114
		dosym bzgrep.1 /usr/share/man/man1/${x}.1
115 64
	done
116 65

  
117
	einstalldocs
66
	dosym bzip2.1 /usr/share/man/man1/bzip2recover.1
118 67

  
119
	# move "important" bzip2 binaries to /bin and use the shared libbz2.so
120
	dosym bzip2 /bin/bzcat
121
	dosym bzip2 /bin/bunzip2
68
	local DOCS=( AUTHORS NEWS{,-pre-1.0.7} README.md )
69
	einstalldocs
122 70
}
Thank you!