diff mbox series

[meta-swupdate,v2] swupdate: Fix build with mulilib builds

Message ID 20200317055332.2934768-1-raj.khem@gmail.com
State Superseded
Headers show
Series [meta-swupdate,v2] swupdate: Fix build with mulilib builds | expand

Commit Message

Khem Raj March 17, 2020, 5:53 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Fix typo swupdate -> swupdate.sh in sed

 recipes-support/swupdate/swupdate.inc         |  4 ++
 ...LIBDIR-instead-of-hardcoding-usr-lib.patch | 50 +++++++++++++++++++
 recipes-support/swupdate/swupdate/swupdate    |  2 +-
 .../swupdate/swupdate/swupdate.service        |  2 +-
 recipes-support/swupdate/swupdate/swupdate.sh |  4 +-
 5 files changed, 58 insertions(+), 4 deletions(-)
 create mode 100644 recipes-support/swupdate/swupdate/0001-build-Define-LIBDIR-instead-of-hardcoding-usr-lib.patch
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 2e20b88..2d45c52 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -8,6 +8,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 inherit cml1 update-rc.d systemd pkgconfig
 
 SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=https \
+    file://0001-build-Define-LIBDIR-instead-of-hardcoding-usr-lib.patch \
     file://defconfig \
     file://swupdate \
     file://swupdate.sh \
@@ -210,15 +211,18 @@  do_install () {
 
     install -d ${D}${sysconfdir}/init.d
     install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
+    sed -i s:@libdir@:${libdir}:g ${D}${sysconfdir}/init.d/swupdate
 
     # shell based configuration loader allows to place code snippets into this folder
     install -d ${D}${libdir}/swupdate/conf.d
     install -m 755 ${WORKDIR}/swupdate.sh ${D}${libdir}/swupdate
+    sed -i s:@libdir@:${libdir}:g ${D}${libdir}/swupdate/swupdate.sh
     if ${SWUPDATE_MONGOOSE}; then
         install -m 644 ${WORKDIR}/10-mongoose-args ${D}${libdir}/swupdate/conf.d/
     fi
     install -d ${D}${systemd_unitdir}/system
     install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_system_unitdir}
+    sed -i s:@libdir@:${libdir}:g ${D}${systemd_system_unitdir}/swupdate.service
     install -m 644 ${WORKDIR}/swupdate.socket.tmpl ${D}${systemd_system_unitdir}/swupdate.socket
     sed -e "s,@@SWUPDATE_SOCKET_CTRL_PATH@@,${SWUPDATE_SOCKET_CTRL_PATH},g" \
         -e "s,@@SWUPDATE_SOCKET_PROGRESS_PATH@@,${SWUPDATE_SOCKET_PROGRESS_PATH},g" \
