Fix GLPK linking (#7357)
[cvc5.git] / contrib / get-script-header.sh
index 7a88b3be200b83e32d1bd4bd96edbcf7a1d1caad..49af8d887d97a1b94218dc396deb4449b0df9d44 100644 (file)
@@ -12,13 +12,13 @@ INSTALL_BIN_DIR="$INSTALL_DIR/bin"
 
 mkdir -p "$DEPS_DIR"
 
-if ! [ -e src/parser/cvc/Cvc.g ]; then
-  echo "$(basename $0): I expect to be in the contrib/ of a CVC4 source tree," >&2
+if ! [ -e src/parser/smt2/Smt2.g ]; then
+  echo "$(basename $0): I expect to be in the contrib/ of a cvc5 source tree," >&2
   echo "but apparently:" >&2
   echo >&2
   echo "  $(pwd)" >&2
   echo >&2
-  echo "is not a CVC4 source tree ?!" >&2
+  echo "is not a cvc5 source tree ?!" >&2
   exit 1
 fi
 
@@ -50,6 +50,7 @@ function setup_dep
   url="$1"
   directory="$2"
   echo "Setting up $directory ..."
+  rm -rf "$directory"
   mkdir -p "$directory"
   cd "$directory"
   webget "$url" archive
@@ -57,15 +58,6 @@ function setup_dep
   rm archive
 }
 
-function check_dep_dir
-{
-  if [ -e "$1" ]; then
-    echo "error: file or directory '$1' exists; please move it out of the way." >&2
-    exit 1
-  fi
-}
-
-
 # Some of our dependencies do not provide a make install rule. Use the
 # following helper functions to copy libraries/headers/binaries into the
 # corresponding directories in deps/install.
@@ -93,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"
+}
+