refactor: use pushd/popd instead of cd

This commit is contained in:
Daniele Varrazzo 2025-01-05 20:49:22 +01:00
parent b943457896
commit 5bfba4c961

View File

@ -109,7 +109,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \ https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \
| tar xzf - | tar xzf -
cd "${openssl_dir}" pushd "${openssl_dir}"
options=(--prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \ options=(--prefix=${LIBPQ_BUILD_PREFIX} --openssldir=${LIBPQ_BUILD_PREFIX} \
zlib -fPIC shared) zlib -fPIC shared)
@ -122,12 +122,12 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
make depend make depend
make make
else else
cd "${openssl_dir}" pushd "${openssl_dir}"
fi fi
# Install openssl # Install openssl
make install_sw make install_sw
cd .. popd
fi fi
@ -140,15 +140,15 @@ if [ "$ID" == "macos" ]; then
curl -sL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \ curl -sL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
| tar xzf - | tar xzf -
cd "${krb5_dir}" pushd "${krb5_dir}"
./configure "${make_configure_standard_flags[@]}" ./configure "${make_configure_standard_flags[@]}"
make make
else else
cd "${krb5_dir}" pushd "${krb5_dir}"
fi fi
make install make install
cd ../.. popd
fi fi
@ -161,15 +161,15 @@ if [ "$ID" == "macos" ]; then
curl -sL "https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz" \ curl -sL "https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz" \
| tar xzf - | tar xzf -
cd "${gettext_dir}" pushd "${gettext_dir}"
./configure --disable-java "${make_configure_standard_flags[@]}" ./configure --disable-java "${make_configure_standard_flags[@]}"
make -C gettext-runtime all make -C gettext-runtime all
else else
cd "${gettext_dir}" pushd "${gettext_dir}"
fi fi
make -C gettext-runtime install make -C gettext-runtime install
cd .. popd
fi fi
@ -187,20 +187,20 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \ https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \
| tar xzf - | tar xzf -
cd "${sasl_dir}" pushd "${sasl_dir}"
autoreconf -i autoreconf -i
./configure "${make_configure_standard_flags[@]}" --disable-macos-framework ./configure "${make_configure_standard_flags[@]}" --disable-macos-framework
make make
else else
cd "${sasl_dir}" pushd "${sasl_dir}"
fi fi
# Install libsasl2 # Install libsasl2
# requires missing nroff to build # requires missing nroff to build
touch saslauthd/saslauthd.8 touch saslauthd/saslauthd.8
make install make install
cd .. popd
fi fi
@ -215,7 +215,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \ https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \
| tar xzf - | tar xzf -
cd "${ldap_dir}" pushd "${ldap_dir}"
./configure "${make_configure_standard_flags[@]}" --enable-backends=no --enable-null ./configure "${make_configure_standard_flags[@]}" --enable-backends=no --enable-null
@ -224,7 +224,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
make -C libraries/liblber/ make -C libraries/liblber/
make -C libraries/libldap/ make -C libraries/libldap/
else else
cd "${ldap_dir}" pushd "${ldap_dir}"
fi fi
# Install openldap # Install openldap
@ -232,7 +232,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
make -C libraries/libldap/ install make -C libraries/libldap/ install
make -C include/ install make -C include/ install
chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.${library_suffix}* chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.${library_suffix}*
cd .. popd
fi fi
@ -245,7 +245,7 @@ if [ ! -d "${postgres_dir}" ]; then
https://github.com/postgres/postgres/archive/${postgres_tag}.tar.gz \ https://github.com/postgres/postgres/archive/${postgres_tag}.tar.gz \
| tar xzf - | tar xzf -
cd "${postgres_dir}" pushd "${postgres_dir}"
if [ "$ID" != "macos" ]; then if [ "$ID" != "macos" ]; then
# Match the default unix socket dir default with what defined on Ubuntu and # Match the default unix socket dir default with what defined on Ubuntu and
@ -265,13 +265,13 @@ if [ ! -d "${postgres_dir}" ]; then
make -C src/bin/pg_config make -C src/bin/pg_config
make -C src/include make -C src/include
else else
cd "${postgres_dir}" pushd "${postgres_dir}"
fi fi
# Install libpq # Install libpq
make -C src/interfaces/libpq install make -C src/interfaces/libpq install
make -C src/bin/pg_config install make -C src/bin/pg_config install
make -C src/include install make -C src/include install
cd .. popd
find ${LIBPQ_BUILD_PREFIX} -name \*.${library_suffix}.\* -type f -exec strip --strip-unneeded {} \; find ${LIBPQ_BUILD_PREFIX} -name \*.${library_suffix}.\* -type f -exec strip --strip-unneeded {} \;