This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-build.sh
executable file
·70 lines (60 loc) · 2.68 KB
/
ci-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
cd "$(dirname "$0")"
source 'ci-library.sh'
mkdir artifacts
mkdir sourcepkg
## Remove packages
#deploy_enabled && cd artifacts
#execute 'Removing old python3 packages from index' remove_from_repository "${PACMAN_REPOSITORY:-ci-build}" "python3"
#success 'Package removal successful'
#exit 0
# Remove preinstalled libraries depending on if this is an rtools40 or msys64 install:
if [[ $(cygpath -m /) == *"rtools40"* ]]; then
echo "Found preinstalled rtools40 compilers!"
else
pacman --noconfirm -Rcsu $(pacman -Qqe | grep "^mingw-w64-")
fi
# Disable upstream mingw-packages
cp -f pacman.conf /etc/pacman.conf
pacman --noconfirm -Scc
pacman --noconfirm -Syyu
pacman --noconfirm --needed -S git base-devel binutils unzip pactoys
pacman --noconfirm --needed -S mingw-w64-${MINGW_TOOLCHAIN}-{toolchain,libtre,pkg-config,xz}
# Remove weird upstream build flags
sed -i 's/,--default-image-base-high//' /etc/makepkg_mingw.conf
# Initiate git
git_config user.email 'ci@msys2.org'
git_config user.name 'MSYS2 Continuous Integration'
git remote add upstream 'https://github.com/r-windows/rtools-packages'
git fetch --quiet upstream
# Detect changed packages
list_commits || failure 'Could not detect added commits'
list_packages || failure 'Could not detect changed files'
message 'Processing changes' "${commits[@]}"
test -z "${packages}" && success 'No changes in package recipes'
define_build_order || failure 'Could not determine build order'
# Build
message 'Building packages' "${packages[@]}"
execute 'Approving recipe quality' check_recipe_quality
# Force static linking
rm -f /mingw32/lib/*.dll.a
rm -f /mingw64/lib/*.dll.a
rm -f /ucrt64/lib/*.dll.a
export PKG_CONFIG="/${MINGW_ARCH}/bin/pkg-config --static"
export PKGEXT='.pkg.tar.xz'
for package in "${packages[@]}"; do
execute 'Building binary' makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --syncdeps --rmdeps --cleanbuild
#MINGW_ARCH=mingw64 execute 'Building source' makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --allsource
execute 'List output contents' ls -ltr
execute 'Installing' yes:pacman --noprogressbar --upgrade *.pkg.tar.xz
execute 'Checking Binaries' find ./pkg -regex ".*\.\(exe\|dll\|a\|pc\)"
execute 'Copying binary package' mv *.pkg.tar.xz ../artifacts
#execute 'Copying source package' mv *.src.tar.gz ../sourcepkg
unset package
done
# Prepare for deploy
cd artifacts || success 'All packages built successfully'
execute 'Updating pacman repository index' create_pacman_repository "${PACMAN_REPOSITORY:-ci-build}"
execute 'Generating build references' create_build_references "${PACMAN_REPOSITORY:-ci-build}"
execute 'SHA-256 checksums' sha256sum *
success 'All artifacts built successfully'