commit:     787c9cc8064dcb021a01a51e2fc0217b927a9111
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 23 02:20:59 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 23 02:32:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=787c9cc8

sys-block/spindown: EAPI 8, respect CXX, fix musl build

Closes: https://bugs.gentoo.org/863074
Closes: https://bugs.gentoo.org/725760
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../spindown/files/spindown-0.4.0-Makefile.patch   | 55 ++++++++++++++++++++++
 .../files/spindown-0.4.0-musl-time-include.patch   | 11 +++++
 sys-block/spindown/spindown-0.4.0-r5.ebuild        | 26 +++++-----
 3 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/sys-block/spindown/files/spindown-0.4.0-Makefile.patch 
b/sys-block/spindown/files/spindown-0.4.0-Makefile.patch
new file mode 100644
index 000000000000..60bfdb25616f
--- /dev/null
+++ b/sys-block/spindown/files/spindown-0.4.0-Makefile.patch
@@ -0,0 +1,55 @@
+--- a/Makefile
++++ b/Makefile
+@@ -3,8 +3,8 @@ ETCDIR = $(DESTDIR)/etc
+ VERSION = 0.4.0
+ OBJS = main.o diskset.o disk.o spindown.o iniparser.o dictionary.o log.o 
spindownd.o\
+         exceptions.o
+-CC = g++
+-CFLAGS +=
++CXX ?= c++
++CXXFLAGS +=
+ LDFLAGS +=
+ SRC = src/
+ INPARSER = $(SRC)ininiparser3.0b/
+@@ -61,31 +61,31 @@ dist:
+       rm -d -r -f $(SRCDIR)
+ 
+ spindownd: $(OBJS)
+-      g++ $(CFLAGS) $(LDFLAGS) -o spindownd $(OBJS)
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o spindownd $(OBJS)
+ 
+ main.o: $(SRC)main.cpp $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)main.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)main.cpp
+ 
+ diskset.o: $(SRC)diskset.cpp $(SRC)diskset.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)diskset.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)diskset.cpp
+ 
+ disk.o: $(SRC)disk.cpp $(SRC)disk.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)disk.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)disk.cpp
+ 
+ spindown.o: $(SRC)spindown.cpp $(SRC)spindown.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)spindown.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)spindown.cpp
+ 
+ spindownd.o: $(SRC)spindownd.cpp $(SRC)spindownd.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)spindownd.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)spindownd.cpp
+ 
+ log.o: $(SRC)log.cpp $(SRC)log.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)log.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)log.cpp
+ 
+ exceptions.o: $(SRC)exceptions.cpp $(SRC)exceptions.h $(SRC)general.h
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(SRC)exceptions.cpp
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(SRC)exceptions.cpp
+ 
+ iniparser.o: $(INPARSER)iniparser.c
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(INPARSER)iniparser.c
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(INPARSER)iniparser.c
+ 
+ dictionary.o: $(INPARSER)dictionary.c
+-      g++ $(CFLAGS) $(LDFLAGS) -c $(INPARSER)dictionary.c
++      $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c $(INPARSER)dictionary.c

diff --git a/sys-block/spindown/files/spindown-0.4.0-musl-time-include.patch 
b/sys-block/spindown/files/spindown-0.4.0-musl-time-include.patch
new file mode 100644
index 000000000000..8b42b5e41c9d
--- /dev/null
+++ b/sys-block/spindown/files/spindown-0.4.0-musl-time-include.patch
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/863074
+--- a/src/disk.h
++++ b/src/disk.h
+@@ -30,6 +30,7 @@
+ 
+ #include "ininiparser3.0b/iniparser.h"
+ 
++#include <ctime>
+ #include <string>
+ using std::string;
+ 

diff --git a/sys-block/spindown/spindown-0.4.0-r5.ebuild 
b/sys-block/spindown/spindown-0.4.0-r5.ebuild
index ecc1c975e4cc..8d80fdb10e54 100644
--- a/sys-block/spindown/spindown-0.4.0-r5.ebuild
+++ b/sys-block/spindown/spindown-0.4.0-r5.ebuild
@@ -1,7 +1,9 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
+
+inherit toolchain-funcs
 
 DESCRIPTION="Spindown is a daemon that can spin down idle disks"
 HOMEPAGE="https://code.google.com/p/spindown";
@@ -10,33 +12,33 @@ SRC_URI="https://spindown.googlecode.com/files/${P}.tar.gz";
 LICENSE="GPL-3"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE=""
 
-DEPEND=""
-RDEPEND="${DEPEND}
-       sys-apps/sg3_utils"
+RDEPEND="sys-apps/sg3_utils"
 
-src_prepare() {
-       eapply "${FILESDIR}"/${P}-CFLAGS-LDFLAGS.patch
-       eapply_user
-}
+PATCHES=(
+       "${FILESDIR}"/${P}-CFLAGS-LDFLAGS.patch
+       "${FILESDIR}"/${P}-Makefile.patch
+       "${FILESDIR}"/${P}-musl-time-include.patch
+)
 
 src_compile() {
-       emake
+       emake CXX="$(tc-getCXX)"
 }
 
 src_install() {
        insinto /etc
        newins spindown.conf.example spindown.conf
+
        newinitd "${FILESDIR}"/spindownd.initd-r1 spindownd
        newconfd "${FILESDIR}"/spindownd.confd-r1 spindownd
+
        dosbin spindownd
        dodoc CHANGELOG README TODO spindown.conf.example
 }
 
 pkg_postinst() {
        elog "Before starting spindownd the first time"
-       elog "you should modify /etc/spindown.conf"
+       elog "you should modify ${EROOT}/etc/spindown.conf"
        elog
        elog "To start spindownd by default"
        elog "you should add it to the default runlevel:"

Reply via email to