From: Andrew V. Jones Date: Wed, 10 Mar 2021 22:10:12 +0000 (+0000) Subject: Improved handing of 'lib64' vs. 'lib' for glpk-cut-log and antlr-3.4 (#6091) X-Git-Tag: cvc5-1.0.0~2111 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0dfbbbf3bcaf7a6edbe18e140b6d7b5c49c2f8d;p=cvc5.git Improved handing of 'lib64' vs. 'lib' for glpk-cut-log and antlr-3.4 (#6091) Signed-off-by: Andrew V. Jones --- diff --git a/contrib/get-antlr-3.4 b/contrib/get-antlr-3.4 index dcb48325b..0b717266f 100755 --- a/contrib/get-antlr-3.4 +++ b/contrib/get-antlr-3.4 @@ -80,12 +80,10 @@ sed 's,^\(CFLAGS = .*\),\1 -fexceptions,' Makefile.orig > Makefile make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" make install -# Build shared ANTLR library - -# On some systems the library may be installed to lib64/ instead of lib/ -LIB_DIR="$(dirname "$(find "$INSTALL_DIR" -name libantlr3c.a)")" +# Find and move the static build +rename_installed_lib "libantlr3c.a" "libantlr3c-static.a" -mv "$LIB_DIR/libantlr3c.a" "$LIB_DIR/libantlr3c-static.a" +# Build shared ANTLR library make clean ./configure --with-pic --disable-antlrdebug --prefix="$INSTALL_DIR" $ANTLR_CONFIGURE_ARGS $BUILD_TYPE @@ -94,8 +92,9 @@ cp Makefile Makefile.orig sed 's,^\(CFLAGS = .*\),\1 -fexceptions,' Makefile.orig > Makefile make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" LDFLAGS="${MAKE_LDFLAGS}" make install -mv "$LIB_DIR/libantlr3c.la" "$LIB_DIR/libantlr3c.la.orig" +rename_installed_lib "libantlr3c.la" "libantlr3c.la.orig" +LIB_DIR=$(guess_lib_dir "libantlr3c.la.orig") awk '/^old_library=/ {print "old_library='\''libantlr3c-static.a'\''"} /^library_names=/ {print "library_names='\''libantlr3c.a'\''"} !/^old_library=/ && !/^library_names=/ {print}' < "$LIB_DIR/libantlr3c.la.orig" > "$LIB_DIR/libantlr3c.la" rm "$LIB_DIR/libantlr3c.la.orig" diff --git a/contrib/get-glpk-cut-log b/contrib/get-glpk-cut-log index f8eff85bb..cf523dc5a 100755 --- a/contrib/get-glpk-cut-log +++ b/contrib/get-glpk-cut-log @@ -32,7 +32,9 @@ automake --add-missing ./configure --without-pic --prefix="$INSTALL_DIR" --disable-shared --enable-static --disable-dependency-tracking make install -j$(nproc) make distclean -mv "$INSTALL_LIB_DIR/libglpk.a" "$INSTALL_LIB_DIR/libglpk-static.a" + +# Find and move the static build +rename_installed_lib "libglpk.a" "libglpk-static.a" ./configure --with-pic --prefix="$INSTALL_DIR" --disable-shared --enable-static --disable-dependency-tracking make install -j$(nproc) diff --git a/contrib/get-script-header.sh b/contrib/get-script-header.sh index 64ef54401..394669c68 100644 --- a/contrib/get-script-header.sh +++ b/contrib/get-script-header.sh @@ -85,3 +85,29 @@ function install_bin [ ! -d "$INSTALL_BIN_DIR" ] && mkdir -p "$INSTALL_BIN_DIR" cp "$1" "$INSTALL_BIN_DIR" } + +function guess_lib_dir +{ + # + # On some systems the library may be installed to lib64/ + # instead of lib/ + # + # This function guesses the install lib directory + # + lib_name="$1" + lib_dir="$(dirname "$(find "$INSTALL_DIR" -name "${lib_name}")")" + echo ${lib_dir} +} + +function rename_installed_lib +{ + # + # This function uses the calculated library directory and + # then relocates the first argument to the second. + # + src="$1" + dest="$2" + lib_dir="$(guess_lib_dir "$src")" + mv "$lib_dir/$src" "$lib_dir/$dest" +} +