summaryrefslogtreecommitdiff
blob: 266dd9856aac2f452b4cc6e36de70cebb8dbe66d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit meson multilib-minimal usr-ldscript

DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux"
HOMEPAGE="https://gitlab.com/federicomenaquintero/bzip2"
if [[ "${PV}" == 9999 ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://gitlab.com/federicomenaquintero/bzip2.git"
else
	SRC_URI=""
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
LICENSE="BZIP2"
SLOT="0/1" # subslot = SONAME
IUSE="static-libs"

if [[ ${PV} == 1.1* ]]; then
	eerror "Please update SLOT due to accidental soname change in bzip2-1.0.7."
	eerror "See commit 98da0ad82192d21ad74ae52366ea8466e2acea24 for reference."
	die "SLOT update needed"
fi

multilib_src_configure() {
	local emesonargs=(
		-Ddefault_library=$(usex static-libs both shared)
		# Requires whole tex stack
		-Ddocs="disabled"
	)

	meson_src_configure
}

multilib_src_compile() {
	meson_src_compile
}

multilib_src_install() {
	meson_src_install

	if multilib_is_native_abi ; then
		gen_usr_ldscript -a bz2

		dodir /bin
		mv "${ED}"/usr/bin/bzip2 "${ED}"/bin || die
	fi
}

multilib_src_install_all() {
	# move "important" bzip2 binaries to /bin and use the shared libbz2.so
	dosym bzip2 /bin/bzcat
	dosym bzip2 /bin/bunzip2

	dosym bzdiff /usr/bin/bzcmp
	dosym bzmore /usr/bin/bzless
	local x
	for x in bz{e,f}grep ; do
		dosym bzgrep /usr/bin/${x}
	done

	dosym bzip2.1 /usr/share/man/man1/bzip2recover.1

	local DOCS=( AUTHORS NEWS{,-pre-1.0.7} README.md )
	einstalldocs
}