commit:     6274f4bc036e953c693b17e21a2946520a90b48f
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 15 13:30:20 2022 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Mon Aug 15 13:37:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6274f4bc

net-misc/linuxptp: honour user value of CPP

Upstream build scripts call the preprocessor to acquire the list
of system include directories, which is then used to locate the
declaration of clock_adjtime(). However, they hard-coded the
preprocessor name to "cpp" - and if that is absent (e.g. on a system
without native gcc symlinks) the script invoking it gets an empty list
of directories, assumes the absence of clock_adjtime() definition and
compensates by enabling a custom one, and subsequently causes a build
failure when the two definitions collide.

Closes: https://bugs.gentoo.org/864557
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 net-misc/linuxptp/files/linuxptp-3.1.1-user_cpp.patch | 11 +++++++++++
 net-misc/linuxptp/linuxptp-3.1.1.ebuild               |  6 +++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/net-misc/linuxptp/files/linuxptp-3.1.1-user_cpp.patch 
b/net-misc/linuxptp/files/linuxptp-3.1.1-user_cpp.patch
new file mode 100644
index 000000000000..d2b3728b6141
--- /dev/null
+++ b/net-misc/linuxptp/files/linuxptp-3.1.1-user_cpp.patch
@@ -0,0 +1,11 @@
+--- a/incdefs.sh
++++ b/incdefs.sh
+@@ -27,7 +27,7 @@
+       printf " -D_GNU_SOURCE"
+ 
+       # Get list of directories searched for header files.
+-      dirs=$(echo "" | ${CROSS_COMPILE}cpp -Wp,-v 2>&1 >/dev/null | grep ^" 
/")
++      dirs=$(echo "" | ${CPP} -Wp,-v - 2>&1 >/dev/null | grep ^" /")
+ 
+       # Look for clock_adjtime().
+       for d in $dirs; do

diff --git a/net-misc/linuxptp/linuxptp-3.1.1.ebuild 
b/net-misc/linuxptp/linuxptp-3.1.1.ebuild
index faae13c19360..281c2325d00b 100644
--- a/net-misc/linuxptp/linuxptp-3.1.1.ebuild
+++ b/net-misc/linuxptp/linuxptp-3.1.1.ebuild
@@ -17,13 +17,17 @@ DEPEND="elibc_musl? ( sys-libs/queue-standalone )"
 
 CONFIG_CHECK="~NETWORK_PHY_TIMESTAMPING ~PPS ~PTP_1588_CLOCK"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-3.1.1-user_cpp.patch
+)
+
 pkg_setup() {
        linux-info_pkg_setup
 }
 
 src_compile() {
        # parse needed additional CFLAGS
-       export MY_FLAGS=$(./incdefs.sh)
+       export MY_FLAGS=$(CPP="$(tc-getCPP)" ./incdefs.sh)
        export EXTRA_CFLAGS="${CFLAGS} ${MY_FLAGS}"
        emake CC="$(tc-getCC)" prefix=/usr mandir=/usr/share/man
 }

Reply via email to