|
| 1 | +# This source file is part of the Swift.org open source project |
| 2 | +# |
| 3 | +# Copyright (c) 2021 Apple Inc. and the Swift project authors |
| 4 | +# Licensed under Apache License v2.0 with Runtime Library Exception |
| 5 | +# |
| 6 | +# See http://swift.org/LICENSE.txt for license information |
| 7 | +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors |
| 8 | + |
1 | 9 | #!/usr/bin/env bash |
2 | 10 |
|
3 | | -# This script assumes it's running in a container as root |
4 | | -# and that /out is mounted to a directory on the local |
5 | | -# filesystem so the build output and artifacts can be |
6 | | -# copied out and used |
| 11 | +set +ex |
7 | 12 |
|
8 | | -OUTDIR=/out |
9 | | -if [[ ! -d "$OUTDIR" ]] |
10 | | -then |
| 13 | +OUTDIR=/output |
| 14 | +if [[ ! -d "$OUTDIR" ]]; then |
11 | 15 | echo "$OUTDIR does not exist, so no place to copy the artifacts!" |
12 | 16 | exit 1 |
13 | 17 | fi |
14 | 18 |
|
15 | | -# Always make sure we're up to date |
| 19 | +# always make sure we're up to date |
16 | 20 | yum update -y |
17 | 21 |
|
| 22 | +# prepare direcoties |
| 23 | +mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} |
| 24 | + |
| 25 | +# Add the spec |
| 26 | +cp swift-lang.spec $HOME/rpmbuild/SPECS/swift-lang.spec |
| 27 | +# Add the patches |
| 28 | +cp patches/*.patch $HOME/rpmbuild/SOURCES/ |
| 29 | + |
| 30 | +pushd $HOME/rpmbuild/SPECS |
| 31 | +# install all the dependencies needed to build Swift from the spec file itself |
| 32 | +yum-builddep -y ./swift-lang.spec |
| 33 | +# get the sources for Swift as defined in the spec file |
| 34 | +spectool -g -R ./swift-lang.spec |
18 | 35 | # Now we proceed to build Swift. If this is successful, we |
19 | 36 | # will have two files: a SRPM file which contains the source files |
20 | 37 | # as well as a regular RPM file that can be installed via `dnf' or `yum' |
21 | | -pushd $HOME/rpmbuild/SPECS |
22 | | -rpmbuild -ba ./swift-lang.spec 2>&1 | tee $HOME/build-output.txt |
| 38 | +rpmbuild -ba ./swift-lang.spec 2>&1 | tee /root/build-output.txt |
23 | 39 | popd |
24 | 40 |
|
25 | 41 | # Include the build log which can be used to determine what went |
|
0 commit comments