Skip to content

Rearranged the Fedora folder #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions platforms/Linux/Fedora/34/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM fedora:34
LABEL PURPOSE="This image is configured to build Swift for the version of Fedora listed above"

WORKDIR /root

RUN mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
ADD swift-lang.spec /root/rpmbuild/SPECS/swift-lang.spec
ADD *.patch /root/rpmbuild/SOURCES/

ADD build_swift_rpm.sh /root/build_swift_rpm.sh
RUN chmod +x /root/build_swift_rpm.sh

RUN dnf -y update

# Required for the "rpmbuild" command
RUN dnf install -y fedora-packager fedora-review

# Install all the dependencies needed to build Swift from the
# spec file itself
RUN dnf builddep -y /root/rpmbuild/SPECS/swift-lang.spec
# And now get the sources for Swift as defined in the spec file
RUN spectool -g -R /root/rpmbuild/SPECS/swift-lang.spec

CMD ["/root/build_swift_rpm.sh"]
29 changes: 29 additions & 0 deletions platforms/Linux/Fedora/35/build_swift_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# This script assumes it's running in a container as root
# and that /out is mounted to a directory on the local
# filesystem so the build output and artifacts can be
# copied out and used

OUTDIR=/out
if [[ ! -d "$OUTDIR" ]]
then
echo "$OUTDIR does not exist, so no place to copy the artifacts!"
exit 1
fi

# Always make sure we're up to date
dnf -y update

# Now we proceed to build Swift. If this is successful, we
# will have two files: a SRPM file which contains the source files
# as well as a regular RPM file that can be installed via `dnf' or `yum'
pushd $HOME/rpmbuild/SPECS
rpmbuild -ba ./swift-lang.spec 2>&1 | tee $HOME/build-output.txt
popd

