From a6ed7532c09554e14e4ef5515130ce07d9553be7 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 10 Jul 2017 15:40:26 -0700 Subject: [PATCH] now build files into binaries for go when running fdb-go-install --- bindings/go/fdb-go-install.sh | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/bindings/go/fdb-go-install.sh b/bindings/go/fdb-go-install.sh index ecaf69194b..c8122b94cf 100755 --- a/bindings/go/fdb-go-install.sh +++ b/bindings/go/fdb-go-install.sh @@ -266,21 +266,37 @@ else fi fi - # Step 4: Explain CGO flags. + # Step 4: Build the binaries. + + if [[ "${operation}" == "download" ]] ; then + # Do not install if only downloading + : + elif [[ "${status}" -eq 0 ]] ; then + cgo_cflags="-g -O2 -I${linkpath}/bindings/c" + cgo_ldflags="-g -O2 -L${FDBLIBDIR}" + fdb_go_path="${REMOTE}/${FDBREPO}/bindings/go/src" + + if [[ ! -e "${FDBLIBDIR}/${libfdbc}" ]] ; then + # Just a warning. Don't fail script. + echo + echo "WARNING: The FoundationDB C library was not found within ${FDBLIBDIR}." + echo "Your installation may be incomplete." + echo + elif ! CGO_CFLAGS="${cgo_cflags}" CGO_LDFLAGS="${cgo_ldflags}" go install "${fdb_go_path}/fdb" "${fdb_go_path}/fdb/tuple" "${fdb_go_path}/fdb/subspace" "${fdb_go_path}/fdb/directory" ; then + let status="${status} + 1" + echo "Could not build FoundationDB go libraries." + fi + fi + + # Step 5: Explain CGO flags. if [[ "${status}" -eq 0 && ("${operation}" == "localinstall" || "${operation}" == "install" ) ]] ; then echo echo "The FoundationDB go bindings were successfully installed." echo "To build packages which use the go bindings, you will need to" echo "set the following environment variables:" - echo " CGO_CFLAGS=\"-g -O2 -I${linkpath}/bindings/c\"" - echo " CGO_LDFLAGS=\"-g -O2 -L${FDBLIBDIR}\"" - - if [[ ! -e "${FDBLIBDIR}/${libfdbc}" ]] ; then - echo - echo "WARNING: The FoundationDB C library was not found within ${FDBLIBDIR}." - echo "Your installation may be incomplete." - fi + echo " CGO_CFLAGS=\"${cgo_cflags}\"" + echo " CGO_LDFLAGS=\"${cgo_ldflags}\"" fi fi fi