Skip to content

Commit

Permalink
fix: move s2n stuff in same package manifest (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
kneekey23 authored Jul 30, 2021
1 parent ee3f1c0 commit 231269a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
path = aws-common-runtime/aws-c-io
url = https://github.com/awslabs/aws-c-io.git
[submodule "aws-common-runtime/s2n"]
path = S2N/s2n
path = aws-common-runtime/s2n
url = https://github.com/aws/s2n-tls.git
[submodule "aws-common-runtime/aws-c-compression"]
path = aws-common-runtime/aws-c-compression
Expand Down
86 changes: 57 additions & 29 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,63 @@
// swift-tools-version:5.4
import PackageDescription

var packageDependencies: [Package.Dependency] = []
var calDependencies: [Target.Dependency] = ["AwsCCommon"]
var ioDependencies: [Target.Dependency] = ["AwsCCommon", "AwsCCal"]

#if os(Linux)
packageDependencies.append(.package(name: "S2N", path: "./S2N"))

ioDependencies.append(.product(name: "S2N", package: "S2N"))
calDependencies.append(.product(name: "LibCrypto", package: "S2N"))
#endif
let excludesFromAll = ["tests", "cmake", "CONTRIBUTING.md",
"LICENSE", "format-check.sh", "NOTICE", "builder.json",
"CMakeLists.txt", "README.md"]
var packageTargets: [Target] = []

var package = Package(name: "AwsCrt",
platforms: [.iOS(.v11), .macOS(.v10_14)],
products: [
.library(name: "AwsCommonRuntimeKit", targets: ["AwsCommonRuntimeKit"]),
.executable(name: "Elasticurl", targets: ["Elasticurl"])
],
dependencies: packageDependencies
]
)

let excludesFromAll = ["bin", "tests", "cmake", "codebuild", "CONTRIBUTING.md",
"LICENSE", "format-check.sh", "NOTICE", "builder.json",
"sanitizer-blacklist.txt", "CMakeLists.txt", "README.md",
"CODE_OF_CONDUCT.md", "build-deps.sh"]
var calDependencies: [Target.Dependency] = ["AwsCCommon"]
var ioDependencies: [Target.Dependency] = ["AwsCCommon", "AwsCCal"]

#if os(Linux)
packageTargets.append( .systemLibrary(
name: "LibCrypto",
pkgConfig: "libcrypto",
providers: [
.apt(["openssl libssl-dev"]),
.yum(["openssl openssl-devel"])
]
))
// add pq-crypto back after adding in platform and chipset detection
let s2nExcludes = excludesFromAll + ["bin", "codebuild", "coverage", "docker-images",
"docs", "lib", "pq-crypto/bike_r1", "pq-crypto/bike_r2",
"pq-crypto/bike_r3", "pq-crypto/kyber_90s_r2", "pq-crypto/kyber_r3",
"pq-crypto/kyber_r2", "pq-crypto/sike_r1", "pq-crypto/sike_r2",
"pq-crypto/README.md", "pq-crypto/Makefile", "pq-crypto/s2n_pq_asm.mk",
"libcrypto-build", "scram",
"s2n.mk", "Makefile", "stuffer/Makefile", "crypto/Makefile",
"tls/Makefile", "utils/Makefile", "error/Makefile",
"extensions/Makefile", "tls/extensions/Makefile",
"codecov.yml", "scripts/", "codebuild", "format-check.sh", "sanitizer-blacklist.txt",
"CODE_OF_CONDUCT.md", "build-deps.sh"]
packageTargets.append(.target(
name: "S2N",
dependencies: ["LibCrypto"],
path: "aws-common-runtime/s2n",
exclude: s2nExcludes,
publicHeadersPath: "api",
cSettings: [
.headerSearchPath("./"),
.define("POSIX_C_SOURCE=200809L"),
.define("S2N_NO_PQ")
]
))
ioDependencies.append("S2N")
calDependencies.append("LibCrypto")
#endif

// aws-c-common config
var awsCCommonPlatformExcludes = ["source/windows", "source/android",
"AWSCRTAndroidTestRunner", "docker-images", "verification",
"include/aws/common/"]
awsCCommonPlatformExcludes.append(contentsOf: excludesFromAll)
"include/aws/common/", "sanitizer-blacklist.txt"] + excludesFromAll

#if arch(i386) || arch(x86_64)
awsCCommonPlatformExcludes.append("source/arch/arm")
Expand All @@ -52,8 +79,7 @@ awsCCommonPlatformExcludes.append("source/arch/intel/asm")
awsCCommonPlatformExcludes.append("source/arch/arm/asm")
#endif

var awsCIoPlatformExcludes = ["docs"]
awsCIoPlatformExcludes.append(contentsOf: excludesFromAll)
var awsCIoPlatformExcludes = ["docs", "CODE_OF_CONDUCT.md"] + excludesFromAll

#if os(macOS)
awsCIoPlatformExcludes.append("source/windows")
Expand All @@ -70,8 +96,7 @@ awsCIoPlatformExcludes.append("source/bsd")
awsCIoPlatformExcludes.append("source/darwin")
#endif

var awsCCalPlatformExcludes = ["include/aws/cal/private"]
awsCCalPlatformExcludes.append(contentsOf: excludesFromAll)
var awsCCalPlatformExcludes = ["bin", "include/aws/cal/private", "CODE_OF_CONDUCT.md", "sanitizer-blacklist.txt"] + excludesFromAll

#if os(macOS)
awsCCalPlatformExcludes.append("source/windows")
Expand All @@ -84,16 +109,17 @@ awsCCalPlatformExcludes.append("source/windows")
awsCCalPlatformExcludes.append("source/darwin")
#endif

var awsCCompressionPlatformExcludes = ["source/huffman_generator/"]
awsCCompressionPlatformExcludes.append(contentsOf: excludesFromAll)
var awsCHttpPlatformExcludes = ["integration-testing", "continuous-delivery", "include/aws/http/private"]
awsCHttpPlatformExcludes.append(contentsOf: excludesFromAll)
let awsCAuthPlatformExcludes = excludesFromAll
let awsCMqttPlatformExcludes = excludesFromAll
var awsCCompressionPlatformExcludes = ["source/huffman_generator/", "CODE_OF_CONDUCT.md",
"codebuild"] + excludesFromAll

var awsCHttpPlatformExcludes = ["bin", "integration-testing", "include/aws/http/private",
"CODE_OF_CONDUCT.md", "sanitizer-blacklist.txt"] + excludesFromAll
let awsCAuthPlatformExcludes = ["CODE_OF_CONDUCT.md"] + excludesFromAll
let awsCMqttPlatformExcludes = ["bin", "CODE_OF_CONDUCT.md"] + excludesFromAll

let cFlags = ["-g", "-fno-omit-frame-pointer"]

package.targets = ( [
packageTargets.append(contentsOf: [
.target(
name: "AwsCPlatformConfig",
path: "aws-common-runtime/config",
Expand Down Expand Up @@ -194,3 +220,5 @@ package.targets = ( [
]
)
] )

package.targets = packageTargets
51 changes: 0 additions & 51 deletions S2N/Package.swift

This file was deleted.

File renamed without changes.
File renamed without changes.

0 comments on commit 231269a

Please sign in to comment.