11
2- image : ubuntu:20.04
2+ include :
3+ - project : ' rv/it/int/rivos-sdk'
4+ ref : rivos/main
5+ file : ' /packager/gitlab-ci-packaging-helper.yml'
36
4- stages :
5- - sysroot
6- - build
7+ variables :
8+ CACHE_VERSION : " v2"
79
8- create-sysroot :
9- stage : sysroot
10+ prepare-version :
11+ after_script :
12+ - |
13+ if test -n "${CI_COMMIT_TAG}" && test "${CI_COMMIT_TAG}" =~ '^jdk\-'; then
14+ echo "JDK_VERSION_TAG=${CI_COMMIT_TAG#jdk-}" >> gitvars.env
15+ else
16+ echo "JDK_VERSION_TAG=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" >> gitvars.env
17+ fi
18+ # Debugging helper
19+ - cat gitvars.env
20+
21+ create-sysroot-ubuntu-jammy-amd64 :
22+ stage : prebuild
23+ image : ubuntu:20.04
24+ cache :
25+ - key : sysroot-ubuntu-jammy-amd64-${CACHE_VERSION}
26+ paths :
27+ - sysroot-ubuntu-jammy-amd64
28+ script :
29+ # early exit if sysroot-ubuntu-jammy-amd64 is coming from the cache
30+ - test -d sysroot-ubuntu-jammy-amd64 && exit 0
31+ - apt-get update
32+ - apt-get install -y debootstrap
33+ - |
34+ debootstrap \
35+ --verbose \
36+ --components=main,universe \
37+ --include=symlinks,qemu-user-static \
38+ --resolve-deps \
39+ jammy \
40+ sysroot-ubuntu-jammy-amd64
41+ - chroot sysroot-ubuntu-jammy-amd64 symlinks -cr .
42+ - rm -rf sysroot-ubuntu-jammy-amd64/{dev,proc,run,sys}
43+ artifacts :
44+ when : always
45+ paths :
46+ - sysroot-ubuntu-jammy-amd64
47+
48+ create-sysroot-ubuntu-jammy-rv64 :
49+ stage : prebuild
50+ image : ubuntu:20.04
1051 tags :
1152 - docker-qemu-binfmt
53+ dependencies :
54+ - create-sysroot-ubuntu-jammy-amd64
55+ needs :
56+ - create-sysroot-ubuntu-jammy-amd64
1257 cache :
13- - key : sysroot-ubuntu-jammy-riscv64
58+ - when : on_success
59+ key : sysroot-ubuntu-jammy-rv64-${CACHE_VERSION}
1460 paths :
15- - sysroot
61+ - sysroot-ubuntu-jammy-rv64
1662 script :
17- # early exit if sysroot is coming from the cache
18- - test -d sysroot && exit 0
63+ # early exit if sysroot-ubuntu-jammy-rv64 is coming from the cache
64+ - test -d sysroot-ubuntu-jammy-rv64 && exit 0
1965 - apt-get update
2066 - apt-get install -y debootstrap qemu-user-static
2167 - |
2268 qemu-debootstrap \
2369 --verbose \
2470 --arch=riscv64 \
2571 --components=main,universe \
26- --include=fakeroot, symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
72+ --include=symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
2773 --resolve-deps \
2874 jammy \
29- sysroot
30- - chroot sysroot symlinks -cr .
31- - rm -rf sysroot/{dev,proc,run,sys}
75+ sysroot-ubuntu-jammy-rv64
76+ - cp -a sysroot-ubuntu-jammy-amd64/usr/bin/qemu-riscv64-static sysroot-ubuntu-jammy-rv64/usr/bin
77+ - chroot sysroot-ubuntu-jammy-rv64 symlinks -cr .
78+ - rm -rf sysroot-ubuntu-jammy-rv64/{dev,proc,run,sys}
3279 artifacts :
3380 when : always
3481 paths :
35- - sysroot
82+ - sysroot-ubuntu-jammy-rv64
3683
37- build-linux-riscv64 :
84+ build-linux-amd64 :
3885 stage : build
86+ image : ubuntu:20.04
3987 dependencies :
40- - create-sysroot
88+ - prepare-version
89+ needs :
90+ - prepare-version
91+ script :
92+ - apt-get update
93+ - |
94+ apt-get install -y \
95+ autoconf \
96+ build-essential \
97+ curl \
98+ file \
99+ g++ \
100+ gcc \
101+ libx11-dev \
102+ libxext-dev \
103+ libxrender-dev \
104+ libxrandr-dev \
105+ libxtst-dev \
106+ libxt-dev \
107+ libcups2-dev \
108+ libfontconfig1-dev \
109+ libasound2-dev \
110+ libfreetype6-dev \
111+ libpng-dev \
112+ unzip \
113+ zip \
114+ zlib1g-dev
115+ - |
116+ mkdir -p /usr/lib/jvm/zulu-18
117+ curl -L https://cdn.azul.com/zulu/bin/zulu18.32.13-ca-jdk18.0.2.1-linux_x64.tar.gz \
118+ | tar -xzf - -C /usr/lib/jvm/zulu-18 --strip-components 1
119+ - |
120+ bash configure \
121+ --openjdk-target=x86_64-linux-gnu \
122+ --with-conf-name=linux-amd64 \
123+ --with-version-opt=${JDK_VERSION_TAG} \
124+ --with-boot-jdk=/usr/lib/jvm/zulu-18 \
125+ --disable-precompiled-headers \
126+ --with-zlib=system
127+ - make jdk-image test-image LOG_LEVEL=info
128+ artifacts :
129+ when : always
130+ paths :
131+ - config.log # in case of error during configure
132+ - build/linux-amd64/images/jdk
133+ - build/linux-amd64/images/test
134+
135+ build-linux-rv64 :
136+ stage : build
137+ image : ubuntu:20.04
138+ dependencies :
139+ - prepare-version
140+ - create-sysroot-ubuntu-jammy-rv64
141+ - build-linux-amd64
142+ needs :
143+ - prepare-version
144+ - create-sysroot-ubuntu-jammy-rv64
145+ - build-linux-amd64
41146 script :
42147 - apt-get update
43148 - |
@@ -64,15 +169,73 @@ build-linux-riscv64:
64169 - |
65170 bash configure \
66171 --openjdk-target=riscv64-linux-gnu \
67- --with-conf-name=linux-riscv64 \
68- --with-version-opt=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} \
69- --with-sysroot=$(pwd)/sysroot \
172+ --with-conf-name=linux-rv64 \
173+ --with-version-opt=${JDK_VERSION_TAG} \
174+ --with-sysroot=$(pwd)/sysroot-ubuntu-jammy-rv64 \
70175 --with-boot-jdk=/usr/lib/jvm/zulu-18 \
71- --disable-precompiled-headers
176+ --with-build-jdk=$(pwd)/build/linux-amd64/images/jdk \
177+ --disable-precompiled-headers \
178+ --with-zlib=system
72179 - make jdk-image test-image LOG_LEVEL=info
73180 artifacts :
74181 when : always
75182 paths :
76183 - config.log # in case of error during configure
77- - build/linux-riscv64/images/jdk
78- - build/linux-riscv64/images/test
184+ - build/linux-rv64/images/jdk
185+ - build/linux-rv64/images/test
186+
187+ package-tar :
188+ stage : deploy
189+ image : ubuntu:20.04
190+ dependencies :
191+ - prepare-version
192+ - build-linux-amd64
193+ - build-linux-rv64
194+ needs :
195+ - prepare-version
196+ - build-linux-amd64
197+ - build-linux-rv64
198+ script :
199+ - apt-get update
200+ - apt-get install -y curl
201+ - tar -czf jdk-${JDK_VERSION_TAG}-linux-amd64.tar.gz -C build/linux-amd64/images jdk
202+ - ' curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jdk-${JDK_VERSION_TAG}-linux-amd64.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/jdk/${JDK_VERSION_TAG}/jdk-${JDK_VERSION_TAG}-linux-amd64.tar.gz"'
203+ - tar -czf jdk-${JDK_VERSION_TAG}-linux-rv64.tar.gz -C build/linux-rv64/images jdk
204+ - ' curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jdk-${JDK_VERSION_TAG}-linux-rv64.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/jdk/${JDK_VERSION_TAG}/jdk-${JDK_VERSION_TAG}-linux-rv64.tar.gz"'
205+
206+ package-deb :
207+ extends : .deploy-deb
208+ dependencies :
209+ - prepare-version
210+ - build-linux-amd64
211+ - build-linux-rv64
212+ needs :
213+ - prepare-version
214+ - build-linux-amd64
215+ - build-linux-rv64
216+ variables :
217+ PKG_ARCH : " all"
218+ PKG_DIRECTORIES : " /rivos/jdk;/rivos/sysroot/riscv/jdk"
219+ PKG_LICENSE : " GPL-2.0 license"
220+ PKG_UPSTREAM_VERSION : " ${JDK_VERSION_TAG}"
221+ before_script :
222+ # clean up pre-built binaries from the rivos-sdk
223+ - rm -rf /rivos/jdk /rivos/sysroot/riscv/jdk
224+ # move the previous temporary install
225+ - cp -a build/linux-amd64/images/jdk /rivos/
226+ - cp -a build/linux-rv64/images/jdk /rivos/sysroot/riscv/
227+
228+ deploy-module-ubuntu :
229+ extends : .deploy-module
230+ dependencies :
231+ - prepare-version
232+ - build-linux-amd64
233+ needs :
234+ - prepare-version
235+ - build-linux-amd64
236+ variables :
237+ CONTENT_PATH : " build/linux-amd64/images/jdk"
238+
239+ # Rebuild the rivos-sdk where we are exporting the artifacts built here.
240+ update-sdk :
241+ extends : .update-sdk
0 commit comments