From: Armin Kuster <akuster808@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Armin Kuster <akuster@mvista.com>
Subject: [PATCH 1/2] ldconfig: add method to extend ldconfig search dirs
Date: Wed, 11 Nov 2015 09:41:46 -0800 [thread overview]
Message-ID: <1447263707-27696-2-git-send-email-akuster808@gmail.com> (raw)
In-Reply-To: <1447263707-27696-1-git-send-email-akuster808@gmail.com>
From: Armin Kuster <akuster@mvista.com>
this provides a method to extend the search path ldconfig-native
uses when creating ls.so.cache.
To enable in recipe:
add:
inherit ldconfig
LDSOCONF = "/opt/lib"
this will create a ld.so.conf file in work-shared/ldconfig/${PN}/
to create an image with these new search paths included, add to local.conf:
INHERIT += "image-ldconfig"
this will take all the ${PN}/ld.so.conf files and create a single ld.so.conf
that will be used by ldconfig-native when building an image.
Signed-off-by: Armin Kuster <akuster@mvista.com>
---
meta/classes/image-ldconfig.bbclass | 26 ++++++++++++++++++++++++++
meta/classes/ldconfig.bbclass | 27 +++++++++++++++++++++++++++
meta/conf/bitbake.conf | 5 +++++
3 files changed, 58 insertions(+)
create mode 100644 meta/classes/image-ldconfig.bbclass
create mode 100644 meta/classes/ldconfig.bbclass
diff --git a/meta/classes/image-ldconfig.bbclass b/meta/classes/image-ldconfig.bbclass
new file mode 100644
index 0000000..e9946da
--- /dev/null
+++ b/meta/classes/image-ldconfig.bbclass
@@ -0,0 +1,26 @@
+#
+# To enable, use INHERIT in local.conf:
+#
+# INHERIT += "image-ldconfig"
+
+do_rootfs[depends] += "ldconfig-native:do_populate_sysroot"
+
+IMAGE_PREPROCESS_COMMAND += "ld_so_conf; "
+
+ld_so_conf() {
+
+ rm -f ${STAGING_DIR_NATIVE}${sysconfdir_native}/ld.so.conf
+
+ # save lib dirs as defined in recipes
+ for file in `find ${STAGING_LDSO_CONF_DIR}/*/* -name "ld.so.conf"`;
+ do
+ cat ${file} >> ${STAGING_LDSO_CONF_DIR}/ld.so.conf
+ done
+
+ # remove dups and sort
+ cat ${STAGING_LDSO_CONF_DIR}/ld.so.conf | sort -u > ${IMAGE_ROOTFS}/etc/ld.so.conf
+
+ # this seems to work if at rootfs location.
+ cd ${IMAGE_ROOTFS}
+ ${STAGING_DIR_NATIVE}${bindir_native}/ldconfig -r . -c new -f etc/ld.so.conf
+}
diff --git a/meta/classes/ldconfig.bbclass b/meta/classes/ldconfig.bbclass
new file mode 100644
index 0000000..558122f
--- /dev/null
+++ b/meta/classes/ldconfig.bbclass
@@ -0,0 +1,27 @@
+# Allows adding libs or alt lib locations to be included
+# during ld.so.cache creation.
+#
+#
+
+do_package[postfuncs] += "save_ld_so_conf "
+do_clean[cleandirs] += "${STAGING_LDSO_CONF_DIR}/${PN} "
+
+python save_ld_so_conf() {
+ import os
+
+ if (d.getVar('USE_LDCONFIG', True) or "1") == "1":
+ ldsodir = d.getVar('STAGING_LDSO_CONF_DIR', True)
+ if not os.path.isdir(ldsodir):
+ os.mkdir(ldsodir)
+
+ staging_ld = os.path.join(ldsodir, d.expand("${PN}"))
+ if not os.path.isdir(staging_ld):
+ os.mkdir(staging_ld)
+
+ ldsofile = os.path.join(staging_ld, 'ld.so.conf')
+
+ ldconf = d.getVar('LDSOCONF', True).split()
+ with open(ldsofile, 'w') as lsdo:
+ for ldso_entry in ldconf:
+ lsdo.write(ldso_entry+"\n")
+}
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 06971da..f0471f4 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -811,3 +811,8 @@ BB_SIGNATURE_EXCLUDE_FLAGS ?= "doc deps depends \
MLPREFIX ??= ""
MULTILIB_VARIANTS ??= ""
+
+#
+# ldconfig stuff
+#
+STAGING_LDSO_CONF_DIR = "${TMPDIR}/work-shared/ldconfig"
--
2.3.5
next prev parent reply other threads:[~2015-11-11 17:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 17:41 [PATCH 0/2] Add ldconfig alt lib search paths Armin Kuster
2015-11-11 17:41 ` Armin Kuster [this message]
2015-12-08 16:33 ` [PATCH 1/2] ldconfig: add method to extend ldconfig search dirs akuster808
2015-12-08 17:51 ` Phil Blundell
[not found] ` <56674604.3030900@mvista.com>
2015-12-08 22:34 ` Phil Blundell
[not found] ` <566891A3.4040300@mvista.com>
2015-12-09 21:41 ` Phil Blundell
2015-11-11 17:41 ` [PATCH 2/2] ldsoconf: allow extension via local.conf Armin Kuster
2015-11-11 18:39 ` Khem Raj
2015-11-11 19:22 ` akuster808
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447263707-27696-2-git-send-email-akuster808@gmail.com \
--to=akuster808@gmail.com \
--cc=akuster@mvista.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox