+# auto-configuration script for Fubsy; needed until Fubsy has builtin
+# auto-configuration capabilities
+# 1) probe the build system to see what features
+# are present, recording the results in files under .build
+# 2) download dependencies (mainly Go libraries, not packages we expect
+# To clarify, Fubsy has three kinds of dependencies (apart from Go
+# * optional, written in C or C++ (Kyoto Cabinet, Python)
+# * optional, written in Go (typically wrappers for optional
+# * required, written in Go (golex, go-bit, ...).
+# We generally expect optional C/C++ dependencies to be installed
+# separately on the build system, and carry on without them if they
+# are not there. Go dependencies are either included directly in
+# Fubsy's source repository or downloaded here: either way, if they
+# are required, the build process guarantees they will be present (or
+ mkdir -p $tagdir .build/config
+ echo "probing build system ..."
+ tagif kyotodb "pkg-config --cflags kyotocabinet"
+ # Probe for "python" last because on Arch Linux, "python" is
+ # Python 3. We want Python 2.6 or 2.7 (I suspect -- have not tried
+ "pkg-config --cflags python2" \
+ "pkg-config --cflags python-2.6" \
+ "pkg-config --cflags python-2.7" \
+ "pkg-config --cflags python"
+ echo "downloading dependencies ..."
+ # directory for the "stage 1" build, done with shell scripts
+ # rather then with Fubsy itself
+ export GOPATH="$top/$build1"
+ run "go get -v -d github.com/sbinet/go-python/pkg/python"
+ # we build separate from download mainly because of go-python,
+ # which has a Makefile for good reasons of its own
+ # (also, perhaps building should be done in build.sh...?)
+ echo "building dependencies ..."
+ mkdir -p $build1/pkg/$goplatform/github.com
+ rm -rf pkg/$goplatform/github.com/cznic
+ run "GOPATH=$top go install -v github.com/cznic/..."
+ run "mv pkg/$goplatform/github.com/cznic $build1/pkg/$goplatform/github.com/."
+ run "mv bin/golex $build1/bin/."
+ rm -rf pkg/$goplatform/github.com/axw
+ run "GOPATH=$top go install -v github.com/axw/gocov/gocov"
+ run "mv pkg/$goplatform/github.com/axw $build1/pkg/$goplatform/github.com/."
+ run "mv bin/gocov $build1/bin/."
+ run "make -C $build1/src/github.com/sbinet/go-python/pkg/python install"
+ if [ $status -ne 0 ]; then
+ echo "error: command failed: see $log for details" >&2
+ if [ $status -eq 0 ]; then