diff --git a/recipes-support/swupdate/swupdate/0001-build-Define-LIBDIR-instead-of-hardcoding-usr-lib.patch b/recipes-support/swupdate/swupdate/0001-build-Define-LIBDIR-instead-of-hardcoding-usr-lib.patch
new file mode 100644
index 0000000..3003fb1
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/0001-build-Define-LIBDIR-instead-of-hardcoding-usr-lib.patch
@@ -0,0 +1,50 @@ 
+From 739eae75c4f82c654c5dc78a2c2fb17cf8448752 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 16 Mar 2020 19:41:45 -0700
+Subject: [PATCH] build: Define LIBDIR instead of hardcoding /usr/lib
+
+This helps swupdate build in multilib setup in yocto
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 943e013..37cfced 100644
+--- a/Makefile
++++ b/Makefile
+@@ -38,6 +38,7 @@ ifndef KBUILD_VERBOSE
+   KBUILD_VERBOSE = 0
+ endif
+ 
++LIBDIR ?= "/usr/lib"
+ # kbuild supports saving output files in a separate directory.
+ # To locate output files in a separate directory two syntaxes are supported.
+ # In both cases the working directory must be the root of the kernel src.
+@@ -448,7 +449,7 @@ ${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
+ install: all
+ 	install -d ${DESTDIR}/usr/bin
+ 	install -d ${DESTDIR}/usr/include
+-	install -d ${DESTDIR}/usr/lib
++	install -d ${DESTDIR}/${LIBDIR}
+ 	install -m 755 swupdate ${DESTDIR}/usr/bin
+ 	for i in ${tools-bins};do \
+ 		install -m 755 $$i ${DESTDIR}/usr/bin; \
+@@ -456,10 +457,10 @@ install: all
+ 	install -m 0644 include/network_ipc.h ${DESTDIR}/usr/include
+ 	install -m 0644 include/swupdate_status.h ${DESTDIR}/usr/include
+ 	install -m 0644 include/progress_ipc.h ${DESTDIR}/usr/include
+-	install -m 0755 ipc/lib.a ${DESTDIR}/usr/lib/libswupdate.a
++	install -m 0755 ipc/lib.a ${DESTDIR}${LIBDIR}/libswupdate.a
+ 	if [ $(HAVE_LUA) = y ]; then \
+-		install -d ${DESTDIR}/usr/lib/lua/$(LUAVER); \
+-		install -m 0755 ${lua_swupdate} $(DESTDIR)/usr/lib/lua/$(LUAVER); \
++		install -d ${DESTDIR}${LIBDIR}/lua/$(LUAVER); \
++		install -m 0755 ${lua_swupdate} ${DESTDIR}${LIBDIR}/lua/$(LUAVER); \
+ 	fi
+ 
+ PHONY += run-tests
+-- 
+2.25.1
+
diff --git a/recipes-support/swupdate/swupdate/swupdate b/recipes-support/swupdate/swupdate/swupdate
index 5ef894f..6b4097c 100644
--- a/recipes-support/swupdate/swupdate/swupdate
+++ b/recipes-support/swupdate/swupdate/swupdate
@@ -30,7 +30,7 @@  PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
 DESC="swupdate"
 NAME="swupdate"
-DAEMON=/usr/lib/swupdate/swupdate.sh
+DAEMON=@libdir@/swupdate/swupdate.sh
 PIDFILE=/var/run/$NAME.pid
 
 . /etc/init.d/functions || exit 1
diff --git a/recipes-support/swupdate/swupdate/swupdate.service b/recipes-support/swupdate/swupdate/swupdate.service
index a3d8d19..95bcee0 100644
--- a/recipes-support/swupdate/swupdate/swupdate.service
+++ b/recipes-support/swupdate/swupdate/swupdate.service
@@ -4,7 +4,7 @@  Documentation=https://github.com/sbabic/swupdate
 Documentation=https://sbabic.github.io/swupdate
 
 [Service]
-ExecStart=/usr/lib/swupdate/swupdate.sh
+ExecStart=@libdir@/swupdate/swupdate.sh
 KillMode=mixed
 
 [Install]
diff --git a/recipes-support/swupdate/swupdate/swupdate.sh b/recipes-support/swupdate/swupdate/swupdate.sh
index 8798e2d..86ba913 100644
--- a/recipes-support/swupdate/swupdate/swupdate.sh
+++ b/recipes-support/swupdate/swupdate/swupdate.sh
@@ -8,11 +8,11 @@  SWUPDATE_SURICATTA_ARGS=""
 
 # source all files from /etc/swupdate/conf.d and /usr/lib/swupdate/conf.d/
 # A file found in /etc replaces the same file in /usr
-for f in `(test -d /usr/lib/swupdate/conf.d/ && ls -1 /usr/lib/swupdate/conf.d/; test -d /etc/swupdate/conf.d && ls -1 /etc/swupdate/conf.d) | sort -u`; do
+for f in `(test -d @libdir@/swupdate/conf.d/ && ls -1 @libdir@/swupdate/conf.d/; test -d /etc/swupdate/conf.d && ls -1 /etc/swupdate/conf.d) | sort -u`; do
   if [ -f /etc/swupdate/conf.d/$f ]; then
     . /etc/swupdate/conf.d/$f
   else
-    . /usr/lib/swupdate/conf.d/$f
+    . @libdir@/swupdate/conf.d/$f
   fi
 done