- Use meson when meson.build is present
- Protect souring when inside existing pg-env VENV
This commit is contained in:
parent
a6c857bcb4
commit
a82a004366
1 changed files with 72 additions and 45 deletions
47
pg-env
47
pg-env
|
@ -52,6 +52,7 @@ fi
|
||||||
if [ -z "$PGV" ]; then
|
if [ -z "$PGV" ]; then
|
||||||
echo "Missing PGV, export PGV=HEAD or export PGV=15"
|
echo "Missing PGV, export PGV=HEAD or export PGV=15"
|
||||||
else
|
else
|
||||||
|
if [ -z "$PG_ENV_VENV" ]; then
|
||||||
PG_DEV_SRC=${GIT_DIR}/${PG_DEV_NAME}
|
PG_DEV_SRC=${GIT_DIR}/${PG_DEV_NAME}
|
||||||
PG_DEV_INST=${GIT_DIR}/${PG_INST_NAME}
|
PG_DEV_INST=${GIT_DIR}/${PG_INST_NAME}
|
||||||
if [ ! -d ${PG_DEV_SRC} ] || [ ! -d ${PG_DEV_INST_DIR} ]; then
|
if [ ! -d ${PG_DEV_SRC} ] || [ ! -d ${PG_DEV_INST_DIR} ]; then
|
||||||
|
@ -60,6 +61,10 @@ else
|
||||||
echo "git worktree add --track -b REL_${PGV}_STABLE ../${PG_DEV_NAME} origin/REL_${PGV}_STABLE"
|
echo "git worktree add --track -b REL_${PGV}_STABLE ../${PG_DEV_NAME} origin/REL_${PGV}_STABLE"
|
||||||
echo "mkdir -p ${PG_DEV_INST}"
|
echo "mkdir -p ${PG_DEV_INST}"
|
||||||
else
|
else
|
||||||
|
if [ -f ${PG_DEV_SRC}/meson.build ]; then
|
||||||
|
export MESON_BUILD_PRESENT=1
|
||||||
|
fi
|
||||||
|
export PG_ENV_VENV=1
|
||||||
export SAVED_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
export SAVED_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
||||||
export SAVED_PGDATA=${PGDATA}
|
export SAVED_PGDATA=${PGDATA}
|
||||||
export SAVED_PGPORT=${PGPORT}
|
export SAVED_PGPORT=${PGPORT}
|
||||||
|
@ -84,16 +89,31 @@ fi
|
||||||
distclean() {
|
distclean() {
|
||||||
pushd ${PG_DEV_SRC}
|
pushd ${PG_DEV_SRC}
|
||||||
make distclean
|
make distclean
|
||||||
|
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||||
|
(cd build; ninja clean)
|
||||||
|
fi
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
compile() {
|
compile() {
|
||||||
pushd ${PG_DEV_SRC}
|
pushd ${PG_DEV_SRC}
|
||||||
|
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||||
./configure --prefix=${PG_DEV_INST} --enable-debug --with-pgport=${PGPORT} --with-lz4 --with-ssl=openssl --with-python --with-perl --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}"
|
./configure --prefix=${PG_DEV_INST} --enable-debug --with-pgport=${PGPORT} --with-lz4 --with-ssl=openssl --with-python --with-perl --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}"
|
||||||
|
else
|
||||||
|
meson setup build --prefix=${PG_DEV_INST} -Dpgport=${PGPORT} -Dlz4=enabled -Dssl=openssl -Dplpython=enabled -Dplperl=enabled -Ddebug=true -Dcassert=true -Dtap_tests=enabled -Dc_args="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}"
|
||||||
|
fi
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
|
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||||
echo "Configure failed"
|
echo "Configure failed"
|
||||||
else
|
else
|
||||||
|
echo "meson setup failed"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||||
make install
|
make install
|
||||||
|
else
|
||||||
|
(cd build; ninja -v install)
|
||||||
|
fi
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
echo "make install failed"
|
echo "make install failed"
|
||||||
fi
|
fi
|
||||||
|
@ -102,12 +122,14 @@ compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_contrib() {
|
compile_contrib() {
|
||||||
|
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||||
pushd ${PG_DEV_SRC}/contrib
|
pushd ${PG_DEV_SRC}/contrib
|
||||||
make install
|
make install
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
echo "make install failed"
|
echo "make install failed"
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
startdb(){
|
startdb(){
|
||||||
|
@ -206,16 +228,6 @@ deactivate() {
|
||||||
else
|
else
|
||||||
unset PGDATABASE
|
unset PGDATABASE
|
||||||
fi
|
fi
|
||||||
unset PG_DEV_SRC
|
|
||||||
unset PG_DEV_INST
|
|
||||||
unset PG_BIN
|
|
||||||
unset SAVED_LD_LIBRARY_PATH
|
|
||||||
unset SAVED_PGDATA
|
|
||||||
unset SAVED_PGPORT
|
|
||||||
unset SAVED_PGDATABASE
|
|
||||||
unset SAVED_PATH
|
|
||||||
unset SAVED_PS1
|
|
||||||
unset SAVED_VIRTUAL_ENV
|
|
||||||
unset -f distclean
|
unset -f distclean
|
||||||
unset -f compile
|
unset -f compile
|
||||||
unset -f compile_contrib
|
unset -f compile_contrib
|
||||||
|
@ -227,6 +239,21 @@ deactivate() {
|
||||||
unset -f resetdb
|
unset -f resetdb
|
||||||
unset -f resetall
|
unset -f resetall
|
||||||
unset -f deactivate
|
unset -f deactivate
|
||||||
|
unset MESON_BUILD_PRESENT
|
||||||
|
unset PG_DEV_SRC
|
||||||
|
unset PG_DEV_INST
|
||||||
|
unset PG_BIN
|
||||||
|
unset SAVED_LD_LIBRARY_PATH
|
||||||
|
unset SAVED_PGDATA
|
||||||
|
unset SAVED_PGPORT
|
||||||
|
unset SAVED_PGDATABASE
|
||||||
|
unset SAVED_PATH
|
||||||
|
unset SAVED_PS1
|
||||||
|
unset SAVED_VIRTUAL_ENV
|
||||||
|
unset PG_ENV_VENV
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
echo "Already in pg-env VENV"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue