build/windows: Make sources downloading more neutral

This makes crossroad and msys2 scripts clone without the "_" prefix, which
will improve quality of life of most contributors that just clone them.

Just for consistency, also remove the "_" prefix from other pices of code.
This commit is contained in:
Bruno 2024-07-28 07:42:02 -03:00
parent 47c7bfba29
commit f73bf7fb07
No known key found for this signature in database
4 changed files with 65 additions and 77 deletions

View File

@ -257,15 +257,15 @@ deps-debian-x64:
sort --version-sort | tail -1);
gegl_branch="--branch=$gegl_tag";
fi
- git clone $babl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl
- git clone $gegl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl
- git clone $babl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git
- git clone $gegl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git
# Build babl and GEGL
- mkdir _babl/_build && cd _babl/_build
- mkdir babl/_build && cd babl/_build
- meson setup .. -Dprefix="${GIMP_PREFIX}"
- ninja
- ninja install
- ccache --show-stats
- mkdir ../../_gegl/_build && cd ../../_gegl/_build
- mkdir ../../gegl/_build && cd ../../gegl/_build
- meson setup .. -Dprefix="${GIMP_PREFIX}"
- ninja
- ninja install
@ -273,8 +273,8 @@ deps-debian-x64:
artifacts:
paths:
- _install/
- _babl/_build/meson-logs/meson-log.txt
- _gegl/_build/meson-logs/meson-log.txt
- babl/_build/meson-logs/meson-log.txt
- gegl/_build/meson-logs/meson-log.txt
expire_in: 2 hours
gimp-debian-x64:
@ -417,8 +417,8 @@ deps-win-x64-cross:
artifacts:
paths:
- .local/
- _babl/_build-cross/meson-logs/meson-log.txt
- _gegl/_build-cross/meson-logs/meson-log.txt
- babl/_build-cross/meson-logs/meson-log.txt
- gegl/_build-cross/meson-logs/meson-log.txt
expire_in: 2 hours
gimp-win-x64-cross:
@ -485,8 +485,8 @@ deps-win-a64:
artifacts:
paths:
- _install/
- _babl/_build/meson-logs/meson-log.txt
- _gegl/_build/meson-logs/meson-log.txt
- babl/_build/meson-logs/meson-log.txt
- gegl/_build/meson-logs/meson-log.txt
expire_in: 2 hours
gimp-win-a64:
@ -674,7 +674,7 @@ cppcheck:
- apt-get update
- apt-get install -y cppcheck
- cppcheck -q -j8 --enable=all --force --output-file=cppcheck.xml --xml --xml-version=2
-i _build -i _build-cross -i _babl -i _gegl -i _install -i .local -i .cache -i _ccache -i gimp-x64 .
-i _build -i _build-cross -i babl -i gegl -i _install -i .local -i .cache -i _ccache -i gimp-x64 .
- mkdir report
- cppcheck-htmlreport --source-dir=. --title=gimp --file=cppcheck.xml --report-dir=report
artifacts:
@ -718,8 +718,8 @@ dev-docs:
script:
- apt-get update
- apt-get install -y xz-utils
- BABL_VER=$(grep BABL_VERSION _babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
BABL_API_VER=$(grep BABL_API_VERSION _babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
- BABL_VER=$(grep BABL_VERSION babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
BABL_API_VER=$(grep BABL_API_VERSION babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
DIR_NAME=babl-api-docs-$BABL_VER &&
mkdir $DIR_NAME &&
mv "${GIMP_PREFIX}/share/doc/babl-$BABL_API_VER" $DIR_NAME/ &&
@ -727,9 +727,9 @@ dev-docs:
tar --dereference -cJf ${TAR_NAME} $DIR_NAME &&
sha256sum $TAR_NAME > ${TAR_NAME}.SHA256SUMS &&
sha512sum $TAR_NAME > ${TAR_NAME}.SHA512SUMS
- GEGL_MAJ_VER=$(grep GEGL_MAJOR_VERSION _gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIN_VER=$(grep GEGL_MINOR_VERSION _gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIC_VER=$(grep GEGL_MICRO_VERSION _gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
- GEGL_MAJ_VER=$(grep GEGL_MAJOR_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIN_VER=$(grep GEGL_MINOR_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIC_VER=$(grep GEGL_MICRO_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_VER="$GEGL_MAJ_VER.$GEGL_MIN_VER.$GEGL_MIC_VER" &&
GEGL_API_VER="$GEGL_MAJ_VER.$GEGL_MIN_VER" &&
DIR_NAME=gegl-api-docs-$GEGL_VER &&

View File

@ -19,28 +19,14 @@ if [ -z "$GITLAB_CI" ]; then
cd $(dirname $PWD)
fi
## Clone crossroad and some deps (follow master branch)
clone_or_pull ()
{
if [ ! -d "_$1" ]; then
if [ ! "$2" ]; then
domain=https://gitlab.gnome.org/gnome
else
domain=$2
fi
git clone --depth $GIT_DEPTH $domain/$1 _$1
else
cd _$1 && git pull && cd ..
fi
}
## Install crossroad and its deps
if [ "$GITLAB_CI" ]; then
apt-get install -y --no-install-recommends \
wine \
wine64
fi
clone_or_pull crossroad https://gitlab.freedesktop.org/crossroad
cd _crossroad
git clone --depth $GIT_DEPTH https://gitlab.freedesktop.org/crossroad/crossroad
cd crossroad
git apply ../${GIMP_DIR}build/windows/patches/0001-platforms-Enable-ccache.patch | continue
# Needed because Debian adds by default a local/ folder to the install
# prefix of setup.py. This environment variable overrides this behavior.
@ -48,16 +34,12 @@ export DEB_PYTHON_INSTALL_LAYOUT="deb"
./setup.py install --prefix=`pwd`/../.local
cd ..
clone_or_pull babl
clone_or_pull gegl
# CROSSROAD ENV
export PATH="$PWD/.local/bin:$PATH"
export XDG_DATA_HOME="$PWD/.local/share"
crossroad w64 gimp --run="${GIMP_DIR}build/windows/1_build-deps-crossroad.sh"
else
export ARTIFACTS_SUFFIX="-cross"
## Install the required (pre-built) packages for babl, GEGL and GIMP
crossroad source msys2
@ -68,14 +50,24 @@ if [ $? -ne 0 ]; then
exit 1;
fi
## Prepare env (no env var is needed, all are auto set to CROSSROAD_PREFIX)
export ARTIFACTS_SUFFIX="-cross"
## Build babl and GEGL
configure_or_build ()
self_build ()
{
if [ ! -f "_$1/_build$ARTIFACTS_SUFFIX/build.ninja" ]; then
mkdir -p _$1/_build$ARTIFACTS_SUFFIX && cd _$1/_build$ARTIFACTS_SUFFIX
# Clone source only if not already cloned or downloaded
if [ ! -d "$1" ]; then
git clone --depth $GIT_DEPTH https://gitlab.gnome.org/gnome/$1
else
cd $1 && git pull && cd ..
fi
if [ ! -f "$1/_build$ARTIFACTS_SUFFIX/build.ninja" ]; then
mkdir -p $1/_build$ARTIFACTS_SUFFIX && cd $1/_build$ARTIFACTS_SUFFIX
crossroad meson setup .. $2
else
cd _$1/_build$ARTIFACTS_SUFFIX
cd $1/_build$ARTIFACTS_SUFFIX
fi
ninja
ninja install
@ -83,8 +75,8 @@ configure_or_build ()
cd ../..
}
configure_or_build babl '-Denable-gir=false'
configure_or_build gegl '-Dintrospection=false'
self_build babl '-Denable-gir=false'
self_build gegl '-Dintrospection=false'
## FIXME: Build manually gio 'giomodule.cache' to fix error about
## absent libgiognutls.dll that prevents generating loaders.cache

View File

@ -52,30 +52,6 @@ fi
# End of install code block
# Clone babl and GEGL
clone_or_pull ()
{
repo="https://gitlab.gnome.org/GNOME/${1}.git"
if [ "$CI_COMMIT_TAG" != "" ]; then
# For tagged jobs (i.e. release or test jobs for upcoming releases), use the
# last tag. Otherwise use the default branch's HEAD.
tag=$(git ls-remote --tags --exit-code --refs "$repo" | grep -oi "$1_[0-9]*_[0-9]*_[0-9]*" | sort --version-sort | tail -1)
git_options="--branch=$tag"
echo "Using tagged release of $1: $tag"
fi
if [ ! -d "_${1}" ]; then
git clone $git_options --depth $GIT_DEPTH $repo _${1} || exit 1
else
cd _${1} && git pull && cd ..
fi
}
clone_or_pull babl
clone_or_pull gegl
# Prepare env
## We need to create the condition this ugly way to not break CI
if [ "$GITLAB_CI" ]; then
@ -92,13 +68,31 @@ done
# Build babl and GEGL
configure_or_build ()
self_build ()
{
if [ ! -f "_${1}/_build/build.ninja" ]; then
mkdir -p _${1}/_build && cd _${1}/_build
meson setup .. -Dprefix="${GIMP_PREFIX}" $2
# Clone source only if not already cloned or downloaded
repo="https://gitlab.gnome.org/GNOME/$1.git"
if [ "$CI_COMMIT_TAG" != "" ]; then
# For tagged jobs (i.e. release or test jobs for upcoming releases), use the
# last tag. Otherwise use the default branch's HEAD.
tag=$(git ls-remote --tags --exit-code --refs "$repo" | grep -oi "${1}_[0-9]*_[0-9]*_[0-9]*" | sort --version-sort | tail -1)
git_options="--branch=$tag"
echo "Using tagged release of $1: $tag"
fi
if [ ! -d "$1" ]; then
git clone $git_options --depth $GIT_DEPTH $repo || exit 1
else
cd _${1}/_build
cd $1 && git pull && cd ..
fi
# Build
if [ ! -f "$1/_build/build.ninja" ]; then
mkdir -p $1/_build && cd $1/_build
meson setup .. -Dprefix="$GIMP_PREFIX" $2
else
cd $1/_build
fi
ninja
ninja install
@ -106,5 +100,5 @@ configure_or_build ()
cd ../..
}
configure_or_build babl '-Dwith-docs=false'
configure_or_build gegl '-Dworkshop=true'
self_build babl '-Dwith-docs=false'
self_build gegl '-Dworkshop=true'

View File

@ -47,9 +47,11 @@ export PATH="$PWD/${PARENT_DIR}.local/bin:$PWD/bin:$PATH"
export XDG_DATA_HOME="$PWD/${PARENT_DIR}.local/share"
crossroad w64 gimp --run="build/windows/2_build-gimp-crossroad.sh"
else
export ARTIFACTS_SUFFIX="-cross"
## The required packages for GIMP are taken from the previous job
## The required packages for GIMP are taken from the result of previous script
## Prepare env (no env var is needed, all are auto set to CROSSROAD_PREFIX)
export ARTIFACTS_SUFFIX="-cross"
## Build GIMP
if [ ! -f "_build$ARTIFACTS_SUFFIX/build.ninja" ]; then
@ -77,7 +79,7 @@ echo "@echo off
echo.
bin\gimp-$GIMP_APP_VERSION.exe" > ${CROSSROAD_PREFIX}/gimp.cmd
## Copy built GIMP, babl and GEGL and pre-built packages to GIMP_PREFIX
## Copy GIMP and all its deps to improvised GIMP_PREFIX
if [ "$GITLAB_CI" ]; then
cp -fr $CROSSROAD_PREFIX/ _install$ARTIFACTS_SUFFIX
fi