From: Carsten Schlote <c.schl...@konzeptpark.de> This patch adds support for eglibc to ptxdist. It adds an eglibc packet and all needed changes to find the correct toolchain. Adds a new copy function to copy target binaries in toolchain sysroot (e.g. ldconfig) to the ipkg.
See corresponding changes for OSELAS toolchain with eglibc support. Signed-off-by: Carsten Schlote <c.schl...@konzeptpark.de> --- bin/ptxdist | 5 +- platforms/toolchain.in | 8 +- rules/eglibc.in | 240 +++++++++++++++++++++++++++++++++++++ rules/eglibc.make | 213 ++++++++++++++++++++++++++++++++ rules/libc.in | 25 ++++ rules/locales.in | 4 +- rules/post/install.make | 18 +++- rules/pre/Version.make | 1 + rules/timezone.in | 2 +- scripts/install_copy_toolchain.sh | 73 +++++++++++- 10 files changed, 577 insertions(+), 12 deletions(-) create mode 100644 rules/eglibc.in create mode 100644 rules/eglibc.make diff --git a/bin/ptxdist b/bin/ptxdist index c96c03d..0a0395b 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -1500,10 +1500,13 @@ do_select_toolchain_guess() java="${java:+java-}" # libc + local eglibc_select="$(ptxd_get_ptxconf PTXCONF_LIBC_EGLIBC)" local glibc_version="$(ptxd_get_ptxconf PTXCONF_GLIBC_VERSION)" local uclibc_version="$(ptxd_get_ptxconf PTXCONF_UCLIBC_VERSION)" - if [ -n "${glibc_version}" ]; then + if [ -n "${eglibc_select}" ]; then + libc="eglibc-${glibc_version}-" + elif [ -n "${glibc_version}" ]; then libc="glibc-${glibc_version}-" elif [ -n "${uclibc_version}" ]; then libc="glibc-${uclibc_version}-" diff --git a/platforms/toolchain.in b/platforms/toolchain.in index 097b5eb..4bdd9ca 100644 --- a/platforms/toolchain.in +++ b/platforms/toolchain.in @@ -28,12 +28,14 @@ config CROSSCHAIN_CHECK config GLIBC_VERSION string - prompt "check for specific glibc version" - default "2.8" + prompt "check for specific eglibc or glibc version" + default "2.10" help Specify the glibc version this BSP shall be built with. This information - is used to guess the toolchain path if you use "ptxdist toolchain" + is used to guess the toolchain path if you use "ptxdist toolchain" without an argument. + As eglibc is directly related to glibc, we use the same + config variable here. config GNU_TARGET string diff --git a/rules/eglibc.in b/rules/eglibc.in new file mode 100644 index 0000000..55909d8 --- /dev/null +++ b/rules/eglibc.in @@ -0,0 +1,240 @@ +## SECTION=libc + +config EGLIBC + tristate + select BASE + +if EGLIBC + +menu "eglibc " + depends on !PROJECT_USE_PRODUCTION + +comment "Install options" + +config EGLIBC_LD + bool + help + This is the dynamic loader (e.g.: "/lib/ld-2.8.90.so") + + You don't want to deselect this, unless you have a pure + static system. This is why this options hasn't a prompt. + +config EGLIBC_LDCONFIG + bool + prompt "Install ldconfig" + help + Install /sbin/ldconfig + +config EGLIBC_C + bool + default y + prompt "Install libc" + select EGLIBC_LD + help + Any Unix-like operating system needs a C library: + the library which defines the "system calls" and + other basic facilities such as open, malloc, printf, + exit... + + The GNU C library is used as the C library in the + GNU system and most systems with the Linux kernel. + + Better not turn this option off.. + +config EGLIBC_PTHREAD + bool + prompt "Install libpthread" + help + If at least one application on the target uses threads when executed + this library will be required. + +config EGLIBC_THREAD_DB + bool + prompt "Install libthread_db" + help + If at least one application on the target uses threads when executed + and you are going to debug this application (also remotely!), this + library will be required. You can omit this library, if you never + intend to debug multithread application on your target. + +config EGLIBC_RT + bool + prompt "Install librt" + help + Functions in this library provide most of the interfaces specified by + the POSIX.1b Realtime Extension + +config EGLIBC_DL + bool + prompt "Install libdl" + help + libdl.so is a dynamic linking library that is generally of use only for + porting applications. If you are porting a BeOS application that requires + dlopen, dlclose, dlerror, dlsym, dladdr, or dlfcn.h, then you can use this + library. + + libdl.so is a wrapper to the add-on functions with the semantics of the dl + (dynamic linking) library. This is used for finding shared objects at run + time. If the items are not found the program can continue to run. + + It is extremely similar to the add-on mechanism in BeOS with some semantics + changes. If you are developing your own app, you almost definitely want to + use add-ons unless you are already familiar with libdl. In this case you may + be disappointed since it is possible that I have implemented part of it wrong. + + If you want your application to have cross platform compatibility with this + functionality you should probably use libtool instead. It is much more cross + platform compatible than dlopen, etc. It also supports BeOS. See related links. + +config EGLIBC_CRYPT + bool + prompt "Install libcrypt" + help + The encryption/decryption library + +config EGLIBC_UTIL + bool + prompt "Install libutil" + help + Contains code for "standard" functions used in many different Unix + utilities. + +config EGLIBC_M + bool + prompt "Install libm" + help + If at least one application on your target does any kind of math + calculation, you should install this library. + +config EGLIBC_NSS_DNS + bool + prompt "Install libnss_dns" + select EGLIBC_RESOLV + help + Contains functions for name resolution to ip addresses and vice versa + +config EGLIBC_NSS_FILES + bool + prompt "Install libnss_files" + help + Contains functions to access some vitale system control files (for + login for example) and for name resolution to ip addresses. + +config EGLIBC_NSS_HESIOD + bool + prompt "Install libnss_hesiod" + select EGLIBC_RESOLV + select EGLIBC_NSS_FILES + help + FIXME: This item needs to be documented + +config EGLIBC_NSS_NIS + bool + prompt "Install libnss_nis" + select EGLIBC_NSL + select EGLIBC_NSS_FILES + help + FIXME: This item needs to be documented + +config EGLIBC_NSS_NISPLUS + bool + prompt "Install libnss_nisplus" + select EGLIBC_NSL + help + FIXME: This item needs to be documented + +config EGLIBC_NSS_COMPAT + bool + prompt "Install libnss_compat" + select EGLIBC_NSL + help + FIXME: This item needs to be documented + +config EGLIBC_RESOLV + bool + prompt "Install libresolv" +# select EGLIBC_NSS_FILES +# select EGLIBC_NSS_DNS + help + This library is required for creating, sending, and interpreting + packets to and from the internet domain name service. This library + needs some file for configuration: /etc/nsswitch.conf and /etc/resolv.conf. + Refer man pages for both files and how to setup them. To use any kind + of DNS, you must provide your own /etc/nsswitch.conf and + /etc/resolv.conf files. See menu "Root Filesystem -> config files -> /etc/nsswitch.conf" + You will also need libnss_files if this name resolution should base + on local files like /etc/hosts and libnss_dns if the name resolution + should work with an external dynamic name resolution service. You + will need both libraries if your /etc/nsswitch.conf contains a line + like "hosts: file dns" + +config EGLIBC_NSL + bool + prompt "Install libnsl" + help + Functions in this library provide routines that provide a + transport-level interface to networking services like i.E. + nis(+) + + +config EGLIBC_I18N_BIN_LOCALE + bool + prompt "Install locale" + help + The locale program writes information about the current + locale environment, or all locales, to standard output. + +config EGLIBC_I18N_BIN_LOCALEDEF + bool + prompt "Install localedef" + help + The localedef program reads the indicated charmap and + input files, compiles them to a binary form quickly usable + by the locale functions in the C library, and add it to + /usr/lib/locale/locale-archive + +config EGLIBC_I18N_RAWDATA + bool + prompt "Install i18n locales and charmaps" + depends on EGLIBC_I18N_BIN_LOCALEDEF + help + With the i18n datasets you can generate new locales in running + system. This will, however, increase the installation size + unneccessarily if you don't want to change your system locale + often. Hence we recommend to use the "System locale" option in + ptxdist to determine locales while building the system. + +menu "Install gconv libraries " + +config EGLIBC_GCONF_BASE + bool + +config EGLIBC_GCONV_DEF + bool + prompt "default gconv modules" + select EGLIBC_GCONF_BASE + default y + help + install the iso8859-1 (Latin Alphabet No.1) and the iso8859-15 (Latin + Alphabet No.9) encoding modules into gconv, this should be ok for most + western languages + +config EGLIBC_GCONV_UTF + bool + prompt "gconv modules for UTF" + select EGLIBC_GCONF_BASE + help + install the gconv modules for UTF conversion + +config EGLIBC_GCONV_ZH + bool + prompt "gconv modules for chinese language" + select EGLIBC_GCONF_BASE + help + install the gconv modules for chinese language, including BIG5 + and GB18030 + +endmenu +endmenu + +endif diff --git a/rules/eglibc.make b/rules/eglibc.make new file mode 100644 index 0000000..b6af0d2 --- /dev/null +++ b/rules/eglibc.make @@ -0,0 +1,213 @@ +# -*-makefile-*- +# +# Copyright (C) 2002 by Pengutronix e.K., Hildesheim, Germany +# 2003 by Auerswald GmbH & Co. KG, Schandelah, Germany +# 2005-2009 by Marc Kleine-Budde <m...@pengutronix.de>, Pengutronix e.K., Hildesheim, Germany +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_EGLIBC) += eglibc + +# +# Paths and names +# +EGLIBC_VERSION := $(call remove_quotes,$(PTXCONF_GLIBC_VERSION)) +EGLIBC_LICENSE := GPLv2, LGPLv2.1 + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.get: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Extract +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.extract: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.prepare: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.compile: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.install: + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/eglibc.targetinstall: + @$(call targetinfo) + + @$(call install_init, eglibc) + @$(call install_fixup, eglibc,PACKAGE,eglibc) + @$(call install_fixup, eglibc,PRIORITY,optional) + @$(call install_fixup, eglibc,VERSION,$(EGLIBC_VERSION)) + @$(call install_fixup, eglibc,SECTION,base) + @$(call install_fixup, eglibc,AUTHOR,"Carsten Schlote <c.schl...@konzeptpark.de>") + @$(call install_fixup, eglibc,DEPENDS,) + @$(call install_fixup, eglibc,DESCRIPTION,missing) + +ifdef PTXCONF_EGLIBC_LD + @$(call install_copy_toolchain_dl, eglibc, /lib) +endif + +ifdef PTXCONF_EGLIBC_C + @$(call install_copy_toolchain_lib, eglibc, libc.so.6) +endif + +ifdef PTXCONF_EGLIBC_PTHREAD + @$(call install_copy_toolchain_lib, eglibc, libpthread.so) +endif + +ifdef PTXCONF_EGLIBC_THREAD_DB + @$(call install_copy_toolchain_lib, eglibc, libthread_db.so) +endif + +ifdef PTXCONF_EGLIBC_RT + @$(call install_copy_toolchain_lib, eglibc, librt.so) +endif + +ifdef PTXCONF_EGLIBC_DL + @$(call install_copy_toolchain_lib, eglibc, libdl.so.2) + @$(call install_link, eglibc, ../../lib/libdl.so.2, /usr/lib/libdl.so) +endif + +ifdef PTXCONF_EGLIBC_CRYPT + @$(call install_copy_toolchain_lib, eglibc, libcrypt.so) +endif + +ifdef PTXCONF_EGLIBC_UTIL + @$(call install_copy_toolchain_lib, eglibc, libutil.so) +endif + +ifdef PTXCONF_EGLIBC_M + @$(call install_copy_toolchain_lib, eglibc, libm.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_DNS + @$(call install_copy_toolchain_lib, eglibc, libnss_dns.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_FILES + @$(call install_copy_toolchain_lib, eglibc, libnss_files.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_HESIOD + @$(call install_copy_toolchain_lib, eglibc, libnss_hesiod.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_NIS + @$(call install_copy_toolchain_lib, eglibc, libnss_nis.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_NISPLUS + @$(call install_copy_toolchain_lib, eglibc, libnss_nisplus.so) +endif + +ifdef PTXCONF_EGLIBC_NSS_COMPAT + @$(call install_copy_toolchain_lib, eglibc, libnss_compat.so) +endif + +ifdef PTXCONF_EGLIBC_RESOLV + @$(call install_copy_toolchain_lib, eglibc, libresolv.so) +endif + +ifdef PTXCONF_EGLIBC_NSL + @$(call install_copy_toolchain_lib, eglibc, libnsl.so) +endif + +ifdef PTXCONF_EGLIBC_GCONF_BASE + @$(call install_copy, eglibc, 0, 0, 0755, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/gconv-modules, /usr/lib/gconv) +endif + +ifdef PTXCONF_EGLIBC_GCONV_DEF + @$(call install_copy_toolchain_lib, eglibc, gconv/ISO8859-1.so, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/ISO8859-15.so, /usr/lib/gconv) +endif + +ifdef PTXCONF_EGLIBC_GCONV_UTF + @$(call install_copy_toolchain_lib, eglibc, gconv/UNICODE.so, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/UTF-16.so, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/UTF-32.so, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/UTF-7.so, /usr/lib/gconv) +endif + +ifdef PTXCONF_EGLIBC_GCONV_ZH + @$(call install_copy_toolchain_lib, eglibc, gconv/GBBIG5.so, /usr/lib/gconv) + @$(call install_copy_toolchain_lib, eglibc, gconv/GB18030.so, /usr/lib/gconv) +endif + +ifdef PTXCONF_EGLIBC_I18N_BIN_LOCALE + @$(call install_copy_toolchain_usr, eglibc, bin/locale) +endif + +ifdef PTXCONF_EGLIBC_I18N_BIN_LOCALEDEF + @$(call install_copy_toolchain_usr, eglibc, bin/localedef) +endif + +ifdef PTXCONF_EGLIBC_I18N_RAWDATA + @$(call install_copy_toolchain_usr, eglibc, share/i18n/charmaps/*) + @$(call install_copy_toolchain_usr, eglibc, share/i18n/locales/*) + @$(call install_copy_toolchain_usr, eglibc, share/locale/locale.alias) +endif + +ifdef PTXCONF_LOCALES + @$(call install_copy_toolchain_usr, eglibc, share/locale/locale.alias) +endif + +ifdef PTXCONF_EGLIBC_LDCONFIG + @$(call install_copy_toolchain_other, eglibc, sbin/ldconfig) +endif + +# Zonefiles are BROKEN +# @$(call install_copy, eglibc, 0, 0, 0755, /usr/share/zoneinfo) +# @for target in $(EGLIBC_ZONEFILES-y); do \ +# $(call install_copy, eglibc, 0, 0, 0644, \ +# $(EGLIBC_ZONEDIR)/zoneinfo/$$target, \ +# /usr/share/zoneinfo/$$target) \ +# done; + @$(call install_finish, eglibc) + + @$(call touch) + +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +eglibc_clean: + rm -rf $(STATEDIR)/eglibc.* + rm -rf $(PKGDIR)/eglibc_* + + +# vim: syntax=make diff --git a/rules/libc.in b/rules/libc.in index d72c57c..f7ddb6a 100644 --- a/rules/libc.in +++ b/rules/libc.in @@ -3,6 +3,7 @@ menuconfig LIBC tristate prompt "c library " + select EGLIBC if LIBC_EGLIBC select GLIBC if LIBC_GLIBC select UCLIBC if LIBC_UCLIBC default y @@ -13,6 +14,14 @@ choice prompt "c library " default GLIBC + config LIBC_EGLIBC + bool + prompt "eglibc " + help + This menu entry lets you select components from the + standard C library called eglibc. It depends on the + system what components are required. + config LIBC_GLIBC bool prompt "glibc " @@ -30,76 +39,92 @@ source "generated/libc.in" config LIBC_C bool + select EGLIBC_C if LIBC_EGLIBC select GLIBC_C if LIBC_GLIBC select UCLIBC_C if LIBC_UCLIBC config LIBC_PTHREAD bool + select EGLIBC_PTHREAD if LIBC_EGLIBC select GLIBC_PTHREAD if LIBC_GLIBC select UCLIBC_PTHREAD if LIBC_UCLIBC config LIBC_THREAD_DB bool + select EGLIBC_PTHREAD if LIBC_EGLIBC select GLIBC_THREAD_DB if LIBC_GLIBC select UCLIBC_THREAD_DB if LIBC_UCLIBC config LIBC_RT bool + select EGLIBC_RT if LIBC_EGLIBC select GLIBC_RT if LIBC_GLIBC select UCLIBC_RT if LIBC_UCLIBC config LIBC_DL bool + select EGLIBC_DL if LIBC_EGLIBC select GLIBC_DL if LIBC_GLIBC select UCLIBC_DL if LIBC_UCLIBC config LIBC_CRYPT bool + select EGLIBC_CRYPT if LIBC_EGLIBC select GLIBC_CRYPT if LIBC_GLIBC select UCLIBC_CRYPT if LIBC_UCLIBC config LIBC_UTIL bool + select EGLIBC_UTIL if LIBC_EGLIBC select GLIBC_UTIL if LIBC_GLIBC select UCLIBC_UTIL if LIBC_UCLIBC config LIBC_M bool + select EGLIBC_M if LIBC_EGLIBC select GLIBC_M if LIBC_GLIBC select UCLIBC_M if LIBC_UCLIBC config LIBC_NSS_DNS bool + select EGLIBC_NSS_DNS if LIBC_EGLIBC select GLIBC_NSS_DNS if LIBC_GLIBC config LIBC_NSS_FILES bool + select EGLIBC_NSS_FILES if LIBC_EGLIBC select GLIBC_NSS_FILES if LIBC_GLIBC config LIBC_NSS_HESIOD bool + select EGLIBC_NSS_HESIOD if LIBC_EGLIBC select GLIBC_NSS_HESIOD if LIBC_GLIBC config LIBC_NSS_NIS bool + select EGLIBC_NSS_NIS if LIBC_EGLIBC select GLIBC_NSS_NIS if LIBC_GLIBC config LIBC_NSS_NISPLUS bool + select EGLIBC_NSS_NISPLUS if LIBC_EGLIBC select GLIBC_NSS_NISPLUS if LIBC_GLIBC config LIBC_NSS_COMPAT bool + select EGLIBC_NSS_COMPAT if LIBC_EGLIBC select GLIBC_NSS_COMPAT if LIBC_GLIBC config LIBC_RESOLV bool + select EGLIBC_RESOLV if LIBC_EGLIBC select GLIBC_RESOLV if LIBC_GLIBC select UCLIBC_RESOLV if LIBC_UCLIBC config LIBC_NSL bool + select EGLIBC_NSL if LIBC_EGLIBC select GLIBC_NSL if LIBC_GLIBC select UCLIBC_NSL if LIBC_UCLIBC diff --git a/rules/locales.in b/rules/locales.in index 71c0127..86c9b8d 100644 --- a/rules/locales.in +++ b/rules/locales.in @@ -3,8 +3,8 @@ menuconfig LOCALES tristate prompt "system locales " - depends on GLIBC - select HOST_LOCALEDEF + depends on GLIBC || EGLIBC + select HOST_LOCALEDEF if EGLIBC || GLIBC help select this to enable locale installation, otherwise your system will only support locales "C" and "POSIX" diff --git a/rules/post/install.make b/rules/post/install.make index 3a86afe..4d01736 100644 --- a/rules/post/install.make +++ b/rules/post/install.make @@ -250,7 +250,7 @@ install_copy_toolchain_dl = \ $(SCRIPTSDIR)/install_copy_toolchain.sh -p "$${PACKET}" -l LINKER $${DST} -s "$${STRIP}" # -# install_copy_toolchain_other +# install_copy_toolchain_usr # # $1: packet label # $2: source @@ -267,6 +267,22 @@ install_copy_toolchain_usr = \ $(SCRIPTSDIR)/install_copy_toolchain.sh -p "$${PACKET}" -u "$${LIB}" $${DST} -s "$${STRIP}" # +# install_copy_toolchain_other +# +# $1: packet label +# $2: source +# $3: destination +# $4: strip (y|n) default is to strip +# +install_copy_toolchain_other = \ + PACKET=$(strip $(1)); \ + SRC="$(strip $2)"; \ + DST="$(strip $2)"; \ + STRIP="$(strip $3)"; \ + test "$${DST}" != "" && DST="-d $${DST}"; \ + ${CROSS_ENV_CC} $(CROSS_ENV_STRIP) PKGDIR="$(PKGDIR)" \ + $(SCRIPTSDIR)/install_copy_toolchain.sh -p "$${PACKET}" -o "$${SRC}" $${DST} -s "$${STRIP}" +# # install_link # # Installs a soft link in root directory in an ipkg packet. diff --git a/rules/pre/Version.make b/rules/pre/Version.make index 5ebc827..83a9245 100644 --- a/rules/pre/Version.make +++ b/rules/pre/Version.make @@ -15,6 +15,7 @@ GCC_VERSION_MAJOR := $(word 1,$(_version_temp)) GCC_VERSION_MINOR := $(word 2,$(_version_temp)) GCC_VERSION_MICRO := $(word 3,$(_version_temp)) +# Note: eglibc and glibc use same config GLIBC_VERSION := $(call remove_quotes,$(PTXCONF_GLIBC_VERSION)) _version_temp := $(subst ., ,$(GLIBC_VERSION)) GLIBC_VERSION_MAJOR := $(word 1,$(_version_temp)) diff --git a/rules/timezone.in b/rules/timezone.in index 9d27789..ce0f1b5 100644 --- a/rules/timezone.in +++ b/rules/timezone.in @@ -6,7 +6,7 @@ comment "and prio versions, hence marked as broken for now" menuconfig TIMEZONE tristate prompt "Timezone Files " - depends on GLIBC + depends on EGLIBC || GLIBC depends on BROKEN help installs timezone files diff --git a/scripts/install_copy_toolchain.sh b/scripts/install_copy_toolchain.sh index 8bfa490..cf498d5 100755 --- a/scripts/install_copy_toolchain.sh +++ b/scripts/install_copy_toolchain.sh @@ -274,7 +274,7 @@ ptxd_install_toolchain_lib() { } -_ptxd_get_sysroot_usr_by_sysroot() { +_ptxd_get_sysroot_by_sysroot() { local sysroot sysroot="$(echo 'int main(void){return 0;}' | \ @@ -283,6 +283,16 @@ _ptxd_get_sysroot_usr_by_sysroot() { test -n "${sysroot}" || return 1 + echo "$(ptxd_abspath ${sysroot})" +} + +_ptxd_get_sysroot_usr_by_sysroot() { + local sysroot + + sysroot="$(_ptxd_get_sysroot_by_sysroot)" + + test -n "${sysroot}" || return 1 + echo "$(ptxd_abspath ${sysroot}/usr)" } @@ -308,12 +318,22 @@ _ptxd_get_sysroot_usr_by_progname() { } +ptxd_get_sysroot() { + local sysroot + + sysroot="$(_ptxd_get_sysroot_by_sysroot)" || + sysroot="$(_ptxd_get_sysroot_usr_by_progname)" || + ( echo "unable to identify your SYSROOT, giving up"; return $? ) + + echo "${sysroot}" +} + ptxd_get_sysroot_usr() { local sysroot_usr sysroot_usr="$(_ptxd_get_sysroot_usr_by_sysroot)" || sysroot_usr="$(_ptxd_get_sysroot_usr_by_progname)" || - ( echo "unable to identify your SYSROOT, giving up"; return $? ) + ( echo "unable to identify your SYSROOT/usr, giving up"; return $? ) echo "${sysroot_usr}" } @@ -359,11 +379,51 @@ ptxd_install_toolchain_usr() { done } +# +# $@: +# usr=<what to copy> +# packet=<packet> +# dest=<dest in sysroot> +# strip=<true or false> +# +ptxd_install_toolchain_othr() { + local sysroot othr usr_src usr_perm + + eval "$...@}" + + sysroot="$(ptxd_get_sysroot)" || return $? + + if test -z "$(find ${sysroot} -path "${sysroot}/${othr}" -a \! -type d)"; then + echo "file ${othr} not found" + fi + + find ${sysroot} -path "${sysroot}/${othr}" -a \! -type d | while read usr_src; do + eval $(stat -c"usr_perm=%a" "${usr_src}") + usr_dst="${usr_src#${sysroot}}" + + echo "other - ${usr_dst}" + + for dir in \ + "${ROOTDIR}" \ + "${ROOTDIR_DEBUG}" \ + "${PKGDIR}/${packet}.tmp/ipkg"; do + + install -m "${usr_perm}" -D "${usr_src}" "${dir}${usr_dst}" + done + + if "${strip}"; then + ${STRIP} "${ROOTDIR}${usr_dst}" + ${STRIP} "${PKGDIR}/${packet}.tmp/ipkg${usr_dst}" + fi + echo "f:${usr_dst}:0:0:${usr_perm}" >> "${STATEDIR}/${packet}.perms" + done +} + ptxd_install_copy_toolchain() { - local args opt lib usr + local args opt lib othr usr - while getopts "p:l:u:d:s::" opt; do + while getopts "p:l:o:u:d:s::" opt; do case "${opt}" in p) args="${args} packet=\"${OPTARG}\"" @@ -371,6 +431,9 @@ ptxd_install_copy_toolchain() { l) lib="${OPTARG}" ;; + o) + othr="${OPTARG}" + ;; u) usr="${OPTARG}" ;; @@ -396,6 +459,8 @@ ptxd_install_copy_toolchain() { fi lib_path="$(ptxd_get_lib_path "${lib}")" || return $? ptxd_install_toolchain_lib "${args}" lib_path="${lib_path}" || return $? + elif test -n "${othr}"; then + ptxd_install_toolchain_othr "${args}" "othr=${othr}" || return $? elif test -n "${usr}"; then ptxd_install_toolchain_usr "${args}" "usr=${usr}" || return $? fi -- 1.6.5.6.gb3118 -- ptxdist mailing list ptxdist@pengutronix.de