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.
30 # Skip all kernel modules because they do not
31 # require anything at all.
35 # Find all pkg-config files.
36 pkgconfig_files
="${pkgconfig_files} ${file}"
40 # Find all perl modules.
41 if [ -r "${file}" ]; then
42 perl_files
="${perl_files} ${file}"
49 # Sort out all python files.
51 */usr
/lib
/python
*|
*/usr
/lib64
/python
*)
52 # This will only get the python directory.
53 file=$
(basename ${file})
55 # Strip the python version from the string.
56 python_version
="${file#python}"
58 if [ -n "${python_version}" ]; then
59 echo "python-abi = ${python_version}"
65 # Unresolved symlinks.
66 if [ -L "${file}" ]; then
68 link
=$
(readlink
-m ${file})
70 # If destination does not exist, make
71 # a dependency for it.
72 if ! [ -e "${link}" ]; then
73 echo "${link#${BUILDROOT}}"
76 # Don't search for anything else, because
77 # symlinks do not require anything but the target file.
81 # Search for all binary files.
82 if file_is_elf
${file}; then
83 binary_files
="${binary_files} ${file}"
87 # Search for script files.
88 if file_is_script
${file}; then
89 script_files
="${script_files} ${file}"
94 # Process script files.
96 for file in ${script_files}; do
97 [ -r ${file} -a -x ${file} ] ||
continue
99 interp
=$
(file_get_script_interpreter
${file})
100 interpreters
="${interpreters} ${interp}"
102 # Collect all perl files.
105 perl_files
="${perl_files} ${file}"
110 # Output the list of needed interpreters.
111 [ -n "${interpreters}" ] && { echo ${interpreters} | tr '[:blank:]' \\n | sort -u ; }
113 # Search for binary interpreters.
114 for file in ${binary_files}; do
115 # Just print the interpreter.
116 file_get_elf_interpreter ${file}
119 # Weak symbol versions (from glibc).
120 [ -n "${mark64}" ] && mark64="(64bit
)"
121 for file in ${binary_files}; do
122 [ -r ${file} ] || continue
124 lib64=$(if file_is_64bit ${file}; then echo "${mark64}"; fi)
125 objdump -p ${file} 2>/dev/null | awk 'BEGIN { START=0; LIBNAME=""; }
127 /^Dynamic Section:$/ { START=1; }
128 (START==1) && /NEEDED/ {
129 if ("'${lib64}'" != "") {
130 sub(/$/, "()'${lib64}'", $2);
134 (START==2) && /^[A-Za-z]/ { START=3; }
135 /^Version References:$/ { START=2; }
136 (START==2) && /required from/ {
140 (START==2) && (LIBNAME!="") && ($4!="") {
141 print LIBNAME "(" $4 ")'${lib64}'";
145 # Search for perl requires.
146 if [ -n "${perl_files}" ] && [ -x /usr/bin/perl ]; then
147 perl ${BASEDIR}/perl.req ${perl_files} | sort -u
150 # Search for pkg-config requires.
151 pkgconfig=$(which pkg-config)
152 if [ -n "${pkgconfig}" -a -x "${pkgconfig}" ]; then
153 for file in ${pkgconfig_files}; do
154 # The dependency for the pkgconfig package itself.
157 ${pkgconfig} --print-requires --print-requires-private "${file}" 2> /dev/null | while read n r v ; do
158 echo "pkgconfig
(${n})" "${r}" "${v}"