Skip to content

Commit

Permalink
app-misc/neofetch: Use optfeature for runtime dependencies
Browse files Browse the repository at this point in the history
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Matt Smith <[email protected]>
Closes: gentoo#20413
Signed-off-by: Joonas Niilola <[email protected]>
  • Loading branch information
00-matt authored and juippis committed Apr 28, 2021
1 parent eff91e0 commit d4969ef
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 12 deletions.
42 changes: 42 additions & 0 deletions app-misc/neofetch/neofetch-7.1.0-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit optfeature prefix

if [[ ${PV} != *9999* ]]; then
SRC_URI="https://github.com/dylanaraps/${PN}/archive/${PV}/${P}.tar.gz"
KEYWORDS="~amd64 ~arm64 ~mips ~ppc64 ~x86"
else
inherit git-r3
EGIT_REPO_URI="https://github.com/dylanaraps/neofetch.git"
fi

DESCRIPTION="Simple information system script"
HOMEPAGE="https://github.com/dylanaraps/neofetch"
LICENSE="MIT-with-advertising"
SLOT="0"

src_prepare() {
if use prefix; then
# bug #693526
hprefixify neofetch
sed -e "/has emerge/s:\${br_prefix}:${EPREFIX}:" -i neofetch \
|| die "Failed to adjust for Prefix"
fi

default
}

src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
}

pkg_postinst() {
optfeature "displaying images" "media-libs/imlib2 www-client/w3m[imlib]"
optfeature "gpu detection" sys-apps/pciutils
optfeature "thumbnail creation" media-gfx/imagemagick
optfeature "wallpaper" media-gfx/feh x11-misc/nitrogen
optfeature "window size" x11-misc/xdotool "x11-apps/xwininfo x11-apps/xprop" "x11-apps/xwininfo x11-apps/xdpyinfo"
}
21 changes: 9 additions & 12 deletions app-misc/neofetch/neofetch-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

EAPI=7

inherit prefix
inherit optfeature prefix

if [[ ${PV} != *9999* ]]; then
SRC_URI="https://github.com/dylanaraps/${PN}/archive/${PV}/${P}.tar.gz"
Expand All @@ -17,17 +17,6 @@ DESCRIPTION="Simple information system script"
HOMEPAGE="https://github.com/dylanaraps/neofetch"
LICENSE="MIT-with-advertising"
SLOT="0"
IUSE="X"

RDEPEND="sys-apps/pciutils
X? (
media-gfx/imagemagick
media-libs/imlib2
www-client/w3m[imlib]
x11-apps/xprop
x11-apps/xrandr
x11-apps/xwininfo
)"

src_prepare() {
if use prefix; then
Expand All @@ -43,3 +32,11 @@ src_prepare() {
src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
}

pkg_postinst() {
optfeature "displaying images" "media-libs/imlib2 www-client/w3m[imlib]"
optfeature "gpu detection" sys-apps/pciutils
optfeature "thumbnail creation" media-gfx/imagemagick
optfeature "wallpaper" media-gfx/feh x11-misc/nitrogen
optfeature "window size" x11-misc/xdotool "x11-apps/xwininfo x11-apps/xprop" "x11-apps/xwininfo x11-apps/xdpyinfo"
}

0 comments on commit d4969ef

Please sign in to comment.