blob: 5f3335f84ed90c9029407afcc249d6361f506b44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/bash
#
# Auto-generate requirements for ELF executables and library
# sonames, script interpreters, and perl modules.
#
ulimit -c 0
# fix parsing output of objdump when localized (mga#7883):
export LC_ALL=C
#
# --- Set needed to 0 for traditional find-requires behavior.
needed=1
if [ X"$3" = Xldd ]; then
needed=0
elif [ X"$3" = Xobjdump ]; then
needed=1
fi
# --- Mageia specific part
case "$LD_PRELOAD" in
*libfakeroot*)
unset LD_PRELOAD
;;
esac
RPM_BUILD_ROOT=$1
RPM_ARCH=$2
if [ -n "$RPM_BUILD_ROOT" ]; then
lib_path_64=$RPM_BUILD_ROOT/usr/X11R6/lib64:$RPM_BUILD_ROOT/usr/lib64:$RPM_BUILD_ROOT/lib64
lib_path_32=$RPM_BUILD_ROOT/usr/X11R6/lib:$RPM_BUILD_ROOT/usr/lib:$RPM_BUILD_ROOT/lib
LD_LIBRARY_PATH=$lib_path_64:$lib_path_32
export LD_LIBRARY_PATH
fi
#
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && \
echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --requires
#
# --- .so files.
for i in `echo $filelist | tr '[:blank:]' "\n" | egrep "(/usr(/X11R6)?)?/lib(|64)/[^/]+\.so$"`; do
objd=`objdump -p ${i} | grep SONAME`
lib64=`if file -L $i 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "(64bit)"; fi` && \
if [ -h ${i} -a -n "${objd}" ]; then
if [ "$needed" -eq 0 ]; then
ldd ${i} \
| grep -v "statically linked" \
| grep -v "/\(lib\|lib64\)/\(ld\|ld64\|ld-linux.*\)\.so" \
| perl -p -e "s/\s+(\S+)\.so.*/devel(\1$lib64)/g"
else
objdump -p $i | grep -v "\(ld\|ld64\|ld-linux.*\)\.so" \
| awk 'BEGIN { START=0; }
/^$/ { START=0; }
/^Dynamic Section:$/ { START=1; }
(START==1) && /NEEDED/ {
sub(/^/, "devel(", $2) ;
sub(/\.so.*$/, "'$lib64')", $2) ;
print $2 ;
}
'
fi
fi
done | egrep -v 'devel\(linux-gate|linux-vdso32|linux-vdso64|lib(c|pthread|rt)(\(64bit\))?\)' | sort -u
#
# --- multiarch-utils
echo $filelist | tr '[:blank:]' '\n' | grep -q '/multiarch-.*-linux/' && echo multiarch-utils
exit 0
|