Updates to the linuxptp recipe
v2 cover Updates to the linuxptp recipe
In this serie I am itroducing templates for the systemd services, to increase the portability and I'm also reducing the number of downstream patches.
Changes from v1:
- serie was not building with clang:
https://errors.yoctoproject.org/Errors/Details/739959/
Fixed the issue introducing a new patch that should be upstreamable.
Luca Fancellu (2):
linuxptp: Drop unneeded downstream patches
linuxptp: Use templates for the systemd services
.../0002-linuxptp-Use-CC-in-incdefs.sh.patch | 34 ++++++++++++++++++
.../linuxptp/Use-cross-cpp-in-incdefs.patch | 28 ---------------
...-Allow-CC-and-prefix-to-be-overriden.patch | 35 -------------------
.../{[email protected] => [email protected]} | 2 +-
.../{[email protected] => [email protected]} | 2 +-
.../linuxptp/linuxptp_4.1.bb | 18 ++++++----
6 files changed, 47 insertions(+), 72 deletions(-)
create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/0002-linuxptp-Use-CC-in-incdefs.sh.patch
delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/Use-cross-cpp-in-incdefs.patch
delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/build-Allow-CC-and-prefix-to-be-overriden.patch
rename meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] => [email protected]} (85%)
rename meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] => [email protected]} (73%)Signature · 1 line
2.34.1
PATCH v2 1/2 linuxptp: Drop unneeded downstream patches
Drop Use-cross-cpp-in-incdefs.patch which is "Inappropriate" but what is fixing can be done in an "Upstreamable" way by the new downstream patch 0002-linuxptp-Use-CC-in-incdefs.sh.patch.
Drop build-Allow-CC-and-prefix-to-be-overriden.patch that can be removed by passing CC='${CC}' in EXTRA_OEMAKE and, as already the case, passing prefix=${prefix} in the oe_runmake command line.
While there, drop ARCH from EXTRA_OEMAKE because it's not used in the codebase.
--- .../0002-linuxptp-Use-CC-in-incdefs.sh.patch | 34 ++++++++++++++++++ .../linuxptp/Use-cross-cpp-in-incdefs.patch | 28 --------------- ...-Allow-CC-and-prefix-to-be-overriden.patch | 35 ------------------- .../linuxptp/linuxptp_4.1.bb | 5 ++- 4 files changed, 36 insertions(+), 66 deletions(-) create mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/0002-linuxptp-Use-CC-in-incdefs.sh.patch delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/Use-cross-cpp-in-incdefs.patch delete mode 100644 meta-oe/recipes-connectivity/linuxptp/linuxptp/build-Allow-CC-and-prefix-to-be-overriden.patch
meta-oe/recipes-connectivity/linuxptp/linuxptp/0002-linuxptp-Use-CC-in-incdefs.sh.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 2cc19a679ec37715df546dd9f00d8d9b0ab20059 Mon Sep 17 00:00:00 2001 +From: Luca Fancellu <[email protected]> +Date: Wed, 18 Oct 2023 11:10:18 +0100 +Subject: [PATCH] linuxptp: Use ${CC} in incdefs.sh + +The Makefile is defining CC and incdefs.sh is using +${CROSS_COMPILE}cpp inside it, allowing both to use different +compilers depending on what the user pass during make invocation +as CC. + +Align them using ${CC} also inside incdefs.sh + +Signed-off-by: Luca Fancellu <[email protected]> +Upstream-Status: Pending +--- + incdefs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/incdefs.sh b/incdefs.sh +index a9e94f777f6b..391e63c7fac6 100755 +--- a/incdefs.sh ++++ b/incdefs.sh +@@ -27,7 +27,7 @@ user_flags() + 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=$(${CC} -E -Wp,-v -xc /dev/null 2>&1 >/dev/null | grep ^" /") + + # Look for clock_adjtime(). + for d in $dirs; do +-- +2.34.1 +
meta-oe/recipes-connectivity/linuxptp/linuxptp/Use-cross-cpp-in-incdefs.patch deleted +0 -28
@@ -1,28 +0,0 @@ -From be8808005772da48c052cf34a343a6d140541f6a Mon Sep 17 00:00:00 2001 -From: Marcel Ziswiler <[email protected]> -Date: Fri, 23 Dec 2016 18:12:29 +0100 -Subject: [PATCH] linuxptp: Use cross cpp in incdefs - -Use cross cpp incdefs.sh shell script since we are doing cross compiling -we need to ensure we use correct setttings from toolchain - -Upstream-Status: Inappropriate [OE-Specific] -Signed-off-by: Khem Raj <[email protected]> - ---- - incdefs.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/incdefs.sh b/incdefs.sh -index a9e94f7..dd1692f 100755 ---- a/incdefs.sh -+++ b/incdefs.sh -@@ -27,7 +27,7 @@ user_flags() - 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=$(${CPP} -Wp,-v -xc /dev/null 2>&1 >/dev/null | grep ^" /") - - # Look for clock_adjtime(). - for d in $dirs; do
meta-oe/recipes-connectivity/linuxptp/linuxptp/build-Allow-CC-and-prefix-to-be-overriden.patch deleted +0 -35
@@ -1,35 +0,0 @@ -From 886bca11ff8fcc55386b6e4397b13e64950f93fb Mon Sep 17 00:00:00 2001 -From: Otavio Salvador <[email protected]> -Date: Tue, 1 Jul 2014 17:37:31 -0300 -Subject: [PATCH] build: Allow CC and prefix to be overriden - -Upstream-Status: Pending - -Signed-off-by: Otavio Salvador <[email protected]> - ---- - makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/makefile b/makefile -index 3e3b8b3..5c1a1f9 100644 ---- a/makefile -+++ b/makefile -@@ -18,7 +18,7 @@ - KBUILD_OUTPUT ?= - - DEBUG = --CC = $(CROSS_COMPILE)gcc -+CC ?= $(CROSS_COMPILE)gcc - VER = -DVER=$(version) - CFLAGS = -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_CFLAGS) - LDLIBS = -lm -lrt -pthread $(EXTRA_LDFLAGS) -@@ -43,7 +43,7 @@ incdefs := $(shell $(srcdir)/incdefs.sh) - version := $(shell $(srcdir)/version.sh $(srcdir)) - VPATH = $(srcdir) - --prefix = /usr/local -+prefix ?= /usr/local - sbindir = $(prefix)/sbin - mandir = $(prefix)/man - man8dir = $(mandir)/man8
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +2 -3
@@ -8,9 +8,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" LINUXPTP_SRC_URI = "http://sourceforge.net/projects/linuxptp" SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \ - file://build-Allow-CC-and-prefix-to-be-overriden.patch \ - file://Use-cross-cpp-in-incdefs.patch \ file://0001-include-string.h-for-strncpy.patch \ + file://0002-linuxptp-Use-CC-in-incdefs.sh.patch \ file://systemd/[email protected] \ file://systemd/[email protected] \ "
@@ -23,7 +22,7 @@ inherit systemd UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/" UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/" -EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} EXTRA_CFLAGS='${CFLAGS}' mandir=${mandir}" +EXTRA_OEMAKE = "CC='${CC}' EXTRA_CFLAGS='${CFLAGS}' mandir='${mandir}'" export KBUILD_OUTPUT="${RECIPE_SYSROOT}"
Signature · 1 line
2.34.1
PATCH v2 2/2 linuxptp: Use templates for the systemd services
In reply to Luca FancelluUse templates for the systemd services so that sbindir and sysconfdir can be written into them, improving portability.
Pass sbindir with EXTRA_OEMAKE and remove 'prefix' which is redundant since we pass sbindir and mandir already.
---
.../{[email protected] => [email protected]} | 2 +-
.../systemd/{[email protected] => [email protected]} | 2 +-
.../recipes-connectivity/linuxptp/linuxptp_4.1.bb | 15 ++++++++++-----
3 files changed, 12 insertions(+), 7 deletions(-)
rename meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] => [email protected]} (85%)
rename meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] => [email protected]} (73%)meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] renamed from meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] +1 -1
@@ -7,7 +7,7 @@ Before=time-sync.target [Service] Type=simple -ExecStart=/usr/sbin/phc2sys -w -s %I +ExecStart=@SBINDIR@/phc2sys -w -s %I [Install] WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] renamed from meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] +1 -1
@@ -5,7 +5,7 @@ After=sys-subsystem-net-devices-%i.device [Service] Type=simple -ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I +ExecStart=@SBINDIR@/ptp4l -f @SYSCONFDIR@/linuxptp/ptp4l.conf -i %I [Install] WantedBy=multi-user.target
meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb +10 -5
@@ -10,8 +10,8 @@ LINUXPTP_SRC_URI = "http://sourceforge.net/projects/linuxptp" SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \ file://0001-include-string.h-for-strncpy.patch \ file://0002-linuxptp-Use-CC-in-incdefs.sh.patch \ - file://systemd/[email protected] \ - file://systemd/[email protected] \ + file://systemd/[email protected] \ + file://systemd/[email protected] \ " SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938"
@@ -22,14 +22,15 @@ inherit systemd UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/" UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/" -EXTRA_OEMAKE = "CC='${CC}' EXTRA_CFLAGS='${CFLAGS}' mandir='${mandir}'" +EXTRA_OEMAKE = "CC='${CC}' EXTRA_CFLAGS='${CFLAGS}' mandir='${mandir}' \ + sbindir='${sbindir}'" export KBUILD_OUTPUT="${RECIPE_SYSROOT}" LINUXPTP_SYSTEMD_SERVICES = "[email protected] [email protected]" do_install() { - oe_runmake install DESTDIR=${D} prefix=${prefix} + oe_runmake install DESTDIR=${D} # Install example configs from source tree install -d ${D}${docdir}/${PN}
@@ -44,7 +45,11 @@ do_install() { # Install systemd services install -d ${D}/${systemd_unitdir}/system/ for service in ${LINUXPTP_SYSTEMD_SERVICES}; do - install -m 644 ${WORKDIR}/systemd/$service \ + sed -i -e 's,@SBINDIR@,${sbindir},g' \ + ${WORKDIR}/systemd/$service.in + sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + ${WORKDIR}/systemd/$service.in + install -m 644 ${WORKDIR}/systemd/$service.in \ ${D}/${systemd_unitdir}/system/$service done }
Signature · 1 line
2.34.1