Hi, I replicate most of the stuff from https://github.com/openembedded/openembedded-core/tree/master/meta/recipes-c... but I was not able to find a better solution.
Regards, d.
Signed-off-by: Diego Buffa diego.buffa@gmail.com --- .../include/external-linaro-toolchain-versions.inc | 3 + .../external-linaro-toolchain.bb | 6 +- .../external-linaro-toolchain/files/makedbs.sh | 177 ++++++++++++++++ .../glibc-linaro-package.inc | 232 +++++++++++++++++++++ 4 files changed, 416 insertions(+), 2 deletions(-) create mode 100755 meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/makedbs.sh create mode 100644 meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/glibc-linaro-package.inc
diff --git a/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc index 2a99209..1f82052 100644 --- a/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc +++ b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc @@ -37,6 +37,9 @@ def elt_get_main_version(d): if version.split()[5] == '(crosstool-NG': # gcc version 4.9.1 20140529 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.08 - Linaro GCC 4.9-2014.08) return version.split()[6].split('-')[3] + if version.split()[7] == '(Linaro': + # gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) + return version.split()[9].split(')')[0] bb.error('Failed to parse external Linaro toolchain version from: %s' % version) else: return version diff --git a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb index e0fb3eb..4382806 100644 --- a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb +++ b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb @@ -1,4 +1,4 @@ -require recipes-core/glibc/glibc-package.inc +require glibc-linaro-package.inc
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_PACKAGE_STRIP = "1" @@ -54,7 +54,9 @@ PROVIDES += "\ PV = "${ELT_VER_MAIN}"
# https://launchpad.net/linaro-toolchain-binaries -SRC_URI = "file://SUPPORTED" +SRC_URI = "file://SUPPORTED \ + file://makedbs.sh \ +"
do_install() { # Add stubs for files OE-core expects diff --git a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/makedbs.sh b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/makedbs.sh new file mode 100755 index 0000000..7d51a67 --- /dev/null +++ b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/makedbs.sh @@ -0,0 +1,177 @@ +#!/bin/sh + +# +# Make passwd.db, group.db, etc. +# + +VAR_DB=/var/db + +# Use make if available +if [ -x /usr/bin/make -o -x /bin/make ]; then + make -C $VAR_DB + exit 0 +fi + +# No make available, do it in hard way + +# passwd.db +if [ -e /etc/passwd ]; then +target=$VAR_DB/passwd.db +echo -n "passwd... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print }' /etc/passwd | \ +makedb --quiet -o $target - +echo "done." +fi + +# group.db +if [ -e /etc/group ]; then +target=$VAR_DB/group.db +echo -n "group... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print; \ + if ($$4 != "") { \ + split($$4, grmems, ","); \ + for (memidx in grmems) { \ + mem=grmems[memidx]; \ + if (members[mem] == "") \ + members[mem]=$$3; \ + else \ + members[mem]=members[mem] "," $$3; \ + } \ + delete grmems; } } \ + END { for (mem in members) \ + printf ":%s %s %s\n", mem, mem, members[mem]; }' /etc/group | \ +makedb --quiet -o $target - +echo "done." +fi + +# ethers.db +if [ -e /etc/ethers ]; then +target=$VAR_DB/ethers.db +echo -n "ethers... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print }' /etc/ethers | \ +makedb --quiet -o $target - +echo "done." +fi + +# protocols.db +if [ -e /etc/protocols ]; then +target=$VAR_DB/protocols.db +echo -n "protocols... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/protocols | \ +makedb --quiet -o $target - +echo "done." +fi + +# rpc.db +if [ -e /etc/rpc ]; then +target=$VAR_DB/rpc.db +echo -n "rpc... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/rpc | \ +makedb --quiet -o $target - +echo "done." +fi + +# services.db +if [ -e /etc/services ]; then +target=$VAR_DB/services.db +echo -n "services... " +awk 'BEGIN { FS="[ \t/]+" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { sub(/[ \t]*#.*$$/, "");\ + printf ":%s/%s ", $$1, $$3; print; \ + printf ":%s/ ", $$1; print; \ + printf "=%s/%s ", $$2, $$3; print; \ + printf "=%s/ ", $$2; print; \ + for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ":%s/%s ", $$i, $$3; print; \ + printf ":%s/ ", $$i; print } }' /etc/services | \ +makedb --quiet -o $target - +echo "done." +fi + +# shadow.db +if [ -e /etc/shadow ]; then +target=$VAR_DB/shadow.db +echo -n "shadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/shadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target; + echo + echo "Warning: The shadow password database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the `shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# gshadow.db +if [ -e /etc/gshadow ]; then +target=$VAR_DB/gshadow.db +echo -n "gshadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/gshadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target + echo + echo "Warning: The shadow group database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the `shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# netgroup.db +if [ -e /etc/netgroup ]; then +target=$VAR_DB/netgroup.db +echo -n "netgroup... " +awk 'BEGIN { ini=1 } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { if (sub(/[ \t]*\$$/, " ") == 0) end="\n"; \ + else end=""; \ + gsub(/[ \t]+/, " "); \ + sub(/^[ \t]*/, ""); \ + if (ini == 0) printf "%s%s", $$0, end; \ + else printf ".%s %s%s", $$1, $$0, end; \ + ini=end == "" ? 0 : 1; } \ + END { if (ini==0) printf "\n" }' /etc/netgroup | \ +makedb --quiet -o $target +echo "done." +fi diff --git a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/glibc-linaro-package.inc b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/glibc-linaro-package.inc new file mode 100644 index 0000000..afa3862 --- /dev/null +++ b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/glibc-linaro-package.inc @@ -0,0 +1,232 @@ +INHIBIT_SYSROOT_STRIP = "1" + +PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" + +# The ld.so in this glibc supports the GNU_HASH +RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)" +RPROVIDES_${PN}-utils = "eglibc-utils" +RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace" +RPROVIDES_${PN}-pic = "eglibc-pic" +RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev" +RPROVIDES_${PN}-staticdev = "eglibc-staticdev" +RPROVIDES_${PN}-doc = "eglibc-doc" +RPROVIDES_glibc-extra-nss = "eglibc-extra-nss" +RPROVIDES_glibc-thread-db = "eglibc-thread-db" +RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile" +RPROVIDES_${PN}-dbg = "eglibc-dbg" +libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.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" +libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1" +INSANE_SKIP_${PN}_append_aarch64 = " libdir" + +FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf" +FILES_ldd = "${bindir}/ldd" +FILES_libsegfault = "${base_libdir}/libSegFault*" +FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*" +FILES_libmemusage = "${base_libdir}/libmemusage.so" +FILES_libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh" +RDEPENDS_libnss-db = "${PN}-utils" +FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" +FILES_sln = "${base_sbindir}/sln" +FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" +FILES_libsotruss = "${libdir}/audit/sotruss-lib.so" +FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" +FILES_${PN}-dev += "${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal" +FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" +FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_unitdir}/system/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \ + ${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd" +FILES_${PN}-mtrace = "${bindir}/mtrace" +FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump" +FILES_${PN}-utils = "${bindir}/* ${sbindir}/*" +FILES_catchsegv = "${bindir}/catchsegv" +RDEPENDS_catchsegv = "libsegfault" +FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so" +FILES_glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so" +RPROVIDES_${PN}-dev += "libc-dev" +RPROVIDES_${PN}-staticdev += "libc-staticdev" + +SUMMARY_sln = "The static ln" +DESCRIPTION_sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional." +SUMMARY_nscd = "Name service cache daemon" +DESCRIPTION_nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services." +SUMMARY_glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries" +DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services." +SUMMARY_ldd = "print shared library dependencies" +DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line." +SUMMARY_${PN}-utils = "Miscellaneous utilities provided by glibc" +DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, ..." +DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs" +DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect" + +inherit libc-common multilib_header + +do_install_append () { + rm -f ${D}${sysconfdir}/localtime + + # remove empty glibc dir + if [ -d ${D}${libexecdir} ]; then + rmdir --ignore-fail-on-non-empty ${D}${libexecdir} + fi + + oe_multilib_header bits/syscall.h bits/long-double.h + + if [ -f ${D}${bindir}/mtrace ]; then + sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace + fi + # Info dir listing isn't interesting at this point so remove it if it exists. + if [ -e "${D}${infodir}/dir" ]; then + rm -f ${D}${infodir}/dir + fi + + if ! ${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', 'true', 'false', d)}; then + # The distro doesn't want these files so let's not install them + rm -f ${D}${sysconfdir}/ld.so.conf + rm -f ${D}${base_sbindir}/ldconfig + # This directory will be empty now so remove it too. + # But check whether it exists first, since it won't for glibc-initial. + if [ -d ${D}${sysconfdir} ]; then + rmdir ${D}${sysconfdir} + fi + fi + + if echo ${PN}|grep -q "glibc-initial"; then + return + fi + + install -d ${D}${sysconfdir}/init.d + install -d ${D}${localstatedir}/db/nscd + install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd + install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf + install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db + sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd + sed -i "s|(enable-cache\t+netgroup\t+)yes|\1no|" ${D}${sysconfdir}/nscd.conf + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_unitdir}/system/ + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/nscd 755 root root -" \ + > ${D}${sysconfdir}/tmpfiles.d/nscd.conf + else + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 /var/run/nscd none" \ + > ${D}${sysconfdir}/default/volatiles/98_nscd + fi +} + +do_install_append_aarch64 () { + if [ "${base_libdir}" != "${nonarch_base_libdir}" ]; then + # The aarch64 ABI says the dynamic linker -must- be /lib/ld-linux-aarch64[_be].so.1 + install -d ${D}${nonarch_base_libdir} + if [ -e ${D}${base_libdir}/ld-linux-aarch64.so.1 ]; then + ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64.so.1 \ + ${D}${nonarch_base_libdir}/ld-linux-aarch64.so.1 + elif [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ]; then + ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64_be.so.1 \ + ${D}${nonarch_base_libdir}/ld-linux-aarch64_be.so.1 + fi + fi + do_install_armmultilib +} + +do_install_append_arm () { + do_install_armmultilib +} + +do_install_append_armeb () { + do_install_armmultilib +} + +do_install_armmultilib () { + oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h bits/wordsize.h + oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/sem.h bits/semaphore.h bits/setjmp.h + oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h + + oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h + + oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h +} + + +LOCALESTASH = "${WORKDIR}/stashed-locale" +bashscripts = "mtrace sotruss xtrace" + +do_stash_locale () { + dest=${LOCALESTASH} + install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir} + if [ "${base_libdir}" != "${libdir}" ]; then + cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir} + fi + if [ -e ${D}${bindir}/localedef ]; then + mv -f ${D}${bindir}/localedef ${dest}${bindir} + fi + if [ -e ${D}${libdir}/gconv ]; then + mv -f ${D}${libdir}/gconv ${dest}${libdir} + fi + if [ -e ${D}${exec_prefix}/lib ]; then + cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix} + fi + if [ -e ${D}${datadir}/i18n ]; then + mv ${D}${datadir}/i18n ${dest}${datadir} + fi + cp -fpPR ${D}${datadir}/* ${dest}${datadir} + rm -rf ${D}${datadir}/locale/ + cp -fpPR ${WORKDIR}/SUPPORTED ${dest} + + target=${dest}/scripts + mkdir -p $target + for i in ${bashscripts}; do + if [ -f ${D}${bindir}/$i ]; then + cp ${D}${bindir}/$i $target/ + fi + done +} + +addtask do_stash_locale after do_install before do_populate_sysroot do_package +do_stash_locale[dirs] = "${B}" +do_stash_locale[cleandirs] = "${LOCALESTASH}" +SSTATETASKS += "do_stash_locale" +do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}" +do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" +do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" + +python do_stash_locale_setscene () { + sstate_setscene(d) +} +addtask do_stash_locale_setscene + +do_poststash_install_cleanup () { + # Remove all files which do_stash_locale would remove (mv) + # since that task could have come from sstate and not get run. + for i in ${bashscripts}; do + rm -f ${D}${bindir}/$i + done + rm -f ${D}${bindir}/localedef + rm -rf ${D}${datadir}/i18n + rm -rf ${D}${libdir}/gconv + rm -rf ${D}/${localedir} + rm -rf ${D}${datadir}/locale + if [ "${libdir}" != "${exec_prefix}/lib" ]; then + if [ -d ${D}${exec_prefix}/lib ]; then + # error out if directory isn't empty + # this dir should only contain locale dir + # which has been deleted in the previous step + rmdir ${D}${exec_prefix}/lib + fi + fi +} +addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package + +pkg_postinst_nscd () { + if [ -z "$D" ]; then + if command -v systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} +CONFFILES_nscd="${sysconfdir}/nscd.conf" + +SYSTEMD_PACKAGES = "nscd" +SYSTEMD_SERVICE_nscd = "nscd.service"