-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (121 loc) · 4.79 KB
/
build.yml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
on:
push:
branches:
- master
- topic/gha_up
pull_request:
name: Build binaries
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix: # Build debug and production
os: [ubuntu-22.04] # , windows-latest] # there is no LLD 14 in msys2 anymore
runs-on: ${{ matrix.os }}
steps:
- name: 'git config'
run: git config --global core.autocrlf input
shell: bash
- name: Get gnat-llvm
uses: actions/checkout@v2
if: ${{ runner.os != 'Windows' }}
with:
repository: AdaCore/gnat-llvm
ref: '66e36d929524972353600db5d604d0189cf0308f'
path: gnat-llvm
- name: Get bb-runtimes
uses: actions/checkout@v2
if: ${{ runner.os != 'Windows' }}
with:
repository: Fabien-Chouteau/bb-runtimes
path: gnat-llvm/llvm-interface/bb-runtimes
ref: 'gnat-fsf-14'
- name: Get gcc
uses: actions/checkout@v2
if: ${{ runner.os != 'Windows' }}
with:
repository: gcc-mirror/gcc
path: gnat-llvm/llvm-interface/gcc
ref: 'releases/gcc-14.1.0'
- name: Get AdaWebPack
uses: actions/checkout@v2
with:
path: gnat-llvm/llvm-interface/adawebpack_src
- name: Get GNAT toolchain with alire
uses: alire-project/setup-alire@v3
if: ${{ runner.os != 'Windows' }}
with:
toolchain: gnat_native^14 gprbuild
- name: Fetch LLVM
if: ${{ runner.os != 'Windows' }}
run: |
URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.4
curl -L $URL/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz \
| tar xJf -
- name: Build (Linux)
if: ${{ runner.os != 'Windows' }}
run: |
alr toolchain --select gnat_native^14 gprbuild
export PREFIX=$PWD/adawebpack
export PATH=$PWD/gnat-llvm/llvm-interface/bin:$PATH
export PATH=`ls -d $HOME/.local/share/alire/toolchains/*/bin |tr '\n' ':'`$PATH
export PATH=$PWD/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin:$PATH
echo PATH=$PATH
pwd
ls -l
ls -l gnat-llvm/llvm-interface/
cd gnat-llvm/llvm-interface
patch -p1 < adawebpack_src/patches/gnat-llvm.patch
patch -p1 < adawebpack_src/patches/llvm_wrapper2.patch
ln -sv gcc/gcc/ada gnat_src
ln -sv adawebpack_src/source/rtl/Makefile.target
ln -sv bb-runtimes/gnat_rts_sources/include/rts-sources
make wasm
make -C adawebpack_src build_examples
set -x
find -D exec bin -size +100k -exec chrpath -d {} \;
mkdir -p ${PREFIX}/share/gprconfig
mkdir -p ${PREFIX}/lib/gnat
mkdir -p ${PREFIX}/share/adawebpack
cp adawebpack_src/packages/Fedora/llvm.xml ${PREFIX}/share/gprconfig/
cp adawebpack_src/gnat/adawebpack_config.gpr ${PREFIX}/lib/gnat/
cp -r bin lib ${PREFIX}
cp -v adawebpack_src/source/adawebpack.mjs ${PREFIX}/share/adawebpack/
gprconfig --batch -o /tmp/llvm.cgpr --db `pwd`/adawebpack_src/packages/Fedora --target=llvm --config=ada,,
gprbuild --target=llvm -P adawebpack_src/gnat/adawebpack.gpr -p --config=/tmp/llvm.cgpr
gprinstall --target=llvm --prefix=${PREFIX} --project-subdir=${PREFIX}/lib/gnat -P adawebpack_src/gnat/adawebpack.gpr -p --config=/tmp/llvm.cgpr
cd `dirname ${PREFIX}`
tar czf ${PREFIX}.tar.gz `basename ${PREFIX}`
- name: Setup MSYS2
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: |
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gcc-ada
mingw-w64-x86_64-gprbuild
# mingw-w64-x86_64-clang
# mingw-w64-x86_64-lld
- name: Build MSYS2 package
if: ${{ runner.os == 'Windows' }}
shell: msys2 {0}
run: |
curl -O https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-llvm-14.0.6-6-any.pkg.tar.zst
curl -O https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-clang-14.0.6-6-any.pkg.tar.zst
curl -O https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-lld-14.0.6-6-any.pkg.tar.zst
pacman -U --noconfirm mingw-w64-x86_64-*-14.0.6-6-any.pkg.tar.zst
rm -rf *.tar.zst
mv gnat-llvm/llvm-interface/adawebpack_src adawebpack
cp -r adawebpack/packages/msys2 .
tar czf msys2/adawebpack.tar.gz adawebpack
cd msys2
makepkg-mingw --noconfirm --noprogressbar -sCLf
mv -v *.tar.zst ..
- name: Keep archive in artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}
path: "*.tar.*"