5 # $top_builddir = well you guessed it
8 dstdir=${2:-`. ./.config 2>/dev/null && echo ${DEVEL_PREFIX}/include`}
14 test -d "$dir" && continue
15 echo "Error: '$dir' is not a directory"
21 # Ensure that created dirs/files have 755/644 perms
26 die_if_not_dir "${srcdir}"
27 mkdir -p "${dstdir}" 2>/dev/null
28 die_if_not_dir "${dstdir}"
29 die_if_not_dir "$top_builddir"
30 if ! test -x "$top_builddir/extra/scripts/unifdef"; then
31 echo "Error: need '$top_builddir/extra/scripts/unifdef' executable"
35 # Sanitize and copy uclibc headers
37 # We must cd, or else we will prepend "${srcdir}" to filenames!
38 cd "${srcdir}" || exit 1
39 find . ! -name '.' -a ! -path '*/.*' | sed -e 's/^\.\///' -e '/^config\//d' \
44 while read -r filename; do
45 if test -d "${srcdir}/$filename"; then
46 mkdir -p "${dstdir}/$filename" 2>/dev/null
49 if test x"${filename##libc-*.h}" = x""; then
50 # Do not install libc-XXXX.h files
53 # Do not abort the script if unifdef "fails"!
54 # NB2: careful with sed command arguments, they contain tab character
55 "$top_builddir/extra/scripts/unifdef" \
59 -f "$top_builddir/include/generated/unifdef_config.h" \
61 -U__UCLIBC_GEN_LOCALE \
63 "${srcdir}/$filename" \
64 | sed -e '/^rtld_hidden_proto[ ]*([a-zA-Z0-9_]*)$/d' \
65 | sed -e '/^lib\(c\|m\|resolv\|dl\|intl\|rt\|nsl\|util\|crypt\|pthread\)_hidden_proto[ ]*([a-zA-Z0-9_]*)$/d' \
66 > "${dstdir}/$filename"
72 cd "${dstdir}" || exit 1
73 chmod -R u=rwX,go=rX . >/dev/null 2>&1
74 chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$/\1:\2/'` . >/dev/null 2>&1
76 # ignore errors on unrelated files