Skip to content

Commit

Permalink
Do much the same for libstdc++ as we do for libgfortran on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed Feb 3, 2015
1 parent 1814bba commit ec6d698
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ endif
cp LICENSE.md $(prefix)
ifneq ($(OS), WINNT)
-./contrib/fixup-libgfortran.sh $(DESTDIR)$(private_libdir)
endif
ifeq ($(OS), Linux)
-./contrib/fixup-libstdc++.sh $(DESTDIR)$(private_libdir)
endif
# Copy in juliarc.jl files per-platform for binary distributions as well
# Note that we don't install to sysconfdir: we always install to $(DESTDIR)$(prefix)/etc.
Expand Down
31 changes: 31 additions & 0 deletions contrib/fixup-libstdc++.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# Run as: fixup-libstdc++.sh <$private_libdir>

if [ -z "$1" ]; then
echo "Usage: $0 <private_libdir>"
exit 1
fi

private_libdir=$1

if [ ! -f "$private_libdir/libjulia.so" ]; then
echo "ERROR: Could not open $private_libdir/libjulia.so" >&2
exit 2
fi

find_shlib ()
{
if [ -f "$private_libdir/lib$1.so" ]; then
ldd "$private_libdir/lib$1.so" | grep $2 | cut -d' ' -f3 | xargs
fi
}

# Discover libstdc++ location and name
LIBSTD=$(find_shlib "julia" "libstdc++.so")
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

0 comments on commit ec6d698

Please sign in to comment.