Skip to content

Commit 8e98d7f

Browse files
committed
[Static SDK] Tweak build script slightly.
We need to run the build and install of bzip2 together, otherwise bzip2 tries to run tests, which won't necessarily work when cross compiling for a different architecture. We also want to remove various directories from the final result.
1 parent 50b6c1f commit 8e98d7f

File tree

1 file changed

+25
-15
lines changed
  • swift-ci/sdks/static-linux/scripts

1 file changed

+25
-15
lines changed

swift-ci/sdks/static-linux/scripts/build.sh

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ EOF
406406
# Make some directories
407407
mkdir -p "$build_dir/$arch/musl" \
408408
"$build_dir/$arch/runtimes" \
409-
"$sdk_root/$arch/usr"
409+
"$sdk_root/usr"
410410

411411
# -----------------------------------------------------------------------
412412

@@ -653,23 +653,17 @@ EOF
653653

654654
# -----------------------------------------------------------------------
655655

656-
header "Building bzip2 for $arch"
656+
header "Building and installing bzip2 for $arch"
657+
658+
# We do this in a single step because bzip2's Makefile has
659+
# its `test` action as a dependency of `all`, and that won't work
660+
# when we're cross-compiling unless we've got the right binformat
661+
# modules installed.
662+
#
663+
# The `install` action doesn't have this problem.
657664

658665
rm -rf ${build_dir}/$arch/bzip2
659666
cp -R ${source_dir}/bzip2 ${build_dir}/$arch/bzip2
660-
quiet_pushd $build_dir/$arch/bzip2
661-
run make \
662-
CC="$cc" \
663-
CXX="$cxx" \
664-
LDFLAGS="$ldflags" \
665-
CXXLDFLAGS="$cxxldflags" \
666-
AS="$as" \
667-
AR="ar" RANLIB="ranlib" \
668-
PREFIX=$sdk_root/usr
669-
quiet_popd
670-
671-
header "Installing bzip2 for $arch"
672-
673667
quiet_pushd $build_dir/$arch/bzip2
674668
run make install \
675669
CC="$cc" \
@@ -699,6 +693,7 @@ EOF
699693

700694
quiet_pushd ${build_dir}/$arch/xz
701695
run ninja -j$parallel_jobs install
696+
702697
quiet_popd
703698

704699
# -----------------------------------------------------------------------
@@ -954,6 +949,21 @@ EOF
954949
$sdk_root/usr/lib/swift/linux \
955950
$sdk_root/usr/lib/swift_static/linux
956951

952+
# -----------------------------------------------------------------------
953+
954+
header "Removing unnecessary files"
955+
956+
# Some of the scripts that get installed into /usr/bin are GPL'd.
957+
# We don't want those, but also we don't really need the things in
958+
# /usr/bin at all here. Same goes for the man pages and documentation
959+
# that get installed; if users want those things, installing the
960+
# package on the host system makes more sense.
961+
962+
for dir in usr/bin man usr/share/doc usr/share/man; do
963+
echo " $dir"
964+
rm -rf ${sdk_root}/$dir
965+
done
966+
957967
done
958968

959969
# Now generate the bundle

0 commit comments

Comments
 (0)