commit:     61a59bd4bd8f1bc7dd41dc0bff153c866d9ddb53
Author:     Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com>
AuthorDate: Tue Feb  8 05:07:31 2022 +0000
Commit:     Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com>
CommitDate: Tue Feb  8 05:07:31 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=61a59bd4

app-misc/fastfetch: fix automagical deps

Patch the build system instead of sedding out checks

Signed-off-by: Viorel Munteanu <ceamac.paragon <AT> gmail.com>

 ...fetch-9999.ebuild => fastfetch-0.569-r1.ebuild} |  36 ++--
 app-misc/fastfetch/fastfetch-9999.ebuild           |  31 ++--
 .../fastfetch-0.569-cmake-optional-deps.patch      | 199 +++++++++++++++++++++
 3 files changed, 232 insertions(+), 34 deletions(-)

diff --git a/app-misc/fastfetch/fastfetch-9999.ebuild 
b/app-misc/fastfetch/fastfetch-0.569-r1.ebuild
similarity index 72%
copy from app-misc/fastfetch/fastfetch-9999.ebuild
copy to app-misc/fastfetch/fastfetch-0.569-r1.ebuild
index e93f5cf46..ce926d740 100644
--- a/app-misc/fastfetch/fastfetch-9999.ebuild
+++ b/app-misc/fastfetch/fastfetch-0.569-r1.ebuild
@@ -11,14 +11,15 @@ if [[ ${PV} == *9999 ]]; then
        inherit git-r3
        EGIT_REPO_URI="https://github.com/LinusDierheimer/fastfetch.git";
 else
-       COMMIT="f72ec8a99f6021e95abce282668cce99fabd28c5"
-       VERSION_REV="f72ec8a"
+       COMMIT="7ad73d3ba13489b341a07782e6374d92c54091ba"
+       VERSION_REV="7ad73d3"
        
SRC_URI="https://github.com/LinusDierheimer/fastfetch/archive/${COMMIT}.tar.gz 
-> ${P}.tar.gz"
        S="${WORKDIR}/${PN}-${COMMIT}"
 fi
 
 LICENSE="MIT"
 SLOT="0"
+KEYWORDS="~amd64"
 IUSE="X gnome pci vulkan wayland xcb xfce xrandr"
 
 # note - qa-vdb will always report errors because fastfetch loads the libs 
dynamically
@@ -40,24 +41,23 @@ BDEPEND="virtual/pkgconfig"
 
 REQUIRED_USE="xrandr? ( X )"
 
