4 BASEDIR
=$
(dirname ${0})
5 source ${BASEDIR}/find-common
7 # BUILDROOT is the first argument.
12 if [ "$(uname -m)" = "x86_64" ]; then
23 # Walk through all file files and see what we have got here.
26 */usr
/lib
/debug
/*|
*/usr
/src
/debug
/*)
27 # Skip all debuginfo files.
31 # Skip all gconv files.
35 # Skip all kernel modules because they do not
36 # require anything at all.
40 # Find all pkg-config files.
41 pkgconfig_files
="${pkgconfig_files} ${file}"
45 # Find all perl modules.
46 if [ -r "${file}" ]; then
47 perl_files
="${perl_files} ${file}"
54 # Sort out all python files.
55 # Directories are processed bewlow.
57 */usr
/lib
/python
*|
*/usr
/lib64
/python
*)
58 # This will only get the python directory.
59 file=$
(basename ${file})
61 # Strip the python version from the string.
62 python_version
="${file#python}"
64 if [ -n "${python_version}" ]; then
65 echo "python-abi = ${python_version}"
71 # Unresolved symlinks.
72 if [ -L "${file}" ]; then
74 link
=$
(readlink
-m ${file})
76 # If destination does not exist, make
77 # a dependency for it.
78 if ! [ -e "${link}" ]; then
79 echo "${link#${BUILDROOT}}"
82 # Don't search for anything else, because
83 # symlinks do not require anything but the target file.
87 # Search for all binary files.
88 if file_is_elf
${file}; then
89 binary_files
="${binary_files} ${file}"
93 # Search for script files.
94 if file_is_script
${file}; then
95 script_files
="${script_files} ${file}"
100 # Process script files.
102 for file in ${script_files}; do
103 [ -r ${file} -a -x ${file} ] ||
continue
105 interp
=$
(file_get_script_interpreter
${file})
106 interpreters
="${interpreters} ${interp}"
108 # Collect all perl files.
111 perl_files
="${perl_files} ${file}"
116 # Output the list of needed interpreters.
117 [ -n "${interpreters}" ] && { echo ${interpreters} | tr '[:blank:]' \\n | sort -u ; }
119 # Search for binary interpreters.
120 for file in ${binary_files}; do
121 # Get the interpreter.
122 interp=$(file_get_elf_interpreter ${file})
124 # Skip the interpreter if it is provided by this
126 [ -e "${BUILDROOT}${interp}" ] && continue
128 # Print the interpreter.
132 # Weak symbol versions (from glibc).
133 [ -n "${mark64}" ] && mark64="(64bit
)"
134 for file in ${binary_files}; do
135 [ -r ${file} ] || continue
137 lib64=$(if file_is_64bit ${file}; then echo "${mark64}"; fi)
138 objdump -p ${file} 2>/dev/null | awk 'BEGIN { START=0; LIBNAME=""; }
140 /^Dynamic Section:$/ { START=1; }
141 (START==1) && /NEEDED/ {
142 if ("'${lib64}'" != "") {
143 sub(/$/, "()'${lib64}'", $2);
147 (START==2) && /^[A-Za-z]/ { START=3; }
148 /^Version References:$/ { START=2; }
149 (START==2) && /required from/ {
153 (START==2) && (LIBNAME!="") && ($4!="") {
154 print LIBNAME "(" $4 ")'${lib64}'";
158 # Search for perl requires.
159 if [ -n "${perl_files}" ] && [ -x /usr/bin/perl ]; then
160 perl ${BASEDIR}/perl.req ${perl_files} | sort -u
163 # Search for pkg-config requires.
164 pkgconfig=$(which pkg-config)
165 if [ -n "${pkgconfig}" -a -x "${pkgconfig}" ]; then
166 for file in ${pkgconfig_files}; do
167 # The dependency for the pkgconfig package itself.
170 ${pkgconfig} --print-requires --print-requires-private "${file}" 2> /dev/null | while read n r v ; do
171 echo "pkgconfig
(${n})" "${r}" "${v}"