Skip to content

Instantly share code, notes, and snippets.

@gopass2002
Created May 7, 2015 11:32
Show Gist options
  • Save gopass2002/6b4f8ae9d289a9ecbc8f to your computer and use it in GitHub Desktop.
Save gopass2002/6b4f8ae9d289a9ecbc8f to your computer and use it in GitHub Desktop.
install snappy codec
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <install path>"
exit
fi
prefix=${1}
tmpdir=${1}/tmp
platform=$(uname)
function intsall_mac_osx {
./configure --prefix="${prefix}" && make install
rm -rf ${tmpdir}
}
function intsall_linux {
CFLAGS="-O2 -DNDEBUG" CXXFLAGS="-O2 -DNDEBUG" ./configure --prefix="${prefix}"
make check install
}
if [[ -z "$(which wget)" ]]; then
echo "not found wget, install wget before run this script"
exit 1
fi
mkdir -p ${tmpdir} && cd ${tmpdir}
wget http://snappy.googlecode.com/files/snappy-1.0.3.tar.gz && \
tar xzvf snappy-1.0.3.tar.gz && cd snappy-1.0.3 && \
if [[ "${platform}" == "Darwin" ]]; then
intsall_mac_osx
else
intsall_linux
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment