summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-12-02 20:11:10 +0100
committerMichał Górny <mgorny@gentoo.org>2022-12-05 20:13:22 +0100
commit98badc6ae4d121506a32be863250ec96dea8aaf2 (patch)
treee7f4ad295283d903a5969d2530d1890ea03fdb83 /app-alternatives/bzip2
parentapp-alternatives/awk: Use app-alternatives.eclass (diff)
downloadgentoo-98badc6ae4d121506a32be863250ec96dea8aaf2.tar.gz
gentoo-98badc6ae4d121506a32be863250ec96dea8aaf2.tar.bz2
gentoo-98badc6ae4d121506a32be863250ec96dea8aaf2.zip
app-alternatives/bzip2: Use app-alternatives.eclass
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'app-alternatives/bzip2')
-rw-r--r--app-alternatives/bzip2/bzip2-1.ebuild43
1 files changed, 20 insertions, 23 deletions
diff --git a/app-alternatives/bzip2/bzip2-1.ebuild b/app-alternatives/bzip2/bzip2-1.ebuild
index 6e61b5e2135d..6b0b5ef620d1 100644
--- a/app-alternatives/bzip2/bzip2-1.ebuild
+++ b/app-alternatives/bzip2/bzip2-1.ebuild
@@ -3,46 +3,43 @@
EAPI=8
-DESCRIPTION="bzip2 symlink"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Base/Alternatives"
-SRC_URI=""
-S=${WORKDIR}
+ALTERNATIVES=(
+ "reference:>=app-arch/bzip2-1.0.8-r4"
+ "lbzip2:app-arch/lbzip2[-symlink(-)]"
+ "pbzip2:app-arch/pbzip2[-symlink(-)]"
+)
+
+inherit app-alternatives
-LICENSE="CC0-1.0"
-SLOT="0"
+DESCRIPTION="bzip2 symlink"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-IUSE="lbzip2 pbzip2 +reference split-usr"
-REQUIRED_USE="^^ ( lbzip2 pbzip2 reference )"
+IUSE="split-usr"
RDEPEND="
- lbzip2? ( app-arch/lbzip2[-symlink(-)] )
- pbzip2? ( app-arch/pbzip2[-symlink(-)] )
- reference? ( >=app-arch/bzip2-1.0.8-r4 )
!<app-arch/bzip2-1.0.8-r4
!app-arch/lbzip2[symlink(-)]
!app-arch/pbzip2[symlink(-)]
"
src_install() {
+ local alt=$(get_alternative)
local usr_prefix=
use split-usr && usr_prefix=../usr/bin/
- if use lbzip2; then
- dosym "${usr_prefix}lbzip2" /bin/bzip2
- newman - bzip2.1 <<<".so lbzip2.1"
- elif use pbzip2; then
- dosym "${usr_prefix}pbzip2" /bin/bzip2
- newman - bzip2.1 <<<".so pbzip2.1"
- elif use reference; then
- dosym bzip2-reference /bin/bzip2
- newman - bzip2.1 <<<".so bzip2-reference.1"
- else
- die "Invalid USE flag combination (broken REQUIRED_USE?)"
- fi
+ case ${alt} in
+ reference)
+ dosym bzip2-reference /bin/bzip2
+ alt=bzip2-reference
+ ;;
+ *)
+ dosym "${usr_prefix}${alt}" /bin/bzip2
+ ;;
+ esac
dosym bzip2 /bin/bunzip2
dosym bzip2 /bin/bzcat
+ newman - bzip2.1 <<<".so ${alt}.1"
newman - bunzip2.1 <<<".so bzip2.1"
newman - bzcat.1 <<<".so bzip2.1"
}