Skip to content

Commit

Permalink
Add clone of tested libraries to update-sources.sh (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex authored Jan 6, 2025
1 parent 1a0f34c commit d0c2986
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 13 deletions.
31 changes: 28 additions & 3 deletions .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

BINUTILS_REPO=${BINUTILS_REPO:-Windows-on-ARM-Experiments/binutils-woarm64}
BINUTILS_BRANCH=${BINUTILS_BRANCH:-woarm64}

GCC_REPO=${GCC_REPO:-Windows-on-ARM-Experiments/gcc-woarm64}
GCC_BRANCH=${GCC_BRANCH:-woarm64}

MINGW_REPO=${MINGW_REPO:-Windows-on-ARM-Experiments/mingw-woarm64}
MINGW_BRANCH=${MINGW_BRANCH:-woarm64}

CYGWIN_REPO=${CYGWIN_REPO:-Windows-on-ARM-Experiments/newlib-cygwin}
CYGWIN_BRANCH=${CYGWIN_BRANCH:-main}

CYGWIN_PACKAGES_REPO=${CYGWIN_PACKAGES_REPO:-Windows-on-ARM-Experiments/cygwin-packages}
CYGWIN_PACKAGES_BRANCH=${CYGWIN_PACKAGES_BRANCH:-main}

COCOM_REPO=${COCOM_REPO:-https://git.code.sf.net/p/cocom/git}
COCOM_BRANCH=${COCOM_BRANCH:-master}

ARCH=${ARCH:-aarch64}
Expand Down Expand Up @@ -45,23 +56,36 @@ TOOLCHAIN_PACKAGE_NAME=${TOOLCHAIN_PACKAGE_NAME:-$TOOLCHAIN_NAME-toolchain.tar.g
RUNTIME_PACKAGE_NAME=${RUNTIME_PACKAGE_NAME:-$TOOLCHAIN_NAME-runtime.tar.gz}
DEJAGNU_FILE=${DEJAGNU_FILE:-$ROOT_PATH/.github/scripts/toolchain/site.exp}

OPENBLAS_REPO=${OPENBLAS_REPO:-OpenMathLib/OpenBLAS}
OPENBLAS_BRANCH=${OPENBLAS_BRANCH:-develop}

ZLIB_REPO=${ZLIB_REPO:-madler/zlib}
ZLIB_BRANCH=${ZLIB_BRANCH:-develop}
ZLIB_PATH=${ZLIB_PATH:-~/zlib}
ZLIB_TESTS_PATH=${ZLIB_TESTS_PATH:-~/zlib-tests}

LIBXML2_REPO=${LIBXML2_REPO:-GNOME/libxml2}
LIBXML2_BRANCH=${LIBXML2_BRANCH:-master}
LIBXML2_PATH=${LIBXML2_PATH:-~/libxml2}

OPENSSL_REPO=${OPENSSL_REPO:-Windows-on-ARM-Experiments/openssl}
OPENSSL_BRANCH=${OPENSSL_BRANCH:-fix-tests}
OPENSSL_PATH=${OPENSSL_PATH:-~/openssl}
OPENSSL_TESTS_PATH=${OPENSSL_TESTS_PATH:-~/openssl-tests}

LIBJPEG_TURBO_REPO=${LIBJPEG_TURBO_REPO:-libjpeg-turbo/libjpeg-turbo}
LIBJPEG_TURBO_BRANCH=${LIBJPEG_TURBO_BRANCH:-3.0.2}
LIBJPEG_TURBO_PATH=${LIBJPEG_TURBO_PATH:-~/libjpeg-turbo}
LIBJPEG_TURBO_TESTS_PATH=${LIBJPEG_TURBO_TESTS_PATH:-~/libjpeg-turbo-tests}

TESTS_PATH=${TESTS_PATH:-$ROOT_PATH/tests/build/bin/}
TESTS_PACKAGE_NAME=${TESTS_PACKAGE_NAME:-$TOOLCHAIN_NAME-tests.tar.gz}

FFMPEG_REPO=${FFMPEG_REPO:-FFmpeg/FFmpeg}
FFMPEG_BRANCH=${FFMPEG_BRANCH:-release/6.1}
FFMPEG_PATH=${FFMPEG_PATH:-~/ffmpeg}
FFMPEG_TESTS_PATH=${FFMPEG_TESTS_PATH:-~/ffmpeg-tests}

TESTS_PATH=${TESTS_PATH:-$ROOT_PATH/tests/build/bin/}
TESTS_PACKAGE_NAME=${TESTS_PACKAGE_NAME:-$TOOLCHAIN_NAME-tests.tar.gz}

CCACHE_LIB_DIR=/usr/lib/ccache
TOOLCHAIN_CCACHE_LIB_DIR=$TOOLCHAIN_PATH/lib/ccache

Expand All @@ -75,6 +99,7 @@ DEBUG=${DEBUG:-0} # Enable debug build.
CCACHE=${CCACHE:-0} # Enable usage of ccache.
RUN_BOOTSTRAP=${RUN_BOOTSTRAP:-0} # Bootstrap dependencies during the build.
UPDATE_SOURCES=${UPDATE_SOURCES:-0} # Update source code repositories.
UPDATE_LIBRARIES=${UPDATE_LIBRARIES:-0} # Update also source code of tested libraries repositories.
FLAT_CLONE=${FLAT_CLONE:-1} # Whether the clone of source codes should be full or flat.
RESET_SOURCES=${RESET_SOURCES:-0} # Reset source code repositories before update.
APPLY_PATCHES=${APPLY_PATCHES:-1} # Patch source repositories for targets requiring it.
Expand Down
43 changes: 34 additions & 9 deletions .github/scripts/update-sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ function is_remote_branch() {
return $(git show-ref --verify --quiet refs/remotes/origin/$1)
}

function is_tag() {
return $(git show-ref --verify --quiet refs/tags/$1)
}

function is_current_branch() {
[[ $(git rev-parse --abbrev-ref HEAD) == "$1" ]]
}
Expand All @@ -14,6 +18,11 @@ function update_repository() {
DIRECTORY=$1
REPOSITORY=$2
BRANCH=$3

if [[ ! $REPOSITORY =~ ^(http://|https://|git://) ]]; then
REPOSITORY="https://github.com/$REPOSITORY.git"
fi

if [[ ! -d $DIRECTORY ]]; then
if [[ "$FLAT_CLONE" = 1 ]]; then
git clone $REPOSITORY -b $BRANCH --single-branch --depth 1 $DIRECTORY
Expand All @@ -37,20 +46,27 @@ function update_repository() {
git reset --hard HEAD
fi

if [[ "$FLAT_CLONE" = 1 ]] && ! is_remote_branch $BRANCH; then
if [[ "$FLAT_CLONE" = 1 ]] && ! is_remote_branch $BRANCH && ! is_tag $BRANCH; then
git remote set-branches --add origin $BRANCH
git fetch origin --prune
fi

if ! is_current_branch $BRANCH; then
git switch $BRANCH
if is_tag $BRANCH; then
git switch --detach $BRANCH
else
git switch $BRANCH
fi
fi

if [[ "$RESET_SOURCES" = 1 ]]; then
git clean -fdx
fi

git pull
if ! is_tag $BRANCH; then
git pull
fi

git submodule update
popd
fi
Expand All @@ -60,13 +76,22 @@ echo "::group::Update source code repositories"
mkdir -p "$SOURCE_PATH"

cd "$SOURCE_PATH"
update_repository binutils https://github.com/Windows-on-ARM-Experiments/binutils-woarm64.git $BINUTILS_BRANCH
update_repository gcc https://github.com/Windows-on-ARM-Experiments/gcc-woarm64.git $GCC_BRANCH
update_repository mingw https://github.com/Windows-on-ARM-Experiments/mingw-woarm64.git $MINGW_BRANCH
update_repository binutils $BINUTILS_REPO $BINUTILS_BRANCH
update_repository gcc $GCC_REPO $GCC_BRANCH
update_repository mingw $MINGW_REPO $MINGW_BRANCH
if [[ "$PLATFORM" =~ cygwin ]]; then
update_repository cygwin https://github.com/Windows-on-ARM-Experiments/newlib-cygwin.git $CYGWIN_BRANCH
update_repository cygwin-packages https://github.com/Windows-on-ARM-Experiments/cygwin-packages.git $CYGWIN_PACKAGES_BRANCH
update_repository cocom https://git.code.sf.net/p/cocom/git $COCOM_BRANCH
update_repository cygwin $CYGWIN_REPO $CYGWIN_BRANCH
update_repository cygwin-packages $CYGWIN_PACKAGES_REPO $CYGWIN_PACKAGES_BRANCH
update_repository cocom $COCOM_REPO $COCOM_BRANCH
fi

if [[ "$UPDATE_LIBRARIES" = 1 ]]; then
update_repository openblas $OPENBLAS_REPO $OPENBLAS_BRANCH
update_repository zlib $ZLIB_REPO $ZLIB_BRANCH
update_repository libxml2 $LIBXML2_REPO $LIBXML2_BRANCH
update_repository openssl $OPENSSL_REPO $OPENSSL_BRANCH
update_repository libjpeg-turbo $LIBJPEG_TURBO_REPO $LIBJPEG_TURBO_BRANCH
update_repository ffmpeg $FFMPEG_REPO $FFMPEG_BRANCH
fi
echo "::endgroup::"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ env:
COCOM_REPO: https://git.code.sf.net/p/cocom/git
COCOM_BRANCH: ${{ inputs.cocom_branch || 'master' }}

OPENBLAS_REPO: OpenMathLib/OpenBLAS.git
OPENBLAS_REPO: OpenMathLib/OpenBLAS
OPENBLAS_BRANCH: ${{ inputs.openblas_branch || 'develop' }}

ZLIB_REPO: madler/zlib
Expand Down

0 comments on commit d0c2986

Please sign in to comment.