Skip to content

Instantly share code, notes, and snippets.

@thearchitect
Created January 31, 2016 03:06
Show Gist options
  • Save thearchitect/d2fd336e301e79ce7321 to your computer and use it in GitHub Desktop.
Save thearchitect/d2fd336e301e79ce7321 to your computer and use it in GitHub Desktop.
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo $DIR
#sleep 2s
# git clone git://git.universe-factory.net/fastd
# git clone git://git.universe-factory.net/libuecc
if [ -d "$DIR/fastd-git" ] ; then
cd fastd-git
git checkout master
git pull
cd ..
else
git clone git://git.universe-factory.net/fastd fastd-git
fi
if [ -d "$DIR/libuecc-git" ] ; then
cd libuecc-git
git checkout master
git pull
cd ..
else
git clone git://git.universe-factory.net/libuecc libuecc-git
fi
sudo apt-get install -y libsodium-dev libjson-c-dev
rm -rf libuecc-build
rm -rf fastd-build
mkdir libuecc-build
cd libuecc-build
#cmake -DCMAKE_BUILD_TYPE=RELEASE BUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" ../libuecc || exit 1
cmake -DCMAKE_BUILD_TYPE=RELEASE ../libuecc-git || exit 1
make -j $(grep -c ^processor /proc/cpuinfo) || exit 1
cd ..
mkdir fastd-build
cd fastd-build
cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_EXE_LINKER_FLAGS="-static" \
-DLIBUECC_INCLUDE_DIR="$DIR/libuecc-git/include" \
-DLIBUECC_LIBRARIES="$DIR/libuecc-build/src/libuecc.a" \
-DLIBUECC_CFLAGS_OTHER="-L$DIR/libuecc-build/src -luecc" \
-DLIBUECC_LDFLAGS_OTHER="-L$DIR/libuecc-build/src -luecc" \
../fastd-git || exit 1
make -j $(grep -c ^processor /proc/cpuinfo) || exit 1
rm $DIR/fastd
cp $DIR/fastd-build/src/fastd $DIR/fastd
cat <<EOF
Fastd built!
docs: http://fastd.readthedocs.org/en/latest/index.html
links:
- https://github.com/dereulenspiegel/ansible-fastd
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment