commit:     a1929d81e2d786aa1fd9d1c6382b1908f24e6694
Author:     Adrian Schollmeyer <nex+b-g-o <AT> nexadn <DOT> de>
AuthorDate: Thu Dec 15 16:55:30 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Dec 23 09:32:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1929d81

sys-process/btop: Backport parallel build fix and verbose mkdir

The first fix resolves build problems on machines with many threads
where mkdir calls might not be finished before a compiler tries to open
that specific output dir.

The second fix makes the calls to mkdir verbose to make debugging
easier.

Closes: https://bugs.gentoo.org/884005
Signed-off-by: Adrian Schollmeyer <nex+b-g-o <AT> nexadn.de>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 sys-process/btop/btop-1.2.13-r1.ebuild             | 64 ++++++++++++++++++++++
 .../btop/files/btop-1.2.13-fix-makefile-deps.patch | 40 ++++++++++++++
 .../btop/files/btop-1.2.13-verbose-mkdir.patch     | 27 +++++++++
 3 files changed, 131 insertions(+)

diff --git a/sys-process/btop/btop-1.2.13-r1.ebuild 
b/sys-process/btop/btop-1.2.13-r1.ebuild
new file mode 100644
index 000000000000..9383842c640d
--- /dev/null
+++ b/sys-process/btop/btop-1.2.13-r1.ebuild
@@ -0,0 +1,64 @@
+# Copyright 2021-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs xdg-utils
+
+DESCRIPTION="A monitor of resources"
+HOMEPAGE="https://github.com/aristocratos/btop";
+SRC_URI="https://github.com/aristocratos/btop/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+
+BDEPEND="
+       >=sys-devel/gcc-8
+"
+
+PATCHES=(
+       # Backported fixes for https://bugs.gentoo.org/884005,
+       # can be removed in 1.2.14 or later
+       "${FILESDIR}/${P}-fix-makefile-deps.patch"
+       "${FILESDIR}/${P}-verbose-mkdir.patch"
+)
+
+pkg_setup() {
+       if [[ "${MERGE_TYPE}" != "binary" ]]; then
+               if ! tc-is-gcc ; then
+                       # https://bugs.gentoo.org/839318
+                       die "$(tc-getCXX) is not a supported compiler. Please 
use sys-devel/gcc instead."
+               fi
+       fi
+}
+
+src_prepare() {
+       default
+       # btop installs README.md to /usr/share/btop by default
+       sed -i '/^.*cp -p README.md.*$/d' Makefile || die
+}
+
+src_compile() {
+       # Disable btop optimization flags, since we have our flags in CXXFLAGS
+       emake VERBOSE=true OPTFLAGS="" CXX="$(tc-getCXX)"
+}
+
+src_install() {
+       emake \
+               PREFIX="${EPREFIX}/usr" \
+               DESTDIR="${D}" \
+               install
+
+       dodoc README.md CHANGELOG.md
+}
+
+pkg_postinst() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+}
+
+pkg_postrm() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+}

diff --git a/sys-process/btop/files/btop-1.2.13-fix-makefile-deps.patch 
b/sys-process/btop/files/btop-1.2.13-fix-makefile-deps.patch
new file mode 100644
index 000000000000..4550f3f2cdd1
--- /dev/null
+++ b/sys-process/btop/files/btop-1.2.13-fix-makefile-deps.patch
@@ -0,0 +1,40 @@
+From 0d17fb66c45aa532a26e0e9a3b179d1f57bf037f Mon Sep 17 00:00:00 2001
+From: NexAdn <[email protected]>
+Date: Thu, 15 Dec 2022 10:04:33 +0100
+Subject: [PATCH] Makefile: make build targets depend on directories
+
+Since directory creation is a requirement for writing the built
+artifacts, this commit introduces a dependency on the directories for
+all build targets (compile and link), so parallel builds can't fail
+because a build target is executed before the directories target.
+
+Closes: https://github.com/aristocratos/btop/issues/479
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ec9f90a..a52929c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -259,7 +259,7 @@ uninstall:
+ 
+ #? Link
+ .ONESHELL:
+-btop: $(OBJECTS)
++btop: $(OBJECTS) | directories
+       @sleep 0.2 2>/dev/null || true
+       @TSTAMP=$$(date +%s 2>/dev/null || echo "0")
+       @$(QUIET) || printf "\n\033[1;92mLinking and optimizing 
binary\033[37m...\033[0m\n"
+@@ -270,7 +270,7 @@ btop: $(OBJECTS)
+ 
+ #? Compile
+ .ONESHELL:
+-$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
++$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT) | directories
+       @sleep 0.3 2>/dev/null || true
+       @TSTAMP=$$(date +%s 2>/dev/null || echo "0")
+       @$(QUIET) || printf "\033[1;97mCompiling $<\033[0m\n"
+-- 
+2.37.4
+

diff --git a/sys-process/btop/files/btop-1.2.13-verbose-mkdir.patch 
b/sys-process/btop/files/btop-1.2.13-verbose-mkdir.patch
new file mode 100644
index 000000000000..bf2b1b88dbde
--- /dev/null
+++ b/sys-process/btop/files/btop-1.2.13-verbose-mkdir.patch
@@ -0,0 +1,27 @@
+From c4ee41ebc0f7fabbf4717450c889292464dbeb6d Mon Sep 17 00:00:00 2001
+From: aristocratos <[email protected]>
+Date: Thu, 15 Dec 2022 17:42:07 +0100
+Subject: [PATCH] Fixed: Makefile, VERBOSE flag now shows directory creation,
+ Issue #480
+
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index a52929c..c746c00 100644
+--- a/Makefile
++++ b/Makefile
+@@ -200,7 +200,9 @@ help:
+ 
+ #? Make the Directories
+ directories:
++      @$(VERBOSE) || printf "mkdir -p $(TARGETDIR)\n"
+       @mkdir -p $(TARGETDIR)
++      @$(VERBOSE) || printf "mkdir -p $(BUILDDIR)/$(PLATFORM_DIR)\n"
+       @mkdir -p $(BUILDDIR)/$(PLATFORM_DIR)
+ 
+ #? Clean only Objects
+-- 
+2.37.4
+

Reply via email to