-# disable_check VAR lib
-disable_check() {
-       sed -i -e "
-               /pkg_check_modules ($1 /d
-               /message.*$2/d" CMakeLists.txt || die "Cannot disable $1"
-}
+PATCHES=(
+       "${FILESDIR}/fastfetch-0.569-cmake-optional-deps.patch"
+)
 
 src_configure() {
-       disable_check RPM librpm
-
-       use X || disable_check X11 x11
-       use gnome || (disable_check GIO gio- && disable_check DCONF dconf)
-       use pci || disable_check LIBPCI libpci
-       use vulkan || disable_check VULKAN vulkan
-       use wayland || disable_check WAYLAND wayland-client
-       use xcb || (disable_check XCB_RANDR xcb-randr && disable_check XCB xcb)
-       use xfce || disable_check XFCONF libxfconf
-       use xrandr || disable_check XRANDR xrandr
+       local mycmakeargs=(
+               -DENABLE_RPM=no
+               -DENABLE_VULKAN=$(usex vulkan)
+               -DENABLE_WAYLAND=$(usex wayland)
+               -DENABLE_XCB_RANDR=$(usex xcb)
+               -DENABLE_XCB=$(usex xcb)
+               -DENABLE_XRANDR=$(usex xrandr)
+               -DENABLE_X11=$(usex X)
+               -DENABLE_GIO=$(usex gnome)
+               -DENABLE_DCONF=$(usex gnome)
+               -DENABLE_XFCONF=$(usex xfce)
+       )
 
        if [[ ${PV} != *9999 ]]; then
                # version comes from git, fake it

diff --git a/app-misc/fastfetch/fastfetch-9999.ebuild 
b/app-misc/fastfetch/fastfetch-9999.ebuild
index e93f5cf46..4c5668f4e 100644
--- a/app-misc/fastfetch/fastfetch-9999.ebuild
+++ b/app-misc/fastfetch/fastfetch-9999.ebuild
@@ -40,24 +40,23 @@ BDEPEND="virtual/pkgconfig"
 
 REQUIRED_USE="xrandr? ( X )"
 
-# disable_check VAR lib
-disable_check() {
-       sed -i -e "
-               /pkg_check_modules ($1 /d
-               /message.*$2/d" CMakeLists.txt || die "Cannot disable $1"
-}
+PATCHES=(
+       "${FILESDIR}/fastfetch-0.569-cmake-optional-deps.patch"
+)
 
 src_configure() {
-       disable_check RPM librpm
-
-       use X || disable_check X11 x11
-       use gnome || (disable_check GIO gio- && disable_check DCONF dconf)
-       use pci || disable_check LIBPCI libpci
-       use vulkan || disable_check VULKAN vulkan
-       use wayland || disable_check WAYLAND wayland-client
-       use xcb || (disable_check XCB_RANDR xcb-randr && disable_check XCB xcb)
-       use xfce || disable_check XFCONF libxfconf
-       use xrandr || disable_check XRANDR xrandr
+       local mycmakeargs=(
+               -DENABLE_RPM=no
+               -DENABLE_VULKAN=$(usex vulkan)
+               -DENABLE_WAYLAND=$(usex wayland)
+               -DENABLE_XCB_RANDR=$(usex xcb)
+               -DENABLE_XCB=$(usex xcb)
+               -DENABLE_XRANDR=$(usex xrandr)
+               -DENABLE_X11=$(usex X)
+               -DENABLE_GIO=$(usex gnome)
+               -DENABLE_DCONF=$(usex gnome)
+               -DENABLE_XFCONF=$(usex xfce)
+       )
 
        if [[ ${PV} != *9999 ]]; then
                # version comes from git, fake it

diff --git a/app-misc/fastfetch/files/fastfetch-0.569-cmake-optional-deps.patch 
b/app-misc/fastfetch/files/fastfetch-0.569-cmake-optional-deps.patch
new file mode 100644
index 000000000..617b6c6e9
--- /dev/null
+++ b/app-misc/fastfetch/files/fastfetch-0.569-cmake-optional-deps.patch
@@ -0,0 +1,199 @@
+Add options to disable automagical dependencies
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0915750..05ca503 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,82 +48,116 @@ find_package(Threads REQUIRED)
+ 
+ find_package(PkgConfig REQUIRED)
+ 
+-pkg_check_modules (LIBPCI libpci)
+-if(LIBPCI_FOUND)
+-    add_compile_definitions(FF_HAVE_LIBPCI=1)
+-else(LIBPCI_FOUND)
+-    message(WARNING "Package libpci not found. Building without support.")
+-endif(LIBPCI_FOUND)
+-
+-pkg_check_modules (VULKAN vulkan)
+-if(VULKAN_FOUND)
+-    add_compile_definitions(FF_HAVE_VULKAN=1)
+-else(VULKAN_FOUND)
+-    message(WARNING "Package vulkan not found. Building without support.")
+-endif(VULKAN_FOUND)
+-
+-pkg_check_modules (WAYLAND wayland-client)
+-if(WAYLAND_FOUND)
+-    add_compile_definitions(FF_HAVE_WAYLAND=1)
+-else(WAYLAND_FOUND)
+-    message(WARNING "Package wayland-client not found. Building without 
support.")
+-endif(WAYLAND_FOUND)
+-
+-pkg_check_modules (XCB_RANDR xcb-randr)
+-if(XCB_RANDR_FOUND)
+-    add_compile_definitions(FF_HAVE_XCB_RANDR=1)
+-else(XCB_RANDR_FOUND)
+-    message(WARNING "Package xcb-randr not found. Building without support.")
+-endif(XCB_RANDR_FOUND)
+-
+-pkg_check_modules (XCB xcb)
+-if(XCB_FOUND)
+-    add_compile_definitions(FF_HAVE_XCB=1)
+-else(XCB_FOUND)
+-    message(WARNING "Package xcb not found. Building without support.")
+-endif(XCB_FOUND)
+-
+-pkg_check_modules (XRANDR xrandr)
+-if(XRANDR_FOUND)
+-    add_compile_definitions(FF_HAVE_XRANDR=1)
+-else(XRANDR_FOUND)
+-    message(WARNING "Package xrandr not found. Building without support.")
+-endif(XRANDR_FOUND)
+-
+-pkg_check_modules (X11 x11)
+-if(X11_FOUND)
+-    add_compile_definitions(FF_HAVE_X11=1)
+-else(X11_FOUND)
+-    message(WARNING "Package x11 not found. Building without support.")
+-endif(X11_FOUND)
+-
+-pkg_check_modules (GIO gio-2.0)
+-if(GIO_FOUND)
+-    add_compile_definitions(FF_HAVE_GIO=1)
+-else(GIO_FOUND)
+-    message(WARNING "Package gio-2.0 not found. Building without support.")
+-endif(GIO_FOUND)
+-
+-pkg_check_modules (DCONF dconf)
+-if(DCONF_FOUND)
+-    add_compile_definitions(FF_HAVE_DCONF=1)
+-else(DCONF_FOUND)
+-    message(WARNING "Package dconf not found. Building without support.")
+-endif(DCONF_FOUND)
+-
+-pkg_check_modules (XFCONF libxfconf-0)
+-if(XFCONF_FOUND)
+-    add_compile_definitions(FF_HAVE_XFCONF=1)
+-else(XFCONF_FOUND)
+-    message(WARNING "Package libxfconf-0 not found. Building without 
support.")
+-endif(XFCONF_FOUND)
+-
+-pkg_check_modules (RPM rpm)
+-if(RPM_FOUND)
+-    add_compile_definitions(FF_HAVE_RPM=1)
+-else(RPM_FOUND)
+-    message(WARNING "Package librpm not found. Building without support.")
+-endif(RPM_FOUND)
++OPTION(ENABLE_LIBPCI "Enable libpci" ON)
++OPTION(ENABLE_VULKAN "Enable vulkan" ON)
++OPTION(ENABLE_WAYLAND "Enable wayland-client" ON)
++OPTION(ENABLE_XCB_RANDR "Enable xcb-randr" ON)
++OPTION(ENABLE_XCB "Enable xcb" ON)
++OPTION(ENABLE_XRANDR "Enable xrandr" ON)
++OPTION(ENABLE_X11 "Enable x11" ON)
++OPTION(ENABLE_GIO "Enable gio-2.0" ON)
++OPTION(ENABLE_DCONF "Enable dconf" ON)
++OPTION(ENABLE_XFCONF "Enable libxfconf-0" ON)
++OPTION(ENABLE_RPM "Enable rpm" ON)
++
++if(ENABLE_LIBPCI)
++    pkg_check_modules (LIBPCI libpci)
++    if(LIBPCI_FOUND)
++        add_compile_definitions(FF_HAVE_LIBPCI=1)
++    else(LIBPCI_FOUND)
++        message(WARNING "Package libpci not found. Building without support.")
++    endif(LIBPCI_FOUND)
++endif(ENABLE_LIBPCI)
++
++if(ENABLE_VULKAN)
++    pkg_check_modules (VULKAN vulkan)
++    if(VULKAN_FOUND)
++        add_compile_definitions(FF_HAVE_VULKAN=1)
++    else(VULKAN_FOUND)
++        message(WARNING "Package vulkan not found. Building without support.")
++    endif(VULKAN_FOUND)
++endif(ENABLE_VULKAN)
++
++if(ENABLE_WAYLAND)
++    pkg_check_modules (WAYLAND wayland-client)
++    if(WAYLAND_FOUND)
++        add_compile_definitions(FF_HAVE_WAYLAND=1)
++    else(WAYLAND_FOUND)
++        message(WARNING "Package wayland-client not found. Building without 
support.")
++    endif(WAYLAND_FOUND)
++endif(ENABLE_WAYLAND)
++
++if(ENABLE_XCB_RANDR)
++    pkg_check_modules (XCB_RANDR xcb-randr)
++    if(XCB_RANDR_FOUND)
++        add_compile_definitions(FF_HAVE_XCB_RANDR=1)
++    else(XCB_RANDR_FOUND)
++        message(WARNING "Package xcb-randr not found. Building without 
support.")
++    endif(XCB_RANDR_FOUND)
++endif(ENABLE_XCB_RANDR)
++
++if(ENABLE_XCB)
++    pkg_check_modules (XCB xcb)
++    if(XCB_FOUND)
++        add_compile_definitions(FF_HAVE_XCB=1)
++    else(XCB_FOUND)
++        message(WARNING "Package xcb not found. Building without support.")
++    endif(XCB_FOUND)
++endif(ENABLE_XCB)
++
++if(ENABLE_XRANDR)
++    pkg_check_modules (XRANDR xrandr)
++    if(XRANDR_FOUND)
++        add_compile_definitions(FF_HAVE_XRANDR=1)
++    else(XRANDR_FOUND)
++        message(WARNING "Package xrandr not found. Building without support.")
++    endif(XRANDR_FOUND)
++endif(ENABLE_XRANDR)
++
++if(ENABLE_X11)
++    pkg_check_modules (X11 x11)
++    if(X11_FOUND)
++        add_compile_definitions(FF_HAVE_X11=1)
++    else(X11_FOUND)
++        message(WARNING "Package x11 not found. Building without support.")
++    endif(X11_FOUND)
++endif(ENABLE_X11)
++
++if(ENABLE_GIO)
++    pkg_check_modules (GIO gio-2.0)
++    if(GIO_FOUND)
++        add_compile_definitions(FF_HAVE_GIO=1)
++    else(GIO_FOUND)
++        message(WARNING "Package gio-2.0 not found. Building without 
support.")
++    endif(GIO_FOUND)
++endif(ENABLE_GIO)
++
++if(ENABLE_DCONF)
++    pkg_check_modules (DCONF dconf)
++    if(DCONF_FOUND)
++        add_compile_definitions(FF_HAVE_DCONF=1)
++    else(DCONF_FOUND)
++        message(WARNING "Package dconf not found. Building without support.")
++    endif(DCONF_FOUND)
++endif(ENABLE_DCONF)
++
++if(ENABLE_XFCONF)
++    pkg_check_modules (XFCONF libxfconf-0)
++    if(XFCONF_FOUND)
++        add_compile_definitions(FF_HAVE_XFCONF=1)
++    else(XFCONF_FOUND)
++        message(WARNING "Package libxfconf-0 not found. Building without 
support.")
++    endif(XFCONF_FOUND)
++endif(ENABLE_XFCONF)
++
++if(ENABLE_RPM)
++    pkg_check_modules (RPM rpm)
++    if(RPM_FOUND)
++        add_compile_definitions(FF_HAVE_RPM=1)
++    else(RPM_FOUND)
++        message(WARNING "Package librpm not found. Building without support.")
++    endif(RPM_FOUND)
++endif(ENABLE_RPM)
+ 
+ include_directories(
+     ${PROJECT_BINARY_DIR}

Reply via email to