Skip to content

Instantly share code, notes, and snippets.

@semenko
Created May 23, 2017 16:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save semenko/f817594cc2b130a74613004821812522 to your computer and use it in GitHub Desktop.
Build samba from git
#!/bin/bash
export PATH="/usr/lib/ccache:$PATH"
die() { echo "$@" 1>&2 ; exit 1; }
if [ -z $1 ]; then
die "Run with a git tag, e.g.: $0 v4-2-test"
fi
echo "Updating samba4 to tag '$1'"
read -p "Press [enter] to continue..."
cd samba4 && git show --summary >> ../working-samba.txt && git fetch && git checkout $1 && git pull && git reset --hard HEAD && sleep 1 && git clean -x -f -d
echo "Configure and build samba?"
read -p "Press [enter] to continue..."
#if [ "$1" == debug ]; then
# echo "*** BUILDING DEBUG ***"
# sleep 1
# ./configure --enable-debug && export CPPFLAGS="-g" && make -j8
#elif [ "$1" == asan ]; then
# echo "*** Building DEBUG **** with *** ASAN ***"
# sleep 1
# ./configure --enable-debug --address-sanitizer && export CPPFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" && make -j8
# ./configure --enable-debug && export CPPFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" && make -j8
# fi
echo "Building for debug + some opt, with -Og -g"
sleep 1
./configure --enable-debug && export CPPFLAGS="-Og g" && make -j8
echo "Samba4 built. Kill & install samba?"
read -p "Press [enter] to continue..."
killall samba ; make install && sleep 1 && nice -n -1 /usr/local/samba/sbin/samba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment