-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-build.sh
executable file
·73 lines (62 loc) · 2.82 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
71
72
73
#!/bin/bash
cd "$(dirname "$0")"
source 'ci-library.sh'
mkdir artifacts
mkdir sourcepkg
# Enable custom -next repos (this will break msys2 toolchains that use dll's)
cp -f pacman.conf /etc/pacman.conf
pacman --noconfirm -Scc
pacman --noconfirm -Sy
# Downgrades to be compatible with rtools
pacman --noconfirm --needed -S git patch make unzip pactoys
pacman --noconfirm -S ${MINGW_PACKAGE_PREFIX}-{cc,libtre,pkgconf,xz}
# Avoid libssp dependency
sed -i 's/-Wp,-D_FORTIFY_SOURCE=2//g' /etc/makepkg_mingw.conf
sed -i 's/-fstack-protector-strong//g' /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-next'
#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'
# Only build toolchains for appropriate targets
if [ "$MINGW_ARCH" == "ucrt64" ]; then
if [ "${packages}" == "mingw-w64-clang" ] || [ "${packages}" == "mingw-w64-libc++" ]; then
success "Skipping ${packages} for $MINGW_ARCH"
fi
else
if [ "${packages}" == "mingw-w64-gcc" ]; then
success "Skipping ${packages} for $MINGW_ARCH"
fi
fi
# Build
message 'Building packages' "${packages[@]}"
execute 'Approving recipe quality' check_recipe_quality
# Force static linking (breaks normal msys2 installation!)
export PKG_CONFIG="/${MINGW_ARCH}/bin/pkg-config --static"
rm -fv /${MINGW_ARCH}/lib/*.dll.a
export PKGEXT='.pkg.tar.xz'
for package in "${packages[@]}"; do
# Force static linking by removing import libs from deps
#execute "Installing build dependencies for $package" makepkg-mingw -seoc --noconfirm
#rm -fv /${MINGW_ARCH}/lib/*.dll.a
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}"
execute 'Generating build references' create_build_references "${PACMAN_REPOSITORY}"
execute 'SHA-256 checksums' sha256sum *
success 'All artifacts built successfully'