Skip to content

Instantly share code, notes, and snippets.

@cartoonist
Last active August 17, 2017 01:31
Show Gist options
  • Save cartoonist/32fc8595d8e1a6255c44067d1eb0dfcc to your computer and use it in GitHub Desktop.
Save cartoonist/32fc8595d8e1a6255c44067d1eb0dfcc to your computer and use it in GitHub Desktop.
GCSA2 installation script
prefix=${TMP_PREFIX}
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
bindir=${prefix}/bin
Name: gcsa2
Description: GCSA2: BWT-based index for graphs
Version: 1.0.0
URL: https://github.com/jltsiren/gcsa2
Libs: -L${libdir} -lgcsa2
Cflags: -I${includedir}
#!/bin/bash
PREFIX="$1"
if [ -z "${PREFIX}" ] || [ ! -d "${PREFIX}" ]; then
echo "Setting PREFIX to '/usr/local'"
PREFIX="/usr/local"
fi
PREFIX_BIN="${PREFIX}/bin"
PREFIX_LIB="${PREFIX}/lib"
PREFIX_PKG="${PREFIX_LIB}/pkgconfig"
GCSA2PC_TMPL="https://gist.githubusercontent.com/cartoonist/32fc8595d8e1a6255c44067d1eb0dfcc/raw/c38044ae5466e597d57477eff3b4864a19ffd548/gcsa2.pc.in"
declare -a BINS=("build_gcsa" "convert_graph" "gcsa_format")
declare -a LIBS=("libgcsa2.a")
declare -a INCS=($(find "include/gcsa" -type f))
function lc_install {
install -vD "$1" "$2"
}
function install_bin {
lc_install "$1" "${PREFIX_BIN}/$1"
}
function install_lib {
lc_install "$1" "${PREFIX_LIB}/$1"
}
function install_inc {
lc_install "$1" "${PREFIX}/$1" # $1 already contains 'include/'
}
function install_pkg {
lc_install "$1" "${PREFIX_PKG}/$1"
}
for BINARY in ${BINS[@]}; do
install_bin ${BINARY}
done
for LIBRARY in ${LIBS[@]}; do
install_lib ${LIBRARY}
done
for HEADER in ${INCS[@]}; do
install_inc ${HEADER}
done
curl "${GCSA2PC_TMPL}" | sed -e "s#\${TMP_PREFIX}#${PREFIX}#" > gcsa2.pc
install_pkg gcsa2.pc
@cartoonist
Copy link
Author

  1. Download install.sh.
  2. Put it in gcsa2 source directory.
  3. Run install.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment