forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixup-libstdc++.sh
executable file
·39 lines (32 loc) · 1.12 KB
/
fixup-libstdc++.sh
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
#!/bin/sh
# This file is a part of Julia. License is MIT: https://julialang.org/license
# Run as: fixup-libstdc++.sh <libdir> <private_libdir>
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <libdir> <private_libdir>"
exit 1
fi
libdir="$1"
private_libdir="$2"
if [ ! -f "$private_libdir/libjulia-internal.so" ] && \
[ ! -f "$private_libdir/libjulia-internal-debug.so" ]; then
echo "ERROR: Could not open $private_libdir/libjulia-internal.so" >&2
exit 2
fi
find_shlib ()
{
if [ -f "$1" ]; then
ldd "$1" | grep $2 | cut -d' ' -f3 | xargs
fi
}
# Discover libstdc++ location and name
if [ -f "$private_libdir/libjulia-internal.so" ]; then
LIBSTD=$(find_shlib "$private_libdir/libjulia-internal.so" "libstdc++.so")
elif [ -f "$private_libdir/libjulia-internal-debug.so" ]; then
LIBSTD=$(find_shlib "$private_libdir/libjulia-internal-debug.so" "libstdc++.so")
fi
LIBSTD_NAME=$(basename $LIBSTD)
LIBSTD_DIR=$(dirname $LIBSTD)
if [ ! -f "$private_libdir/$LIBSTD_NAME" ] && [ -f "$LIBSTD_DIR/$LIBSTD_NAME" ]; then
cp -v "$LIBSTD_DIR/$LIBSTD_NAME" "$private_libdir"
chmod 755 "$private_libdir/$LIBSTD_NAME"
fi