Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust build script to get paths from pg_config tool and some README …
…information
- Loading branch information
1 parent
16e03a3
commit 0914eed
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
#!/bin/bash | ||
|
||
PGROOT="/home/fabrizio/pgsql" | ||
if [ ! $(which pg_config) ]; then | ||
echo "ERROR: pg_config not found" | ||
exit 1 | ||
fi | ||
|
||
BUILDDIR=".build" | ||
|
||
[ -d ${BUILDDIR} ] || mkdir ${BUILDDIR} | ||
|
||
INCLUDEDIR=$(pg_config --includedir-server) | ||
LIBDIR=$(pg_config --pkglibdir) | ||
LIBNAME="go_background_worker.so" | ||
LIBOUTPUT="${BUILDDIR}/${LIBNAME}" | ||
|
||
export CGO_CFLAGS="-I ${PGROOT}/include/server" | ||
export CGO_CFLAGS="-I ${INCLUDEDIR}" | ||
export CGO_LDFLAGS="-shared" | ||
|
||
go build -buildmode=c-shared -v -o ${PGROOT}/lib/${LIBNAME} | ||
echo "Building ${LIBOUTPUT}" | ||
go build -buildmode=c-shared -o ${LIBOUTPUT} | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Sending ${LIBOUTPUT} to ${LIBDIR}" | ||
cp -p ${LIBOUTPUT} ${LIBDIR} | ||
fi |