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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#!/bin/bash
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
if type -p chflags &>/dev/null && type -p mtree &>/dev/null; then
# Save all the file flags for restoration at the end of prepall.
mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree"
# Remove all the file flags so that prepall can do anything necessary.
chflags -R noschg,nouchg,nosappnd,nouappnd "${D}"
chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null
fi
prepallman
prepallinfo
prepallstrip
# this should help to ensure that all (most?) shared libraries are executable
# and that all libtool scripts / static libraries are not executable
for i in "${D}"opt/*/lib{,32,64} \
"${D}"lib{,32,64} \
"${D}"usr/lib{,32,64} \
"${D}"usr/X11R6/lib{,32,64} ; do
[[ ! -d ${i} ]] && continue
for j in "${i}"/*.so.* "${i}"/*.so ; do
[[ ! -e ${j} ]] && continue
[[ -L ${j} ]] && continue
[[ -x ${j} ]] && continue
vecho "making executable: /${j/${D}/}"
chmod +x "${j}"
done
for j in "${i}"/*.a "${i}"/*.la ; do
[[ ! -e ${j} ]] && continue
[[ -L ${j} ]] && continue
[[ ! -x ${j} ]] && continue
vecho "removing executable bit: /${j/${D}/}"
chmod -x "${j}"
done
done
# When installing static libraries into /usr/lib and shared libraries into
# /lib, we have to make sure we have a linker script in /usr/lib along side
# the static library, or gcc will utilize the static lib when linking :(.
# http://bugs.gentoo.org/4411
for a in "${D}"usr/lib*/*.a ; do
s=${a%.a}.so
if [[ ! -e ${s} ]] ; then
s=${s%usr/*}${s##*/usr/}
if [[ -e ${s} ]] ; then
vecho -e "\aQA Notice: missing gen_usr_ldscript for ${s##*/}\a"
sleep 1
fi
fi
done
# Make sure people don't store libtool files or static libs in /lib
f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null)
if [[ -n ${f} ]] ; then
vecho -e "\n\aQA Notice: excessive files found in the / partition\a"
vecho "${f}"
sleep 1
fi
# Verify that the libtool files don't contain bogus $D entries.
for a in "${D}"usr/lib*/*.la ; do
s=${a##*/}
if grep -qs "${D}" "${a}" ; then
vecho -e "\n\aQA Notice: ${s} appears to contain PORTAGE_TMPDIR paths\a"
sleep 1
fi
done
if type -p scanelf > /dev/null ; then
# Run some sanity checks on shared libraries
for d in "${D}"lib* "${D}"usr/lib* ; do
f=$(scanelf -ByF '%S %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
if [[ -n ${f} ]] ; then
vecho -e "\n\aQA Notice: the following shared libraries lack a SONAME\a"
vecho "${f}"
vecho
sleep 1
fi
f=$(scanelf -ByF '%n %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
if [[ -n ${f} ]] ; then
vecho -e "\n\aQA Notice: the following shared libraries lack NEEDED entries\a"
vecho "${f}"
vecho
sleep 1
fi
done
fi
if type -p chflags &>/dev/null && type -p mtree &>/dev/null; then
# Restore all the file flags that were saved at the beginning of prepall.
mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
fi
|