Skip to content

Commit bc72365

Browse files
authored
Merge pull request swiftlang#26 from tachoknight/main
Rearranged the Fedora folder
2 parents b150da7 + cfcf0ae commit bc72365

22 files changed

+2156
-5
lines changed

platforms/Linux/Fedora/34/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM fedora:34
2+
LABEL PURPOSE="This image is configured to build Swift for the version of Fedora listed above"
3+
4+
WORKDIR /root
5+
6+
RUN mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
7+
ADD swift-lang.spec /root/rpmbuild/SPECS/swift-lang.spec
8+
ADD *.patch /root/rpmbuild/SOURCES/
9+
10+
ADD build_swift_rpm.sh /root/build_swift_rpm.sh
11+
RUN chmod +x /root/build_swift_rpm.sh
12+
13+
RUN dnf -y update
14+
15+
# Required for the "rpmbuild" command
16+
RUN dnf install -y fedora-packager fedora-review
17+
18+
# Install all the dependencies needed to build Swift from the
19+
# spec file itself
20+
RUN dnf builddep -y /root/rpmbuild/SPECS/swift-lang.spec
21+
# And now get the sources for Swift as defined in the spec file
22+
RUN spectool -g -R /root/rpmbuild/SPECS/swift-lang.spec
23+
24+
CMD ["/root/build_swift_rpm.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
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
7+
8+
OUTDIR=/out
9+
if [[ ! -d "$OUTDIR" ]]
10+
then
11+
echo "$OUTDIR does not exist, so no place to copy the artifacts!"
12+
exit 1
13+
fi
14+
15+
# Always make sure we're up to date
16+
dnf -y update
17+
18+
# Now we proceed to build Swift. If this is successful, we
19+
# will have two files: a SRPM file which contains the source files
20+
# 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
23+
popd
24+
25+
# Include the build log which can be used to determine what went
26+
# wrong if there are no artifacts
27+
cp $HOME/build-output.txt $OUTDIR
28+
cp $HOME/rpmbuild/SRPMS/* $OUTDIR
29+
cp $HOME/rpmbuild/RPMS/`uname -i`/* $OUTDIR
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
diff -Naur llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
2+
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2021-05-28 10:17:04.000000000 -0500
3+
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2021-05-31 08:19:34.794058378 -0500
4+
@@ -370,15 +370,6 @@
5+
6+
#if SANITIZER_GLIBC
7+
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
8+
- _(CYGETDEFTHRESH, WRITE, sizeof(int));
9+
- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
10+
- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
11+
- _(CYGETTHRESH, WRITE, sizeof(int));
12+
- _(CYGETTIMEOUT, WRITE, sizeof(int));
13+
- _(CYSETDEFTHRESH, NONE, 0);
14+
- _(CYSETDEFTIMEOUT, NONE, 0);
15+
- _(CYSETTHRESH, NONE, 0);
16+
- _(CYSETTIMEOUT, NONE, 0);
17+
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
18+
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
19+
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
20+
diff -Naur llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
21+
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2021-05-28 10:17:04.000000000 -0500
22+
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2021-05-31 12:30:07.414710413 -0500
23+
@@ -143,7 +143,6 @@
24+
# include <sys/procfs.h>
25+
#endif
26+
#include <sys/user.h>
27+
-#include <linux/cyclades.h>
28+
#include <linux/if_eql.h>
29+
#include <linux/if_plip.h>
30+
#include <linux/lp.h>
31+
@@ -459,7 +458,6 @@
32+
33+
#if SANITIZER_GLIBC
34+
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
35+
- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
36+
#if EV_VERSION > (0x010000)
37+
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
38+
#else
39+
@@ -823,15 +821,6 @@
40+
#endif // SANITIZER_LINUX
41+
42+
#if SANITIZER_LINUX && !SANITIZER_ANDROID
43+
- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
44+
- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
45+
- unsigned IOCTL_CYGETMON = CYGETMON;
46+
- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
47+
- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
48+
- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
49+
- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
50+
- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
51+
- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
52+
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
53+
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
54+
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
55+
diff -Naur llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
56+
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2021-05-28 10:17:04.000000000 -0500
57+
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2021-05-31 12:30:40.568693281 -0500
58+
@@ -983,7 +983,6 @@
59+
60+
#if SANITIZER_LINUX && !SANITIZER_ANDROID
61+
extern unsigned struct_ax25_parms_struct_sz;
62+
-extern unsigned struct_cyclades_monitor_sz;
63+
extern unsigned struct_input_keymap_entry_sz;
64+
extern unsigned struct_ipx_config_data_sz;
65+
extern unsigned struct_kbdiacrs_sz;
66+
@@ -1328,15 +1327,6 @@
67+
#endif // SANITIZER_LINUX
68+
69+
#if SANITIZER_LINUX && !SANITIZER_ANDROID
70+
-extern unsigned IOCTL_CYGETDEFTHRESH;
71+
-extern unsigned IOCTL_CYGETDEFTIMEOUT;
72+
-extern unsigned IOCTL_CYGETMON;
73+
-extern unsigned IOCTL_CYGETTHRESH;
74+
-extern unsigned IOCTL_CYGETTIMEOUT;
75+
-extern unsigned IOCTL_CYSETDEFTHRESH;
76+
-extern unsigned IOCTL_CYSETDEFTIMEOUT;
77+
-extern unsigned IOCTL_CYSETTHRESH;
78+
-extern unsigned IOCTL_CYSETTIMEOUT;
79+
extern unsigned IOCTL_EQL_EMANCIPATE;
80+
extern unsigned IOCTL_EQL_ENSLAVE;
81+
extern unsigned IOCTL_EQL_GETMASTRCFG;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
From 14983644da3b8bbb32aa2823602e4161bf3e2ec9 Mon Sep 17 00:00:00 2001
2+
From: Dadoum <[email protected]>
3+
Date: Tue, 4 May 2021 01:06:34 +0200
4+
Subject: [PATCH] [PkgConfig] Cache PkgConfig and avoid reparsing multiple time
5+
the same file.
6+
7+
---
8+
swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift | 31 ++++++++++++++++++------------
9+
1 file changed, 19 insertions(+), 12 deletions(-)
10+
11+
diff --git a/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift b/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
12+
index 45d80995..558c81e7 100644
13+
--- a/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
14+
+++ b/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
15+
@@ -115,6 +115,8 @@ public class LoadingContext {
16+
17+
/// Information on an individual `pkg-config` supported package.
18+
public struct PkgConfig {
19+
+ public static var pkgConfigCache: [String: PkgConfig] = [String: PkgConfig]()
20+
+
21+
/// The name of the package.
22+
public let name: String
23+
24+
@@ -179,18 +181,23 @@ public struct PkgConfig {
25+
continue
26+
}
27+
28+
- // FIXME: This is wasteful, we should be caching the PkgConfig result.
29+
- let pkg = try PkgConfig(
30+
- name: dep,
31+
- additionalSearchPaths: additionalSearchPaths,
32+
- diagnostics: diagnostics,
33+
- fileSystem: fileSystem,
34+
- brewPrefix: brewPrefix,
35+
- loadingContext: loadingContext
36+
- )
37+
-
38+
- cFlags += pkg.cFlags
39+
- libs += pkg.libs
40+
+ if !PkgConfig.pkgConfigCache.keys.contains(dep) {
41+
+ PkgConfig.pkgConfigCache[dep] = try PkgConfig(
42+
+ name: dep,
43+
+ additionalSearchPaths: additionalSearchPaths,
44+
+ diagnostics: diagnostics,
45+
+ fileSystem: fileSystem,
46+
+ brewPrefix: brewPrefix,
47+
+ loadingContext: loadingContext
48+
+ )
49+
+ }
50+
+
51+
+ guard let cachedPkg = PkgConfig.pkgConfigCache[dep] else {
52+
+ fatalError("Cannot retrieve cached pkgConfig result")
53+
+ }
54+
+
55+
+ cFlags += cachedPkg.cFlags
56+
+ libs += cachedPkg.libs
57+
}
58+
59+
return (cFlags: cFlags, libs: libs)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
diff -Naur swift-orig/cmake/modules/AddSwift.cmake swift/cmake/modules/AddSwift.cmake
2+
--- swift-orig/cmake/modules/AddSwift.cmake 2021-01-11 09:24:03.000000000 -0600
3+
+++ swift/cmake/modules/AddSwift.cmake 2021-01-14 16:07:26.118061686 -0600
4+
@@ -288,7 +288,7 @@
5+
if(SWIFT_HOST_VARIANT_ARCH STREQUAL x86_64)
6+
# this is the minimum architecture that supports 16 byte CAS, which is
7+
# necessary to avoid a dependency to libatomic
8+
- target_compile_options(${target} PRIVATE -march=core2)
9+
+ target_compile_options(${target} PRIVATE -mcx16)
10+
endif()
11+
endif()
12+
13+
diff -Naur swift-orig/stdlib/cmake/modules/AddSwiftStdlib.cmake swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
14+
--- swift-orig/stdlib/cmake/modules/AddSwiftStdlib.cmake 2021-01-11 09:24:03.000000000 -0600
15+
+++ swift/stdlib/cmake/modules/AddSwiftStdlib.cmake 2021-01-14 16:06:49.905752127 -0600
16+
@@ -306,7 +306,7 @@
17+
if("${CFLAGS_SDK}" STREQUAL "LINUX")
18+
if(${CFLAGS_ARCH} STREQUAL x86_64)
19+
# this is the minimum architecture that supports 16 byte CAS, which is necessary to avoid a dependency to libatomic
20+
- list(APPEND result "-march=core2")
21+
+ list(APPEND result "-mcx16")
22+
endif()
23+
endif()
24+
25+
diff -Naur swift-orig/utils/build-presets.ini swift/utils/build-presets.ini
26+
--- swift-orig/utils/build-presets.ini 2021-01-11 09:24:03.000000000 -0600
27+
+++ swift/utils/build-presets.ini 2021-01-14 15:42:31.063141040 -0600
28+
@@ -771,7 +771,6 @@
29+
libicu
30+
libcxx
31+
32+
-build-ninja
33+
install-llvm
34+
install-swift
35+
install-lldb
36+
@@ -787,10 +786,6 @@
37+
build-swift-static-sdk-overlay
38+
build-swift-stdlib-unittest-extra
39+
40+
-# Executes the lit tests for the installable package that is created
41+
-# Assumes the swift-integration-tests repo is checked out
42+
-
43+
-test-installable-package
44+
45+
# Build the benchmarks against the toolchain.
46+
toolchain-benchmarks

0 commit comments

Comments
 (0)