sys-apps/hdparm: fix parallel build failure
authorMike Frysinger <vapier@gentoo.org>
Tue, 20 Dec 2016 16:34:29 +0000 (11:34 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 20 Dec 2016 16:35:09 +0000 (11:35 -0500)
Move the sed commands into a patch to make a bit more reliable since
we have to patch the Makefile anyways to fix parallel build errors.

sys-apps/hdparm/files/hdparm-9.50-build.patch [new file with mode: 0644]
sys-apps/hdparm/hdparm-9.50.ebuild

diff --git a/sys-apps/hdparm/files/hdparm-9.50-build.patch b/sys-apps/hdparm/files/hdparm-9.50-build.patch
new file mode 100644 (file)
index 0000000..ff1948a
--- /dev/null
@@ -0,0 +1,32 @@
+* drop hardcoded -O2 flag from CFLAGS
+* drop hardcoded -s (strip) flag from LDFLAGS, and respect user LDFLAGS
+* fix hardcoded `make` and hardcoded -j2 flags
+* respect CFLAGS when linking
+
+--- a/Makefile
++++ b/Makefile
+@@ -13,9 +13,8 @@
+ CC ?= gcc
+ STRIP ?= strip
+-CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)
++CFLAGS += -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs
+-LDFLAGS = -s
+ #LDFLAGS = -s -static
+ INSTALL = install
+ INSTALL_DATA = $(INSTALL) -m 644
+@@ -24,11 +23,10 @@ INSTALL_PROGRAM = $(INSTALL)
+ OBJS = hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o wdidle3.o
+-all:
+-      make -j2 hdparm
++all: hdparm
+ hdparm: hdparm.h sgio.h $(OBJS)
+-      $(CC) $(LDFLAGS) -o hdparm $(OBJS)
++      $(CC) $(CFLAGS) $(LDFLAGS) -o hdparm $(OBJS)
+       $(STRIP) hdparm
+ hdparm.o:     hdparm.h sgio.h
index 4db68894082f4b566a8d542fad7aa5e91071421d..f447ca4779934c61e27f888c0b582b046e70b378 100644 (file)
@@ -17,15 +17,13 @@ IUSE="static"
 
 src_prepare() {
        epatch "${FILESDIR}"/${PN}-9.48-sysmacros.patch #580052
+       epatch "${FILESDIR}"/${PN}-9.50-build.patch
        use static && append-ldflags -static
-       sed -i \
-               -e "/^CFLAGS/ s:-O2:${CFLAGS}:" \
-               -e "/^LDFLAGS/ s:-s:${LDFLAGS}:" \
-               Makefile || die "sed"
 }
 
-src_compile() {
-       emake STRIP=: CC="$(tc-getCC)"
+src_configure() {
+       tc-export CC
+       export STRIP=:
 }
 
 src_install() {