build/windows: Reduce some bashisms on Windows scripts

This commit is contained in:
Bruno Lopes 2024-05-01 11:48:28 -03:00 committed by Bruno
parent b42b18de24
commit 36ce192a53
5 changed files with 34 additions and 37 deletions

View File

@ -5,8 +5,8 @@ if [ -z "$GIT_DEPTH" ]; then
fi
# BASH ENV
if [[ -z "$CROSSROAD_PLATFORM" ]]; then
# SHELL ENV
if [ -z "$CROSSROAD_PLATFORM" ]; then
apt-get install -y --no-install-recommends \
wine \
wine64
@ -24,9 +24,9 @@ export ARTIFACTS_SUFFIX="-x64"
## Install the required (pre-built) packages for babl, GEGL and GIMP
crossroad source msys2
DEPS_LIST=$(cat build/windows/gitlab-ci/all-deps-uni.txt)
DEPS_LIST=$(sed "s/\${MINGW_PACKAGE_PREFIX}-//g" <<< $DEPS_LIST)
DEPS_LIST=$(sed 's/\\//g' <<< $DEPS_LIST)
DEPS_LIST=$(cat build/windows/gitlab-ci/all-deps-uni.txt |
sed "s/\${MINGW_PACKAGE_PREFIX}-//g" |
sed 's/\\//g')
crossroad install $DEPS_LIST
if [ $? -ne 0 ]; then
echo "Installation of pre-built dependencies failed.";
@ -55,12 +55,10 @@ cd ../../
## "Build" part of deps
### Generator of the gio 'giomodule.cache' to fix error about
### libgiognutls.dll that prevents generating loaders.cache
gio=''
gio+="libgiognomeproxy.dll: gio-proxy-resolver\n"
gio+="libgiognutls.dll: gio-tls-backend\n"
gio+="libgiolibproxy.dll: gio-proxy-resolver\n"
gio+="libgioopenssl.dll: gio-tls-backend\n"
printf "%b" "$gio" > ${CROSSROAD_PREFIX}/lib/gio/modules/giomodule.cache
echo 'libgiognomeproxy.dll: gio-proxy-resolver
libgiognutls.dll: gio-tls-backend
libgiolibproxy.dll: gio-proxy-resolver
libgioopenssl.dll: gio-tls-backend' > ${CROSSROAD_PREFIX}/lib/gio/modules/giomodule.cache
### Generator of the pixbuf 'loaders.cache' for GUI image support
GDK_PATH=$(echo ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-*/*/)

View File

@ -4,17 +4,17 @@ set -e
# $MSYSTEM_CARCH and $MINGW_PACKAGE_PREFIX are defined by MSYS2.
# https://github.com/msys2/MSYS2-packages/blob/master/filesystem/msystem
if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then
if [ "$MSYSTEM_CARCH" = "aarch64" ]; then
export ARTIFACTS_SUFFIX="-a64"
elif [[ "$MSYSTEM_CARCH" == "x86_64" ]]; then
elif [ "$MSYSTEM_CARCH" = "x86_64" ]; then
export ARTIFACTS_SUFFIX="-x64"
else # [[ "$MSYSTEM_CARCH" == "i686" ]];
else # [ "$MSYSTEM_CARCH" = "i686" ];
export ARTIFACTS_SUFFIX="-x86"
fi
if [[ -z "$GITLAB_CI" ]]; then
if [ -z "$GITLAB_CI" ]; then
# Make the script work locally
if [[ "$0" != "build/windows/gitlab-ci/1_build-deps-msys2.sh" ]]; then
if [ "$0" != "build/windows/gitlab-ci/1_build-deps-msys2.sh" ]; then
echo "To run this script locally, please do it from to the gimp git folder"
exit 1
fi
@ -27,11 +27,11 @@ fi
# Install the required (pre-built) packages for babl and GEGL
DEPS_LIST=$(cat ${GIMP_DIR}build/windows/gitlab-ci/all-deps-uni.txt)
DEPS_LIST=$(sed "s/\${MINGW_PACKAGE_PREFIX}-/${MINGW_PACKAGE_PREFIX}-/g" <<< $DEPS_LIST)
DEPS_LIST=$(sed 's/\\//g' <<< $DEPS_LIST)
DEPS_LIST=$(cat ${GIMP_DIR}build/windows/gitlab-ci/all-deps-uni.txt |
sed "s/\${MINGW_PACKAGE_PREFIX}-/${MINGW_PACKAGE_PREFIX}-/g" |
sed 's/\\//g')
if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then
if [ "$MSYSTEM_CARCH" = "aarch64" ]; then
retry=3
while [ $retry -gt 0 ]; do
timeout --signal=KILL 3m pacman --noconfirm -S --needed git \

View File

@ -3,8 +3,8 @@
set -e
# BASH ENV
if [[ -z "$CROSSROAD_PLATFORM" ]]; then
# SHELL ENV
if [ -z "$CROSSROAD_PLATFORM" ]; then
# So that we can use gimp-console from gimp-debian-x64 project.
GIMP_APP_VERSION=$(grep GIMP_APP_VERSION _build${ARTIFACTS_SUFFIX}/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')

View File

@ -4,17 +4,17 @@ set -e
# $MSYSTEM_CARCH, $MSYSTEM_PREFIX and $MINGW_PACKAGE_PREFIX are defined by MSYS2.
# https://github.com/msys2/MSYS2-packages/blob/master/filesystem/msystem
if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then
if [ "$MSYSTEM_CARCH" = "aarch64" ]; then
export ARTIFACTS_SUFFIX="-a64"
elif [[ "$MSYSTEM_CARCH" == "x86_64" ]]; then
elif [ "$MSYSTEM_CARCH" = "x86_64" ]; then
export ARTIFACTS_SUFFIX="-x64"
else # [[ "$MSYSTEM_CARCH" == "i686" ]];
else # [ "$MSYSTEM_CARCH" = "i686" ];
export ARTIFACTS_SUFFIX="-x86"
fi
if [[ -z "$GITLAB_CI" ]]; then
if [ -z "$GITLAB_CI" ]; then
# Make the script work locally
if [[ "$0" != "build/windows/gitlab-ci/2_build-gimp-msys2.sh" ]]; then
if [ "$0" != "build/windows/gitlab-ci/2_build-gimp-msys2.sh" ]; then
echo "To run this script locally, please do it from to the gimp git folder"
exit 1
fi
@ -27,8 +27,8 @@ fi
# Install the required (pre-built) packages for GIMP
# We take code from deps script to better maintenance
GIMP_DIR=""
DEPS_CODE=$(cat build/windows/gitlab-ci/1_build-deps-msys2.sh)
DEPS_CODE=$(sed -n '/# Install the/,/# End of install/p' <<< $DEPS_CODE)
DEPS_CODE=$(cat build/windows/gitlab-ci/1_build-deps-msys2.sh |
sed -n '/# Install the/,/# End of install/p')
echo "$DEPS_CODE" | bash
@ -112,7 +112,7 @@ make_cmd ()
sed -i 's|c:/|c:\\|g;s|msys64/|msys64\\|g' ${GIMP_PREFIX}/gimp.cmd
}
if [[ "$GITLAB_CI" ]]; then
if [ "$GITLAB_CI" ]; then
make_cmd CI %cd% ""
else
make_cmd local $MSYS2_PREFIX " (please run bin/gimp-${GIMP_APP_VERSION}.exe under MSYS2)"

View File

@ -4,11 +4,11 @@ set -e
# $MSYSTEM_CARCH and $MSYSTEM_PREFIX are defined by MSYS2.
# https://github.com/msys2/MSYS2-packages/blob/master/filesystem/msystem
if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then
if [ "$MSYSTEM_CARCH" = "aarch64" ]; then
export ARTIFACTS_SUFFIX="-a64"
elif [[ "$CI_JOB_NAME" == "gimp-win-x64-cross" ]] || [[ "$MSYSTEM_CARCH" == "x86_64" ]]; then
elif [ "$CI_JOB_NAME" = "gimp-win-x64-cross" ] || [ "$MSYSTEM_CARCH" = "x86_64" ]; then
export ARTIFACTS_SUFFIX="-x64"
else # [[ "$MSYSTEM_CARCH" == "i686" ]];
else # [ "$MSYSTEM_CARCH" = "i686" ];
export ARTIFACTS_SUFFIX="-x86"
fi
@ -75,8 +75,7 @@ mkdir ${GIMP_DISTRIB}/share
cp -fr ${MSYS_PREFIX}/share/ghostscript/ ${GIMP_DISTRIB}/share/
rm -r ${GIMP_DISTRIB}/share/ghostscript/*/doc
cp -fr ${GIMP_PREFIX}/share/gimp/ ${GIMP_DISTRIB}/share/
GLIB_PATH=$(echo ${MSYS_PREFIX}/share/glib-*/schemas)
GLIB_PATH=$(sed "s|${MSYS_PREFIX}/||g" <<< $GLIB_PATH)
GLIB_PATH=$(echo ${MSYS_PREFIX}/share/glib-*/schemas | sed "s|${MSYS_PREFIX}/||g")
mkdir -p ${GIMP_DISTRIB}/${GLIB_PATH}
cp -fr ${MSYS_PREFIX}/share/glib-*/schemas/ ${GIMP_DISTRIB}/share/glib-*/
@ -134,9 +133,9 @@ for exe in "${binArray[@]}"; do
done
### .pdb (CodeView) debug symbols
### TODO: REMOVE 'if [[ "$MSYSTEM...' WHEN GCC 14 IS ON MSYS2
### TODO: REMOVE 'if [ "$MSYSTEM...' WHEN GCC 14 IS ON MSYS2
### crossroad don't have LLVM/Clang backend yet
if [[ "$MSYSTEM_CARCH" != "i686" ]] && [[ ! "$CI_JOB_NAME" =~ "cross" ]]; then
if [ "$MSYSTEM_CARCH" != "i686" ] && [[ ! "$CI_JOB_NAME" =~ "cross" ]]; then
cp -fr ${GIMP_PREFIX}/bin/*.pdb ${GIMP_DISTRIB}/bin/
fi