commit:     4b4234a933a25f93131c443b51cc3bd5b79ce345
Author:     Ioan-Adrian Ratiu <adi <AT> adirat <DOT> com>
AuthorDate: Wed Nov 11 18:37:47 2015 +0000
Commit:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 10:58:40 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b4234a9

app-laptop/i8kutils: fix gcc5 build for v1.42

Recipe enhancements requested in the bug are also included

Gentoo bug: #565466

Signed-off-by: Ioan-Adrian Ratiu <adi <AT> adirat.com>

 .../i8kutils/files/i8kutils-1.42-Makefile.patch    | 34 ++++++++++++++++++++++
 app-laptop/i8kutils/files/i8kutils-gcc5.patch      | 28 ++++++++++++++++++
 app-laptop/i8kutils/i8kutils-1.42.ebuild           | 17 +++++------
 3 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/app-laptop/i8kutils/files/i8kutils-1.42-Makefile.patch 
b/app-laptop/i8kutils/files/i8kutils-1.42-Makefile.patch
new file mode 100644
index 0000000..7dc56d9
--- /dev/null
+++ b/app-laptop/i8kutils/files/i8kutils-1.42-Makefile.patch
@@ -0,0 +1,34 @@
+Fix a race condition causing parallel builds to sometimes fail.
+
+Both probe_i8k_calls_time and i8kctl contain a main() function, though
+i8kctl's is omitted when built with -DLIB so they can link without a
+conflict.  i8kctl is also a standalone exe so it is built twice, with
+and without -DLIB.  When building in parallel you can get into a 
+situation where the object file created by the probe_i8k_calls_time
+target gets overwritten with the one from i8kctl and bad things happen.
+Nothing actually uses the i8kctl.o that has main() so we can just not
+build it.
+
+Also move CFLAGS, CC, LDFLAGS respect out of the ebuild.
+
+--- a/Makefile
++++ b/Makefile
+@@ -17,13 +17,13 @@ ccflags-y = -Wall
+ 
+ all: i8kctl probe_i8k_calls_time
+ 
+-i8kctl: i8kctl.c i8kctl.o
+-      gcc -Wall i8kctl.c -o i8kctl
++i8kctl: i8kctl.c
++      $(CC) -Wall ${CFLAGS} -o i8kctl i8kctl.c
+ 
+ probe_i8k_calls_time: probe_i8k_calls_time.c
+-      gcc -Wall -c -g -DLIB i8kctl.c
+-      gcc -Wall -c -g -DLIB probe_i8k_calls_time.c
+-      gcc -o probe_i8k_calls_time i8kctl.o probe_i8k_calls_time.o
++      $(CC) -Wall ${CFLAGS} -c -DLIB i8kctl.c
++      $(CC) -Wall ${CFLAGS} -c -DLIB probe_i8k_calls_time.c
++      $(CC) -Wall ${CFLAGS} ${LDFLAGS} -o probe_i8k_calls_time i8kctl.o 
probe_i8k_calls_time.o
+ 
+ i8k:
+       make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

diff --git a/app-laptop/i8kutils/files/i8kutils-gcc5.patch 
b/app-laptop/i8kutils/files/i8kutils-gcc5.patch
new file mode 100644
index 0000000..258b95f
--- /dev/null
+++ b/app-laptop/i8kutils/files/i8kutils-gcc5.patch
@@ -0,0 +1,28 @@
+Fix build with GCC 5.
+
+x86_64-pc-linux-gnu-gcc -O2 -march=native -g -pipe   -c -o i8kctl.o i8kctl.c
+gcc -Wall -c -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -DLIB i8kctl.c
+gcc -Wall -c -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -DLIB 
probe_i8k_calls_time.c
+gcc -o probe_i8k_calls_time i8kctl.o probe_i8k_calls_time.o
+probe_i8k_calls_time.o: In function `main':
+probe_i8k_calls_time.c:(.text+0x62): undefined reference to `timestamp'
+probe_i8k_calls_time.c:(.text+0x82): undefined reference to `timestamp'
+probe_i8k_calls_time.c:(.text+0xa2): undefined reference to `timestamp'
+probe_i8k_calls_time.c:(.text+0xbf): undefined reference to `timestamp'
+probe_i8k_calls_time.c:(.text+0xdc): undefined reference to `timestamp'
+probe_i8k_calls_time.o:probe_i8k_calls_time.c:(.text+0xf9): more undefined 
references to `timestamp' follow
+collect2: error: ld returned 1 exit status
+Makefile:24: recipe for target 'probe_i8k_calls_time' failed
+
+
+--- a/probe_i8k_calls_time.c
++++ b/probe_i8k_calls_time.c
+@@ -13,7 +13,7 @@ double t;
+ 
+ struct timespec tmst;
+ 
+-inline double timestamp()
++double timestamp()
+ {
+       clock_gettime(CLOCK_REALTIME, &tmst);
+       t = tmst.tv_nsec;

diff --git a/app-laptop/i8kutils/i8kutils-1.42.ebuild 
b/app-laptop/i8kutils/i8kutils-1.42.ebuild
index ae16f20..5d4cde5 100644
--- a/app-laptop/i8kutils/i8kutils-1.42.ebuild
+++ b/app-laptop/i8kutils/i8kutils-1.42.ebuild
@@ -4,7 +4,7 @@
 
 EAPI=5
 
-inherit systemd toolchain-funcs
+inherit eutils systemd toolchain-funcs
 
 DESCRIPTION="Dell Inspiron and Latitude utilities"
 HOMEPAGE="https://launchpad.net/i8kutils";
@@ -13,7 +13,7 @@ 
SRC_URI="https://launchpad.net/i8kutils/trunk/${PV}/+download/${P/-/_}.tar.xz";
 LICENSE="GPL-3"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="examples tk"
+IUSE="tk"
 
 DEPEND="tk? ( dev-lang/tk:0 )"
 RDEPEND="${DEPEND}
@@ -24,11 +24,8 @@ S="${WORKDIR}/${PN}"
 DOCS=( README.i8kutils )
 
 src_prepare() {
-       sed \
-               -e '/^CC/d' \
-               -e '/^CFLAGS/d' \
-               -e 's: -g : $(LDFLAGS) :g' \
-               -i Makefile || die
+       epatch "${FILESDIR}/${PN}-gcc5.patch"
+       epatch "${FILESDIR}/${P}-Makefile.patch"
 
        tc-export CC
 }
@@ -36,10 +33,10 @@ src_prepare() {
 src_install() {
        dobin i8kctl i8kfan
        doman i8kctl.1
-
-       use examples && dodoc -r examples
+       dodoc README.i8kutils
 
        newinitd "${FILESDIR}"/i8k.init-r1 i8k
+       newconfd "${FILESDIR}"/i8k.conf i8k
 
        if use tk; then
                dobin i8kmon
@@ -48,9 +45,9 @@ src_install() {
                systemd_dounit "${FILESDIR}"/i8kmon.service
        else
                cat >> "${ED}"/etc/conf.d/i8k <<- EOF
+
                # i8kmon disabled because the package was installed without 
USE=tk
                NOMON=1
                EOF
        fi
-
 }

Reply via email to