VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1l/util/shlib_wrap.sh.in@ 94130

Last change on this file since 94130 was 91772, checked in by vboxsync, 3 years ago

openssl-1.1.1l: Applied and adjusted our OpenSSL changes to 1.1.1l. bugref:10126

  • Property svn:executable set to *
File size: 5.1 KB
Line 
1#!/bin/sh
2{-
3 use lib '.';
4 use configdata;
5
6 sub shlib {
7 my $lib = shift;
8 return "" if $disabled{shared};
9 $lib = $unified_info{rename}->{$lib}
10 if defined $unified_info{rename}->{$lib};
11 $lib = $unified_info{sharednames}->{$lib}
12 . ($target{shlib_variant} || "")
13 . ($target{shared_extension} || ".so");
14 $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
15 |.$config{shlib_version_number}|x;
16 return $lib;
17 }
18 ""; # Make sure no left over string sneaks its way into the script
19-}
20# To test this OpenSSL version's applications against another version's
21# shared libraries, simply set
22#
23# OPENSSL_REGRESSION=/path/to/other/OpenSSL/build/tree
24if [ -n "$OPENSSL_REGRESSION" ]; then
25 shlibwrap="$OPENSSL_REGRESSION/util/shlib_wrap.sh"
26 if [ -x "$shlibwrap" ]; then
27 # We clear OPENSSL_REGRESSION to avoid a loop, should the shlib_wrap.sh
28 # we exec also support that mechanism...
29 OPENSSL_REGRESSION= exec "$shlibwrap" "$@"
30 else
31 if [ -f "$shlibwrap" ]; then
32 echo "Not permitted to run $shlibwrap" >&2
33 else
34 echo "No $shlibwrap, perhaps OPENSSL_REGRESSION isn't properly set?" >&2
35 fi
36 exit 1
37 fi
38fi
39
40[ $# -ne 0 ] || set -x # debug mode without arguments:-)
41
42THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.."
43[ -d "${THERE}" ] || exec "$@" # should never happen...
44
45LIBCRYPTOSO="${THERE}/{- shlib('libcrypto') -}"
46LIBSSLSO="${THERE}/{- shlib('libssl') -}"
47
48SYSNAME=`(uname -s) 2>/dev/null`;
49case "$SYSNAME" in
50SunOS|IRIX*)
51 # SunOS and IRIX run-time linkers evaluate alternative
52 # variables depending on target ABI...
53 rld_var=LD_LIBRARY_PATH
54 case "`(/usr/bin/file "$LIBCRYPTOSO") 2>/dev/null`" in
55 *ELF\ 64*SPARC*|*ELF\ 64*AMD64*)
56 [ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64
57 LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64
58 preload_var=LD_PRELOAD_64
59 ;;
60 *ELF\ 32*SPARC*|*ELF\ 32*80386*)
61 # We only need to change LD_PRELOAD_32 and LD_LIBRARY_PATH_32
62 # on a multi-arch system. Otherwise, trust the fallbacks.
63 if [ -f /lib/64/ld.so.1 ]; then
64 [ -n "$LD_LIBRARY_PATH_32" ] && rld_var=LD_LIBRARY_PATH_32
65 LD_PRELOAD_32="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_32
66 preload_var=LD_PRELOAD_32
67 fi
68 ;;
69 # Why are newly built .so's preloaded anyway? Because run-time
70 # .so lookup path embedded into application takes precedence
71 # over LD_LIBRARY_PATH and as result application ends up linking
72 # to previously installed .so's. On IRIX instead of preloading
73 # newly built .so's we trick run-time linker to fail to find
74 # the installed .so by setting _RLD_ROOT variable.
75 *ELF\ 32*MIPS*)
76 #_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD_LIST
77 _RLD_ROOT=/no/such/dir; export _RLD_ROOT
78 eval $rld_var=\"/usr/lib'${'$rld_var':+:$'$rld_var'}'\"
79 preload_var=_RLD_LIST
80 ;;
81 *ELF\ N32*MIPS*)
82 [ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH
83 #_RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST
84 _RLDN32_ROOT=/no/such/dir; export _RLDN32_ROOT
85 eval $rld_var=\"/usr/lib32'${'$rld_var':+:$'$rld_var'}'\"
86 preload_var=_RLDN32_LIST
87 ;;
88 *ELF\ 64*MIPS*)
89 [ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH
90 #_RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST
91 _RLD64_ROOT=/no/such/dir; export _RLD64_ROOT
92 eval $rld_var=\"/usr/lib64'${'$rld_var':+:$'$rld_var'}'\"
93 preload_var=_RLD64_LIST
94 ;;
95 esac
96 eval $rld_var=\"${THERE}'${'$rld_var':+:$'$rld_var'}'\"; export $rld_var
97 unset rld_var
98 ;;
99*) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX
100 DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
101 SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
102 LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
103 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
104 # Even though $PATH is adjusted [for Windows sake], it doesn't
105 # necessarily does the trick. Trouble is that with introduction
106 # of SafeDllSearchMode in XP/2003 it's more appropriate to copy
107 # .DLLs in vicinity of executable, which is done elsewhere...
108 if [ "$OSTYPE" != msdosdjgpp ]; then
109 PATH="${THERE}:$PATH"; export PATH
110 fi
111 ;;
112esac
113
114{- output_off() unless grep (/-rpath\b/, @{$config{LDFLAGS}}); ""; -}
115if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
116 # Following three lines are major excuse for isolating them into
117 # this wrapper script. Original reason for setting LD_PRELOAD
118 # was to make it possible to pass 'make test' when user linked
119 # with -rpath pointing to previous version installation. Wrapping
120 # it into a script makes it possible to do so on multi-ABI
121 # platforms.
122 case "$SYSNAME" in
123 *BSD) LD_PRELOAD="$LIBCRYPTOSO:$LIBSSLSO" ;; # *BSD
124 *) LD_PRELOAD="$LIBCRYPTOSO $LIBSSLSO" ;; # SunOS, Linux, ELF HP-UX
125 esac
126 _RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT" # Tru64, o32 IRIX
127 DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X
128 export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
129fi
130{- output_on() unless grep (/-rpath\b/, @{$config{LDFLAGS}}); ""; -}
131
132cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
133shift
134if [ $# -eq 0 ]; then
135 exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@"
136else
137 exec "$cmd" "$@"
138fi
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette