Skip to content

Instantly share code, notes, and snippets.

@rothgar
Forked from aauren/static_build.sh
Last active May 3, 2017 07:50
Show Gist options
  • Save rothgar/fadbf158c858e330f705 to your computer and use it in GitHub Desktop.
Save rothgar/fadbf158c858e330f705 to your computer and use it in GitHub Desktop.
Create Static Build of the_silver_searcher
#!/bin/bash
PCRE_VERSION="8.38"
XZ_UTILS_VERSION="5.2.2"
AG_VERSION="0.31.0"
PCRE_URL="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCRE_VERSION}.tar.gz"
XZ_URL="http://tukaani.org/xz/xz-${XZ_UTILS_VERSION}.tar.gz"
AG_URL="http://geoff.greer.fm/ag/releases/the_silver_searcher-${AG_VERSION}.tar.gz"
WORK_DIR="${TMPDIR:-/var/tmp/}"
pushd ${WORK_DIR}
# fetch libprce
wget -q "${PCRE_URL}" -O "${WORK_DIR}/pcre-${PCRE_VERSION}.tar.gz"
tar xzf "${WORK_DIR}/pcre-${PCRE_VERSION}.tar.gz"
# fetch xz utils
wget -q "${XZ_URL}" -O "${WORK_DIR}/xz-${XZ_UTILS_VERSION}.tar.gz"
tar xzf "${WORK_DIR}/xz-${XZ_UTILS_VERSION}.tar.gz"
# fetch ag
wget -q "${AG_URL}" -O "${WORK_DIR}/the_silver_searcher-${AG_VERSION}.tar.gz"
tar xzf "${WORK_DIR}/the_silver_searcher-${AG_VERSION}.tar.gz"
PCRE_WORK_DIR="${WORK_DIR}/pcre-${PCRE_VERSION}"
XZ_UTILS_WORK_DIR="${WORK_DIR}/xz-${XZ_UTILS_VERSION}"
AG_WORK_DIR="${WORK_DIR}/the_silver_searcher-${AG_VERSION}"
echo "+++++++++++++++++++++++++++++++++ Making libpcre +++++++++++++++++++++++++++++++++"
sleep 5
pushd "${PCRE_WORK_DIR}"
./configure
make
popd
echo "+++++++++++++++++++++++++++++++++ Making xz-utils +++++++++++++++++++++++++++++++++"
sleep 5
pushd "${XZ_UTILS_WORK_DIR}"
./configure
make
popd
echo "+++++++++++++++++++++++++++++++++ Making the_silver_searcher +++++++++++++++++++++++++++++++++"
sleep 5
pushd "${AG_WORK_DIR}"
PCRE_CFLAGS="-I ${PCRE_WORK_DIR} -I ${XZ_UTILS_WORK_DIR}/src/liblzma/api" \
PCRE_LIBS="-L ${PCRE_WORK_DIR}/.libs -Wl,-Bstatic -lpcre -Wl,-Bdynamic" \
LZMA_LIBS="-L ${XZ_UTILS_WORK_DIR}/src/liblzma/.libs -Wl,-Bstatic -llzma -Wl,-Bdynamic" \
./build.sh
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment