jdk

Форк
0
/
build-cross-compile.yml 
188 строк · 7.1 Кб
1
#
2
# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
name: 'Build (cross-compile)'
27

28
on:
29
  workflow_call:
30
    inputs:
31
      gcc-major-version:
32
        required: true
33
        type: string
34
      extra-conf-options:
35
        required: false
36
        type: string
37
      configure-arguments:
38
        required: false
39
        type: string
40
      make-arguments:
41
        required: false
42
        type: string
43

44
jobs:
45
  build-cross-compile:
46
    name: build
47
    runs-on: ubuntu-22.04
48

49
    strategy:
50
      fail-fast: false
51
      matrix:
52
        target-cpu:
53
          - aarch64
54
          - arm
55
          - s390x
56
          - ppc64le
57
          - riscv64
58
        include:
59
          - target-cpu: aarch64
60
            gnu-arch: aarch64
61
            debian-arch: arm64
62
            debian-repository: https://httpredir.debian.org/debian/
63
            debian-version: bullseye
64
            tolerate-sysroot-errors: false
65
          - target-cpu: arm
66
            gnu-arch: arm
67
            debian-arch: armhf
68
            debian-repository: https://httpredir.debian.org/debian/
69
            debian-version: bullseye
70
            tolerate-sysroot-errors: false
71
            gnu-abi: eabihf
72
          - target-cpu: s390x
73
            gnu-arch: s390x
74
            debian-arch: s390x
75
            debian-repository: https://httpredir.debian.org/debian/
76
            debian-version: bullseye
77
            tolerate-sysroot-errors: false
78
          - target-cpu: ppc64le
79
            gnu-arch: powerpc64le
80
            debian-arch: ppc64el
81
            debian-repository: https://httpredir.debian.org/debian/
82
            debian-version: bullseye
83
            tolerate-sysroot-errors: false
84
          - target-cpu: riscv64
85
            gnu-arch: riscv64
86
            debian-arch: riscv64
87
            debian-repository: https://httpredir.debian.org/debian/
88
            debian-version: sid
89
            tolerate-sysroot-errors: true
90

91
    steps:
92
      - name: 'Checkout the JDK source'
93
        uses: actions/checkout@v4
94

95
      - name: 'Get the BootJDK'
96
        id: bootjdk
97
        uses: ./.github/actions/get-bootjdk
98
        with:
99
          platform: linux-x64
100

101
      - name: 'Get GTest'
102
        id: gtest
103
        uses: ./.github/actions/get-gtest
104

105
        # Upgrading apt to solve libc6 installation bugs, see JDK-8260460.
106
      - name: 'Install toolchain and dependencies'
107
        run: |
108
          # Install dependencies using apt-get
109
          sudo apt-get update
110
          sudo apt-get install --only-upgrade apt
111
          sudo apt-get install \
112
              gcc-${{ inputs.gcc-major-version }} \
113
              g++-${{ inputs.gcc-major-version }} \
114
              gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} \
115
              g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} \
116
              libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
117
          sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }}
118

119
      - name: 'Check cache for sysroot'
120
        id: get-cached-sysroot
121
        uses: actions/cache@v4
122
        with:
123
          path: sysroot
124
          key: sysroot-${{ matrix.debian-arch }}-${{ hashFiles('./.github/workflows/build-cross-compile.yml') }}
125

126
      - name: 'Install sysroot dependencies'
127
        run: sudo apt-get install debootstrap qemu-user-static
128
        if: steps.get-cached-sysroot.outputs.cache-hit != 'true'
129

130
      - name: 'Create sysroot'
131
        id: create-sysroot
132
        run: >
133
          sudo debootstrap
134
          --arch=${{ matrix.debian-arch }}
135
          --verbose
136
          --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev
137
          --resolve-deps
138
          --variant=minbase
139
          ${{ matrix.debian-version }}
140
          sysroot
141
          ${{ matrix.debian-repository }}
142
        continue-on-error: ${{ matrix.tolerate-sysroot-errors }}
143
        if: steps.get-cached-sysroot.outputs.cache-hit != 'true'
144

145
      - name: 'Prepare sysroot'
146
        run: |
147
          # Prepare sysroot and remove unused files to minimize cache
148
          sudo chroot sysroot symlinks -cr .
149
          sudo chown ${USER} -R sysroot
150
          rm -rf sysroot/{dev,proc,run,sys,var}
151
          rm -rf sysroot/usr/{sbin,bin,share}
152
          rm -rf sysroot/usr/lib/{apt,gcc,udev,systemd}
153
          rm -rf sysroot/usr/libexec/gcc
154
        if: steps.create-sysroot.outcome == 'success' && steps.get-cached-sysroot.outputs.cache-hit != 'true'
155

156
      - name: 'Remove broken sysroot'
157
        run: |
158
          sudo rm -rf sysroot/
159
        if: steps.create-sysroot.outcome != 'success' && steps.get-cached-sysroot.outputs.cache-hit != 'true'
160

161
      - name: 'Configure'
162
        run: >
163
          bash configure
164
          --with-conf-name=linux-${{ matrix.target-cpu }}
165
          --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
166
          --with-boot-jdk=${{ steps.bootjdk.outputs.path }}
167
          --with-gtest=${{ steps.gtest.outputs.path }}
168
          --with-zlib=system
169
          --enable-debug
170
          --disable-precompiled-headers
171
          --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}
172
          --with-sysroot=sysroot
173
          --with-jmod-compress=zip-1
174
          CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }}
175
          CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }}
176
          ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
177
          echo "Dumping config.log:" &&
178
          cat config.log &&
179
          exit 1)
180
        if: steps.create-sysroot.outcome == 'success' || steps.get-cached-sysroot.outputs.cache-hit == 'true'
181

182
      - name: 'Build'
183
        id: build
184
        uses: ./.github/actions/do-build
185
        with:
186
          make-target: 'hotspot ${{ inputs.make-arguments }}'
187
          platform: linux-${{ matrix.target-cpu }}
188
        if: steps.create-sysroot.outcome == 'success' || steps.get-cached-sysroot.outputs.cache-hit == 'true'
189

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.