3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # verify that ELF NEEDED entries are known-good so hopefully builds run on
11 # lots of different GNU/Linux distributions
16 check_path
="${INSTDIR:-.}"
21 -d <dir
> directory to check
22 -p run unbound parallel checks
25 [ -z "${1:-}" ] && exit 0
36 while [ "${1:-}" != "" ]; do
40 if [ "${1}" != "${parm?}" ] ; then
48 if [ "$has_arg" ] ; then
54 if [ ! -d "$check_path" ]; then
55 die
"Invalid directory '$check_path'"
62 # this sounds counter intuitive but the idea
63 # is to possibly support -p <n>
64 # in the meantime: 0 = nolimit and -p 1 would mean
65 # the current default: serialize
69 die
"Invalid option $1"
72 if [ "$DO_NEW" = 1 ] ; then
75 die
"Invalid argument $1"
83 files
=$
(find "${check_path}/program" "${check_path}/sdk/bin" -type f
)
84 # all RPATHs should point to ${INSTDIR}/program so that's the files they find
85 programfiles
=$
(echo ${files} |
grep -o '/program/[^/]* ' |
xargs -n 1 basename)
87 # whitelists should contain only system libraries that have a good reputation
88 # of maintaining ABI stability
89 # allow extending the whitelist using the environment variable to be able to work
90 # on the installer stuff without the need for a baseline setup
91 globalwhitelist
="ld-linux-x86-64.so.2 ld-linux.so.2 libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0 librt.so.1 libutil.so.1 libnsl.so.1 libcrypt.so.1 libgcc_s.so.1 libstdc++.so.6 libz.so.1 libfontconfig.so.1 libfreetype.so.6 libxml2.so.2 libxslt.so.1 libexslt.so.0 ${LO_ELFCHECK_WHITELIST-}"
92 x11whitelist
="libX11.so.6 libXext.so.6 libSM.so.6 libICE.so.6 libXinerama.so.1 libXrender.so.1 libXrandr.so.2 libcairo.so.2"
93 openglwhitelist
="libGL.so.1"
94 giowhitelist
="libgio-2.0.so.0 libgobject-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libglib-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3"
95 gstreamerwhitelist
="libgstaudio-1.0.so.0 libgstpbutils-1.0.so.0 libgstvideo-1.0.so.0 libgstbase-1.0.so.0 libgstreamer-1.0.so.0"
96 gtk3whitelist
="libgtk-3.so.0 libgdk-3.so.0 libcairo-gobject.so.2 libpangocairo-1.0.so.0 libfribidi.so.0 libatk-1.0.so.0 libcairo.so.2 libgio-2.0.so.0 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libgobject-2.0.so.0 libglib-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libdbus-glib-1.so.2 libdbus-1.so.3 libharfbuzz.so.0"
97 qt5whitelist
="libQt5Core.so.5 libQt5Gui.so.5 libQt5Network.so.5 libQt5Widgets.so.5 libQt5X11Extras.so.5 libcairo.so.2 libglib-2.0.so.0 libgobject-2.0.so.0 libxcb.so.1 libxcb-icccm.so.4"
98 kf5whitelist
="libKF5ConfigCore.so.5 libKF5CoreAddons.so.5 libKF5I18n.so.5 libKF5KIOCore.so.5 libKF5KIOFileWidgets.so.5 libKF5KIOWidgets.so.5 libKF5WindowSystem.so.5"
99 avahiwhitelist
="libdbus-glib-1.so.2 libdbus-1.so.3 libgobject-2.0.so.0 libgmodule-2.0.so.0 libgthread-2.0.so.0 libglib-2.0.so.0 libavahi-common.so.3 libavahi-client.so.3"
100 kerberoswhitelist
="libgssapi_krb5.so.2 libcom_err.so.2 libkrb5.so.3"
101 dconfwhitelist
="libdconf.so.1 libgio-2.0.so.0 libglib-2.0.so.0 libgobject-2.0.so.0"
108 whitelist
="${globalwhitelist}"
111 # skip the majority of files, no ELF binaries here
114 */_uuid.cpython-
*.so
)
115 whitelist
="${whitelist} libuuid.so.1"
118 whitelist
="${whitelist} ${x11whitelist} libxcb-shm.so.0 libxcb.so.1 libxcb-render.so.0"
120 */libcairocanvaslo.so
)
121 whitelist
="${whitelist} libcairo.so.2"
123 */libucpgio1lo.so|
*/liblosessioninstalllo.so|
*/libevoablo.so
)
124 whitelist
="${whitelist} ${giowhitelist}"
127 whitelist
="${whitelist} ${gtk3whitelist} ${gstreamerwhitelist}"
129 */libvclplug_kf5lo.so|
*/libkf5be1lo.so
)
130 if [ "$ENABLE_KF5" = TRUE
]; then
131 whitelist
="${whitelist} ${qt5whitelist} ${kf5whitelist}"
134 */libvclplug_gtk3lo.so|
*/updater
)
135 whitelist
="${whitelist} ${x11whitelist} ${gtk3whitelist}"
137 */libvclplug_qt5lo.so
)
138 if [ "$ENABLE_QT5" = TRUE
]; then
139 whitelist
="${whitelist} ${qt5whitelist}"
142 */libvclplug_gtk3_kde5lo.so
)
143 if [ "$ENABLE_GTK3_KDE5" = TRUE
]; then
144 whitelist
="${whitelist} ${x11whitelist} ${gtk3whitelist} ${qt5whitelist} ${kf5whitelist}"
148 if [ "$ENABLE_GTK3_KDE5" = TRUE
]; then
149 whitelist
="${whitelist} ${x11whitelist} ${gtk3whitelist} ${qt5whitelist} \
153 */libdesktop_detectorlo.so|
*/ui-previewer|
*/oosplash|
*/gengal.bin
)
154 whitelist
="${whitelist} ${x11whitelist}"
156 */libvclplug_genlo.so|
*/libchartcorelo.so|
*/libavmediaogl.so|
*/libOGLTranslo.so|
*/liboglcanvaslo.so
)
157 whitelist
="${whitelist} ${x11whitelist} ${openglwhitelist}"
160 whitelist
="${whitelist} ${x11whitelist} ${openglwhitelist} ${giowhitelist} libcups.so.2"
163 whitelist
="${whitelist} ${x11whitelist} ${openglwhitelist} ${giowhitelist} libcups.so.2"
165 */liblibreofficekitgtk.so
)
166 whitelist
="${whitelist} ${gtk3whitelist}"
169 whitelist
="${whitelist} ${avahiwhitelist}"
172 whitelist
="${whitelist} libjawt.so"
174 */libpostgresql-sdbc-impllo.so
)
175 whitelist
="${whitelist} ${kerberoswhitelist}"
178 if [ "$ENABLE_DCONF" = TRUE
]; then
179 whitelist
="${whitelist} ${dconfwhitelist}"
183 whitelist
="${whitelist} ${x11whitelist} ${openglwhitelist} ${giowhitelist} libcups.so.2 libcairo.so.2"
186 if test "${skip}" = 0 && readelf
-d "${file}" &> /dev
/null
; then
187 rpath
=$
(readelf
-d "${file}" |
grep '(\(RPATH\|RUNPATH\))' || true
)
188 neededs
=$
(readelf
-d "${file}" |
grep '(NEEDED)' |
sed -e 's/.*\[\(.*\)\]$/\1/')
190 for needed
in ${neededs}
192 if ! echo ${whitelist} |
grep -q -w "${needed}" ; then
193 neededsinternal
="${neededsinternal} ${needed}"
194 if ! echo ${programfiles} |
grep -q -w "${needed}" ; then
195 echo "${file}" has suspicious NEEDED
: "${needed}"
200 if test -z "${rpath}" ; then
202 */python-core-
*/lib
/lib-dynload
/*)
203 # python modules don't have RPATH
205 */share
/extensions
/*)
206 # extension libraries don't have RPATH
209 # no NEEDED from instdir, no RPATH needed
210 if test -n "${neededsinternal}" ; then
211 echo "${file}" has no RPATH
219 if echo "${rpath}" |
grep -q -v '\[\$ORIGIN/../../program\]$' ; then
220 echo "${file}" has unexpected RPATH
"${rpath}"
225 if echo "${rpath}" |
grep -q -v '\[\$ORIGIN\]$' ; then
226 echo "${file}" has unexpected RPATH
"${rpath}"
236 if [ "$PARA" = "1" ] ; then
252 if [ -s check_elf.out
] ; then