From 92cd6c2fe6ade7b295b88d3daac03aa75830f582 Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Tue, 19 Jun 2018 13:59:57 -0700 Subject: [PATCH 1/3] Use `=` instead of `==` to be `sh`-compatible --- contrib/fixup-libgfortran.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/fixup-libgfortran.sh b/contrib/fixup-libgfortran.sh index 07e3a33fe25c2..03a5660c9195c 100755 --- a/contrib/fixup-libgfortran.sh +++ b/contrib/fixup-libgfortran.sh @@ -4,7 +4,7 @@ # Run as: fixup-libgfortran.sh [--verbose] <$private_libdir> # If we're invoked with "--verbose", create a `debug` function that prints stuff out -if [ "$1" == "--verbose" ] || [ "$1" == "-v" ]; then +if [ "$1" = "--verbose" ] || [ "$1" = "-v" ]; then shift 1 debug() { echo "$*"; } else From 14eae7b996dc21dadcaf8bedf221801c1f0c5e2b Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Tue, 19 Jun 2018 14:01:56 -0700 Subject: [PATCH 2/3] fixup-libgfortran needs to search all possible names of LAPACK/BLAS --- contrib/fixup-libgfortran.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/contrib/fixup-libgfortran.sh b/contrib/fixup-libgfortran.sh index 03a5660c9195c..c73bd60229547 100755 --- a/contrib/fixup-libgfortran.sh +++ b/contrib/fixup-libgfortran.sh @@ -41,19 +41,14 @@ find_shlib() fi } -private_libname() -{ - echo "$private_libdir/lib$1.$SHLIB_EXT" -} - # First, discover all the places where libgfortran/libgcc is, as well as their true SONAMES -for lib in lapack; do - if [ -f "$private_libdir/lib$lib.$SHLIB_EXT" ]; then +for lib in lapack blas openblas; do + for private_libname in ${private_libdir}/lib$lib*.$SHLIB_EXT*; do # Find the paths to the libraries we're interested in. These are almost # always within the same directory, but we like to be general. - LIBGFORTRAN_PATH=$(find_shlib "$(private_libname $lib)" libgfortran) - LIBGCC_PATH=$(find_shlib "$(private_libname $lib)" libgcc_s) - LIBQUADMATH_PATH=$(find_shlib "$(private_libname $lib)" libquadmath) + LIBGFORTRAN_PATH=$(find_shlib "$private_libname" libgfortran) + LIBGCC_PATH=$(find_shlib "$private_libname" libgcc_s) + LIBQUADMATH_PATH=$(find_shlib "$private_libname" libquadmath) # Take the directories, add them onto LIBGFORTRAN_DIRS, which we use to # search for these libraries in the future. @@ -65,7 +60,7 @@ for lib in lapack; do LIBGFORTRAN_SONAMES="$LIBGFORTRAN_SONAMES $(basename "$LIBGFORTRAN_PATH")" LIBGCC_SONAMES="$LIBGCC_SONAMES $(basename "$LIBGCC_PATH")" LIBQUADMATH_SONAMES="$LIBQUADMATH_SONAMES $(basename "$LIBQUADMATH_PATH")" - fi + done done # Take in a list of space-separated tokens, return a deduplicated list of the same From 48939ccb83e44d3aee504b9f293b8447796a2bf5 Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Wed, 20 Jun 2018 12:42:49 -0700 Subject: [PATCH 3/3] Silence `dirname` errors --- contrib/fixup-libgfortran.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/fixup-libgfortran.sh b/contrib/fixup-libgfortran.sh index c73bd60229547..a994515d2356d 100755 --- a/contrib/fixup-libgfortran.sh +++ b/contrib/fixup-libgfortran.sh @@ -52,9 +52,9 @@ for lib in lapack blas openblas; do # Take the directories, add them onto LIBGFORTRAN_DIRS, which we use to # search for these libraries in the future. - LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBGFORTRAN_PATH)" - LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBGCC_PATH)" - LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBQUADMATH_PATH)" + LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBGFORTRAN_PATH 2>/dev/null)" + LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBGCC_PATH 2>/dev/null)" + LIBGFORTRAN_DIRS="$LIBGFORTRAN_DIRS $(dirname $LIBQUADMATH_PATH 2>/dev/null)" # Save the SONAMES LIBGFORTRAN_SONAMES="$LIBGFORTRAN_SONAMES $(basename "$LIBGFORTRAN_PATH")"