# Include the build log which can be used to determine what went
# wrong if there are no artifacts
cp $HOME/build-output.txt $OUTDIR
cp $HOME/rpmbuild/SRPMS/* $OUTDIR
cp $HOME/rpmbuild/RPMS/`uname -i`/* $OUTDIR
81 changes: 81 additions & 0 deletions platforms/Linux/Fedora/35/nocyclades.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2021-05-28 10:17:04.000000000 -0500
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2021-05-31 08:19:34.794058378 -0500
@@ -370,15 +370,6 @@

#if SANITIZER_GLIBC
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
- _(CYGETDEFTHRESH, WRITE, sizeof(int));
- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
- _(CYGETTHRESH, WRITE, sizeof(int));
- _(CYGETTIMEOUT, WRITE, sizeof(int));
- _(CYSETDEFTHRESH, NONE, 0);
- _(CYSETDEFTIMEOUT, NONE, 0);
- _(CYSETTHRESH, NONE, 0);
- _(CYSETTIMEOUT, NONE, 0);
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
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
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2021-05-28 10:17:04.000000000 -0500
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2021-05-31 12:30:07.414710413 -0500
@@ -143,7 +143,6 @@
# include <sys/procfs.h>
#endif
#include <sys/user.h>
-#include <linux/cyclades.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
@@ -459,7 +458,6 @@

#if SANITIZER_GLIBC
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
#if EV_VERSION > (0x010000)
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
#else
@@ -823,15 +821,6 @@
#endif // SANITIZER_LINUX

#if SANITIZER_LINUX && !SANITIZER_ANDROID
- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
- unsigned IOCTL_CYGETMON = CYGETMON;
- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
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
--- llvm-project-orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2021-05-28 10:17:04.000000000 -0500
+++ llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2021-05-31 12:30:40.568693281 -0500
@@ -983,7 +983,6 @@

#if SANITIZER_LINUX && !SANITIZER_ANDROID
extern unsigned struct_ax25_parms_struct_sz;
-extern unsigned struct_cyclades_monitor_sz;
extern unsigned struct_input_keymap_entry_sz;
extern unsigned struct_ipx_config_data_sz;
extern unsigned struct_kbdiacrs_sz;
@@ -1328,15 +1327,6 @@
#endif // SANITIZER_LINUX

#if SANITIZER_LINUX && !SANITIZER_ANDROID
-extern unsigned IOCTL_CYGETDEFTHRESH;
-extern unsigned IOCTL_CYGETDEFTIMEOUT;
-extern unsigned IOCTL_CYGETMON;
-extern unsigned IOCTL_CYGETTHRESH;
-extern unsigned IOCTL_CYGETTIMEOUT;
-extern unsigned IOCTL_CYSETDEFTHRESH;
-extern unsigned IOCTL_CYSETDEFTIMEOUT;
-extern unsigned IOCTL_CYSETTHRESH;
-extern unsigned IOCTL_CYSETTIMEOUT;
extern unsigned IOCTL_EQL_EMANCIPATE;
extern unsigned IOCTL_EQL_ENSLAVE;
extern unsigned IOCTL_EQL_GETMASTRCFG;
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From 14983644da3b8bbb32aa2823602e4161bf3e2ec9 Mon Sep 17 00:00:00 2001
From: Dadoum <[email protected]>
Date: Tue, 4 May 2021 01:06:34 +0200
Subject: [PATCH] [PkgConfig] Cache PkgConfig and avoid reparsing multiple time
the same file.

---
swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift | 31 ++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift b/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
index 45d80995..558c81e7 100644
--- a/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
+++ b/swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift
@@ -115,6 +115,8 @@ public class LoadingContext {

/// Information on an individual `pkg-config` supported package.
public struct PkgConfig {
+ public static var pkgConfigCache: [String: PkgConfig] = [String: PkgConfig]()
+
/// The name of the package.
public let name: String

@@ -179,18 +181,23 @@ public struct PkgConfig {
continue
}

- // FIXME: This is wasteful, we should be caching the PkgConfig result.
- let pkg = try PkgConfig(
- name: dep,
- additionalSearchPaths: additionalSearchPaths,
- diagnostics: diagnostics,
- fileSystem: fileSystem,
- brewPrefix: brewPrefix,
- loadingContext: loadingContext
- )
-
- cFlags += pkg.cFlags
- libs += pkg.libs
+ if !PkgConfig.pkgConfigCache.keys.contains(dep) {
+ PkgConfig.pkgConfigCache[dep] = try PkgConfig(
+ name: dep,
+ additionalSearchPaths: additionalSearchPaths,
+ diagnostics: diagnostics,
+ fileSystem: fileSystem,
+ brewPrefix: brewPrefix,
+ loadingContext: loadingContext
+ )
+ }
+
+ guard let cachedPkg = PkgConfig.pkgConfigCache[dep] else {
+ fatalError("Cannot retrieve cached pkgConfig result")
+ }
+
+ cFlags += cachedPkg.cFlags
+ libs += cachedPkg.libs
}

return (cFlags: cFlags, libs: libs)
46 changes: 46 additions & 0 deletions platforms/Linux/Fedora/35/swift-for-fedora.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff -Naur swift-orig/cmake/modules/AddSwift.cmake swift/cmake/modules/AddSwift.cmake
--- swift-orig/cmake/modules/AddSwift.cmake 2021-01-11 09:24:03.000000000 -0600
+++ swift/cmake/modules/AddSwift.cmake 2021-01-14 16:07:26.118061686 -0600
@@ -288,7 +288,7 @@
if(SWIFT_HOST_VARIANT_ARCH STREQUAL x86_64)
# this is the minimum architecture that supports 16 byte CAS, which is
# necessary to avoid a dependency to libatomic
- target_compile_options(${target} PRIVATE -march=core2)
+ target_compile_options(${target} PRIVATE -mcx16)
endif()
endif()

diff -Naur swift-orig/stdlib/cmake/modules/AddSwiftStdlib.cmake swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
--- swift-orig/stdlib/cmake/modules/AddSwiftStdlib.cmake 2021-01-11 09:24:03.000000000 -0600
+++ swift/stdlib/cmake/modules/AddSwiftStdlib.cmake 2021-01-14 16:06:49.905752127 -0600
@@ -306,7 +306,7 @@
if("${CFLAGS_SDK}" STREQUAL "LINUX")
if(${CFLAGS_ARCH} STREQUAL x86_64)
# this is the minimum architecture that supports 16 byte CAS, which is necessary to avoid a dependency to libatomic
- list(APPEND result "-march=core2")
+ list(APPEND result "-mcx16")
endif()
endif()

diff -Naur swift-orig/utils/build-presets.ini swift/utils/build-presets.ini
--- swift-orig/utils/build-presets.ini 2021-01-11 09:24:03.000000000 -0600
+++ swift/utils/build-presets.ini 2021-01-14 15:42:31.063141040 -0600
@@ -771,7 +771,6 @@
libicu
libcxx

-build-ninja
install-llvm
install-swift
install-lldb
@@ -787,10 +786,6 @@
build-swift-static-sdk-overlay
build-swift-stdlib-unittest-extra

-# Executes the lit tests for the installable package that is created
-# Assumes the swift-integration-tests repo is checked out
-
-test-installable-package

# Build the benchmarks against the toolchain.
toolchain-benchmarks
Loading