[OE-core] [PATCH] libucontext: Fix multilib build

Khem Raj raj.khem at gmail.com
Tue Mar 17 18:32:20 UTC 2020


libdir is hardcoded to /lib which is not going to work in multilib
scene, patch makefile to add a variable to override the libdir from env

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 .../0001-Makefile-Add-LIBDIR-variable.patch   | 46 +++++++++++++++++++
 meta/recipes-core/musl/libucontext_git.bb     |  3 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/musl/libucontext/0001-Makefile-Add-LIBDIR-variable.patch

diff --git a/meta/recipes-core/musl/libucontext/0001-Makefile-Add-LIBDIR-variable.patch b/meta/recipes-core/musl/libucontext/0001-Makefile-Add-LIBDIR-variable.patch
new file mode 100644
index 0000000000..4f91c8f189
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext/0001-Makefile-Add-LIBDIR-variable.patch
@@ -0,0 +1,46 @@
+From 9bc3cedba54708c40c4a853b240c46e69f87de3c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Tue, 17 Mar 2020 10:04:40 -0700
+Subject: [PATCH] Makefile: Add LIBDIR variable
+
+This ensures that it can be installed into custom location and also
+
+Upstream-Status: Submitted
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ ARCH := $(shell uname -m)
+-
++LIBDIR := /lib
+ CFLAGS = -ggdb3 -O2 -Wall -Iarch/${ARCH}
+ 
+ LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c)
+@@ -10,8 +10,8 @@ LIBUCONTEXT_SOVERSION = 0
+ LIBUCONTEXT_NAME = libucontext.so
+ LIBUCONTEXT_STATIC_NAME = libucontext.a
+ LIBUCONTEXT_SONAME = libucontext.so.${LIBUCONTEXT_SOVERSION}
+-LIBUCONTEXT_PATH = /lib/${LIBUCONTEXT_SONAME}
+-LIBUCONTEXT_STATIC_PATH = /lib/${LIBUCONTEXT_STATIC_NAME}
++LIBUCONTEXT_PATH = ${LIBDIR}/${LIBUCONTEXT_SONAME}
++LIBUCONTEXT_STATIC_PATH = ${LIBDIR}/${LIBUCONTEXT_STATIC_NAME}
+ 
+ all: ${LIBUCONTEXT_SONAME} ${LIBUCONTEXT_STATIC_NAME}
+ 
+@@ -36,9 +36,9 @@ clean:
+ 		${LIBUCONTEXT_OBJ} test_libucontext
+ 
+ install: all
+-	install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}/${LIBUCONTEXT_PATH}
+-	install -D -m664 ${LIBUCONTEXT_STATIC_NAME} ${DESTDIR}/${LIBUCONTEXT_STATIC_PATH}
+-	ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}/lib/${LIBUCONTEXT_NAME}
++	install -D -m755 ${LIBUCONTEXT_NAME} ${DESTDIR}${LIBUCONTEXT_PATH}
++	install -D -m664 ${LIBUCONTEXT_STATIC_NAME} ${DESTDIR}${LIBUCONTEXT_STATIC_PATH}
++	ln -sf ${LIBUCONTEXT_SONAME} ${DESTDIR}${LIBDIR}/${LIBUCONTEXT_NAME}
+ 
+ check: test_libucontext ${LIBUCONTEXT_SONAME}
+ 	env LD_LIBRARY_PATH=$(shell pwd) ./test_libucontext
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_git.bb
index 72e15aa9a4..92cb703b0b 100644
--- a/meta/recipes-core/musl/libucontext_git.bb
+++ b/meta/recipes-core/musl/libucontext_git.bb
@@ -12,6 +12,7 @@ PV = "0.1.3+${SRCPV}"
 SRCREV = "e6b4d7516dae9b200e94fcfcb9ebc9331389655f"
 SRC_URI = "git://code.foxkit.us/adelie/libucontext.git;protocol=https \
            file://0001-pass-LDFLAGS-to-link-step.patch \
+           file://0001-Makefile-Add-LIBDIR-variable.patch \
 "
 
 S = "${WORKDIR}/git"
@@ -51,7 +52,7 @@ export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
 
 CFLAGS += "-Iarch/${ARCH}"
 
-EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
+EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' LIBDIR='${base_libdir}'"
 
 do_compile() {
     oe_runmake ARCH=${ARCH}
-- 
2.25.1



More information about the Openembedded-core mailing list