now build files into binaries for go when running fdb-go-install

This commit is contained in:
Alec Grieser 2017-07-10 15:40:26 -07:00
parent 3cb6a8faf1
commit a6ed7532c0
1 changed files with 25 additions and 9 deletions

View File

@ -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