[2/5] eglibc: add support for /etc/ld.so.conf.d/*.conf

Submitted by Yue Tao on Nov. 27, 2013, 7:55 a.m.

Details

Message ID 1385538944-8585-2-git-send-email-Yue.Tao@windriver.com
State New
Headers show

Commit Message

Yue Tao Nov. 27, 2013, 7:55 a.m.
From: Ming Liu <ming.liu@windriver.com>

There are advantages in changing the contents of ld.so.conf to
"include /etc/ld.so.conf.d/*.conf" instead of directly listing directories
in it, just like most distributions are doing the same.

Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
 meta/recipes-core/eglibc/eglibc-package.inc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/eglibc/eglibc-package.inc b/meta/recipes-core/eglibc/eglibc-package.inc
index 3adf1a9..b46cc3b 100644
--- a/meta/recipes-core/eglibc/eglibc-package.inc
+++ b/meta/recipes-core/eglibc/eglibc-package.inc
@@ -33,7 +33,7 @@  RPROVIDES_${PN}-pcprofile = "glibc-pcprofile"
 RPROVIDES_${PN}-dbg = "glibc-dbg"
 libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
 
-FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
+FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf ${sysconfdir}/ld.so.conf.d', '', d)}"
 FILES_ldd = "${bindir}/ldd"
 FILES_libsegfault = "${base_libdir}/libSegFault*"
 FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
@@ -97,6 +97,11 @@  do_install_append () {
 		if [ -d ${D}${sysconfdir} ]; then
 			rmdir ${D}${sysconfdir}
 		fi
+	else
+		if [ -f ${D}${sysconfdir}/ld.so.conf ]; then
+		echo 'include ld.so.conf.d/*.conf' > ${D}${sysconfdir}/ld.so.conf
+			mkdir -p ${D}${sysconfdir}/ld.so.conf.d
+		fi
 	fi
 }
 

Comments

Phil Blundell Nov. 27, 2013, 12:46 p.m.
On Wed, 2013-11-27 at 15:55 +0800, Yue Tao wrote:
> +	else
> +		if [ -f ${D}${sysconfdir}/ld.so.conf ]; then
> +		echo 'include ld.so.conf.d/*.conf' > ${D}${sysconfdir}/ld.so.conf
> +			mkdir -p ${D}${sysconfdir}/ld.so.conf.d
> +		fi

This will cause the existing contents of ld.so.conf to be obliterated if
the file wasn't empty to begin with.  (I know that it is empty in
oe-core, but a distro layer might be overlaying this file with its own.)

Also, it seems as though the choice of whether to use an "ld.so.conf.d"
arrangement or not is one that the distro should be making.  Is there a
strong reason why this needs to be done in oe-core?

p.
Martin Jansa Nov. 27, 2013, 1:50 p.m.
On Wed, Nov 27, 2013 at 03:55:41PM +0800, Yue Tao wrote:
> From: Ming Liu <ming.liu@windriver.com>
> 
> There are advantages in changing the contents of ld.so.conf to
> "include /etc/ld.so.conf.d/*.conf" instead of directly listing directories
> in it, just like most distributions are doing the same.
> 
> Signed-off-by: Ming Liu <ming.liu@windriver.com>
> ---
>  meta/recipes-core/eglibc/eglibc-package.inc |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/recipes-core/eglibc/eglibc-package.inc b/meta/recipes-core/eglibc/eglibc-package.inc
> index 3adf1a9..b46cc3b 100644
> --- a/meta/recipes-core/eglibc/eglibc-package.inc
> +++ b/meta/recipes-core/eglibc/eglibc-package.inc
> @@ -33,7 +33,7 @@ RPROVIDES_${PN}-pcprofile = "glibc-pcprofile"
>  RPROVIDES_${PN}-dbg = "glibc-dbg"
>  libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
>  
> -FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
> +FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf ${sysconfdir}/ld.so.conf.d', '', d)}"
>  FILES_ldd = "${bindir}/ldd"
>  FILES_libsegfault = "${base_libdir}/libSegFault*"
>  FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
> @@ -97,6 +97,11 @@ do_install_append () {
>  		if [ -d ${D}${sysconfdir} ]; then
>  			rmdir ${D}${sysconfdir}
>  		fi
> +	else
> +		if [ -f ${D}${sysconfdir}/ld.so.conf ]; then
> +		echo 'include ld.so.conf.d/*.conf' > ${D}${sysconfdir}/ld.so.conf
> +			mkdir -p ${D}${sysconfdir}/ld.so.conf.d
> +		fi

I think that to make this feature really useful this would need to be
executed in runtime (before ldconfig is executed).

I would like to different components to add their own conf files to
${D}${sysconfdir}/ld.so.conf.d and let ldconfig executed in do_rootfs to
find them, but they won't be there when eglibc.do_install is executed.

>  	fi
>  }
>  
> -- 
> 1.7.5.4
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core