Remove an obsolete, mis-leading comment in the glibc/eglibc common options.
/trunk/config/libc/glibc-eglibc.in-common | 6 0 6 0 ------
1 file changed, 6 deletions(-)
3 # This script will populate the root directory with libs from the sysroot.
4 # (C) 2007 Yann E. MORIN
5 # Licensed under the GPL v2
7 # Detect where the toolchain is:
8 BIN_DIR="$(cd "$(dirname "$0")"; pwd)"
9 CT_READELF="${BIN_DIR}/@@CT_TARGET@@-readelf"
10 CT_SYSROOT_DIR="${BIN_DIR}/../@@CT_TARGET@@/sys-root"
12 myname=$(basename "$0")
17 $myname - populate the target root file system
20 $myname OPTIONS -s source_root -d destination_root
23 $myname will 'populate' your target root file system ('src_dir') with
24 libraries from the toolchain (eg. libc.so...), storing the result into
29 use 'src_dir' as the un-populated (source) root directory
32 use 'dst_dir' as the place to put the populated root directory
35 Always add the specified shared library/ies name1, name2... from the
36 toolchain (in the sys-root). Actual library names are searched as
37 follows (where 'name' is replaced with the given name) in the
42 If the file is found, then the SONAME of the library is used, and the
43 library is copied with that name. If the library was not found, this
44 yields an error (unless -f was given).
47 Read 'file' for a list of shared libraries to always add from the
48 toolchain. The file should contain one library name per line; text
49 after a # is ignored until the end of the line; spaces are ignored;
50 empty lines are ignored. Libraries are searched for as with -l.
52 -f force execution: if destination directory already exists, it will be
53 removed first; if a specified library (above) was not found, continue.
66 while getopts ":s:d:l:L:fvh" CT_OPT; do
68 s) CT_ROOT_SRC_DIR="${OPTARG}";;
69 d) CT_ROOT_DST_DIR="${OPTARG}";;
70 l) CT_LIB_LIST="${CT_LIB_LIST}:${OPTARG}";;
71 L) CT_LIB_FILE="${OPTARG}";;
77 :) echo "$myname: '-${OPTARG}' takes exactly one argument."
80 ?) echo "$myname: unknown option '-${OPTARG}'."
87 if [ -z "${CT_ROOT_SRC_DIR}" -o -z "${CT_ROOT_DST_DIR}" ]; then
91 if [ ! -d "${CT_ROOT_SRC_DIR}" ]; then
92 echo "$myname: '${CT_ROOT_SRC_DIR}': no such file or directory"
95 if [ -d "${CT_ROOT_DST_DIR}" -a "${CT_FORCE}" != "y" ]; then
96 echo "$myname: '${CT_ROOT_DST_DIR}': already exists"
99 src_inode=$(ls -di "${CT_ROOT_SRC_DIR}")
100 dst_inode=$(ls -di "${CT_ROOT_DST_DIR}" 2>/dev/null)
101 if [ "${src_inode}" = "${dst_inode}" ]; then
102 echo "$myname: source and destination are the same!"
106 # Check existence of the forced libraries file
107 if [ -n "${CT_LIB_FILE}" -a ! \( -f "${CT_LIB_FILE}" -a -r "${CT_LIB_FILE}" \) ]; then
108 echo "$myname: forced libraries file '${CT_LIB_FILE}' not found!"
112 # Get rid of potentially older destination directory
113 if [ -d "${CT_ROOT_DST_DIR}" ]; then
114 mv "${CT_ROOT_DST_DIR}" "${CT_ROOT_DST_DIR}.$$"
115 setsid nohup rm -rf "${CT_ROOT_DST_DIR}.$$" >/dev/null 2>&1 &
118 # Create the working copy
119 mkdir -p "${CT_ROOT_DST_DIR}"
121 # Make all path absolute
122 CT_ROOT_SRC_DIR=$(cd "${CT_ROOT_SRC_DIR}"; pwd)
123 CT_ROOT_DST_DIR=$(cd "${CT_ROOT_DST_DIR}"; pwd)
125 pushd "${CT_ROOT_SRC_DIR}" >/dev/null
126 tar cf - . |(cd "${CT_ROOT_DST_DIR}"; tar xf -)
129 # A function do search for a library
130 # Usage: do_add_lib libname
131 # returns: 0 if library was found and added, !0 otherwise
137 ${CT_ECHO} -n " trying in '${dir}'"
138 libfile="${CT_SYSROOT_DIR}/${dir}/lib/${libname}"
139 ${CT_ECHO} ": '${libfile}'"
140 if [ -e "${libfile}" ]; then
141 mkdir -p "${dir}/lib"
142 true_libname=$("${CT_READELF}" -d "${libfile}" |egrep "SONAME" |sed -r -e 's,.+\[(.+)\] *$,\1,;')
143 ${CT_ECHO} " installing as '${dir}/lib/${true_libname}'"
144 cat "${libfile}" >"${dir}/lib/${true_libname}"
152 # First of, copy the forced libraries into the working copy
153 if [ -n "${CT_LIB_FILE}" ]; then
154 lib_list=$(sed -r -e ':loop; s/#.*//; s/[[:space:]]+//g; s/([^:])$/\1:/; /$/N; s/\n//; tloop;' "${CT_LIB_FILE}")
155 CT_LIB_LIST=$(echo "${CT_LIB_LIST}:${lib_list}" |sed -r -e 's/:+/:/g; s/^:+//; s/:+$//;')
157 CT_LIB_LIST="${CT_LIB_LIST//:/ }"
158 ${CT_ECHO} "Installing forced libraries..."
159 pushd "${CT_ROOT_DST_DIR}" >/dev/null
160 for name in ${CT_LIB_LIST}; do
161 [ -z "${name}" ] && continue
163 for libname in "lib${name}.so" "${name}.so" "${name}"; do
164 ${CT_ECHO} " searching for '${libname}'"
165 if do_add_lib "${libname}"; then
170 if [ ${found} -eq 0 ]; then
171 echo "$myname: library '${libname}' not found!"
172 [ "${CT_FORCE}" = y ] || exit 1
177 # Parse the working copy for executables and libraries
178 pushd "${CT_ROOT_DST_DIR}" >/dev/null
180 while [ ${still_needed} -eq 1 ]; do
181 ${CT_ECHO} "Looping..."
183 for f in $(find . -type f -exec file {} \; |egrep ': ELF [[:digit:]]+-bit .SB (executable|shared object),' |cut -d ":" -f 1); do
184 ${CT_ECHO} "Scanning '${f}'"
185 for libname in $("${CT_READELF}" -d "${f}" |egrep '(NEEDED)' |sed -r -e 's,.+\[(.+)\] *$,\1,;'); do
186 ${CT_ECHO} " searching for '${libname}'"
187 if [ -e "lib/${libname}" \
188 -o -e "usr/lib/${libname}" ]; then
189 ${CT_ECHO} " already present"
192 if do_add_lib "${libname}"; then
195 echo "$myname: library '${libname}' not found!"