diff --git a/.github/workflows/s2n-prelude-changes.yml b/.github/workflows/s2n-prelude-changes.yml new file mode 100644 index 00000000..073e5bb1 --- /dev/null +++ b/.github/workflows/s2n-prelude-changes.yml @@ -0,0 +1,32 @@ +# Detect changes to s2n_prelude.h to update our `Package.swift` and stay in sync with it. +# See: https://github.com/awslabs/aws-crt-swift/pull/299 for updating the Package.swift. + +name: s2n_prelude.h Change Detector + +on: [push] + +jobs: + check-for-changes: + + runs-on: ubuntu-24.04 # latest + + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + with: + submodules: true + + - name: Check s2n_prelude.h + run: | + TMPFILE=$(mktemp) + echo "116f1525acbc94c91b0ee2ea2af9fdef aws-common-runtime/s2n/utils/s2n_prelude.h" > $TMPFILE + md5sum --check $TMPFILE + + # No further steps if successful + + - name: Echo fail + if: failure() + run: | + echo "The aws-crt-swift has a hack to manually define macros which are defined in s2n_prelude.h in Package.Swift. + This check will fail whenever s2n_prelude.h is updated by the S2N team. You should make sure that Package.Swift is updated accordingly + with the s2n_prelude.h changes and then run `md5sum aws-common-runtime/s2n/utils/s2n_prelude.h` and update the value above." diff --git a/Package.swift b/Package.swift index 1aac45ce..98535e61 100644 --- a/Package.swift +++ b/Package.swift @@ -100,8 +100,17 @@ packageTargets.append(.target( publicHeadersPath: "api", cSettings: [ .headerSearchPath("./"), - .define("POSIX_C_SOURCE=200809L"), - .define("S2N_NO_PQ") + .define("S2N_NO_PQ"), + // This is a hack to get around the fact that S2N uses the compiler option `-include` + // to include `s2n_prelude.h` in all .c files. Since SwiftPM doesn't support compiler flags, + // we manually define the macros from `s2n_prelude.h`. When SwiftPM supports compiler flags + // or building packages using CMake, this hack should be removed. + // We are not defining `S2N_API` because we don't need to expose any symbols from S2N in crt-swift. + .define("_S2N_PRELUDE_INCLUDED"), + .define("S2N_BUILD_RELEASE"), + .define("_FORTIFY_SOURCE", to: "2"), + .define("POSIX_C_SOURCE", to: "200809L"), + ] )) #endif @@ -146,9 +155,6 @@ var awsCChecksumsExcludes = [ "cmake", "tests"] -// swift never uses Microsoft Visual C++ compiler -awsCChecksumsExcludes.append("source/intel/visualc") - // Hardware accelerated checksums are disabled because SwiftPM doesn't like the necessary compiler flags. // We can add it once SwiftPM has the necessary support for CPU flags or builds C libraries // using CMake. diff --git a/aws-common-runtime/aws-c-auth b/aws-common-runtime/aws-c-auth index 48d647bf..3982bd75 160000 --- a/aws-common-runtime/aws-c-auth +++ b/aws-common-runtime/aws-c-auth @@ -1 +1 @@ -Subproject commit 48d647bf43f8872e4dc5ec6343b0c5974195fbdd +Subproject commit 3982bd75fea74efd8f9b462b27fedd4599db4f53 diff --git a/aws-common-runtime/aws-c-cal b/aws-common-runtime/aws-c-cal index 2cb1d2ea..656762ae 160000 --- a/aws-common-runtime/aws-c-cal +++ b/aws-common-runtime/aws-c-cal @@ -1 +1 @@ -Subproject commit 2cb1d2eac925e2dbc45025eb89af82bd790c23a0 +Subproject commit 656762aefbee2bc8f509cb23cd107abff20a72bb diff --git a/aws-common-runtime/aws-c-common b/aws-common-runtime/aws-c-common index faa6c0f0..63187b97 160000 --- a/aws-common-runtime/aws-c-common +++ b/aws-common-runtime/aws-c-common @@ -1 +1 @@ -Subproject commit faa6c0f00802fc861e7252404f65fb1e0617ca8e +Subproject commit 63187b976a482309e23296c5f967fc19c4131746 diff --git a/aws-common-runtime/aws-c-compression b/aws-common-runtime/aws-c-compression index f36d0167..c6c1191e 160000 --- a/aws-common-runtime/aws-c-compression +++ b/aws-common-runtime/aws-c-compression @@ -1 +1 @@ -Subproject commit f36d01672d61e49d96a777870d456f66fa391cd4 +Subproject commit c6c1191e525e5aa6ead9e1afc392e35d3b50331e diff --git a/aws-common-runtime/aws-c-event-stream b/aws-common-runtime/aws-c-event-stream index 1b3825fc..d2dcc934 160000 --- a/aws-common-runtime/aws-c-event-stream +++ b/aws-common-runtime/aws-c-event-stream @@ -1 +1 @@ -Subproject commit 1b3825fc9cae2e9c7ed7479ee5d354d52ebdf7a0 +Subproject commit d2dcc9344dae24de320866045d85166d8a91a0d1 diff --git a/aws-common-runtime/aws-c-http b/aws-common-runtime/aws-c-http index 6068653e..fc3eded2 160000 --- a/aws-common-runtime/aws-c-http +++ b/aws-common-runtime/aws-c-http @@ -1 +1 @@ -Subproject commit 6068653e1d582bd8e7d1c9f81f86beaf10444e3d +Subproject commit fc3eded2465c37d07fd9cc15e9b5b011224c9c9a diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index e3637404..fcb38c80 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit e36374047beadc72a0eb6df14ce3cbc822a789a3 +Subproject commit fcb38c804364dd627c335da752a99a125a88f6e9 diff --git a/aws-common-runtime/aws-c-sdkutils b/aws-common-runtime/aws-c-sdkutils index 4658412a..ce09f797 160000 --- a/aws-common-runtime/aws-c-sdkutils +++ b/aws-common-runtime/aws-c-sdkutils @@ -1 +1 @@ -Subproject commit 4658412a61ad5749db92a8d1e0717cb5e76ada1c +Subproject commit ce09f79768653dbdc810fc14cad8685dd90acba1 diff --git a/aws-common-runtime/aws-checksums b/aws-common-runtime/aws-checksums index ce04ab00..3e4101b9 160000 --- a/aws-common-runtime/aws-checksums +++ b/aws-common-runtime/aws-checksums @@ -1 +1 @@ -Subproject commit ce04ab00b3ecc41912f478bfedca39f8e1919d6b +Subproject commit 3e4101b9f85a2c090774d27ae2131fca1082f522 diff --git a/aws-common-runtime/config/aws/common/config.h b/aws-common-runtime/config/aws/common/config.h index 7d00728c..df0e2d39 100644 --- a/aws-common-runtime/config/aws/common/config.h +++ b/aws-common-runtime/config/aws/common/config.h @@ -5,6 +5,7 @@ #ifndef AWS_COMMON_CONFIG_H #define AWS_COMMON_CONFIG_H + /* * This header exposes compiler feature test results determined during cmake * configure time to inline function implementations. The macros defined here @@ -13,7 +14,7 @@ */ #ifdef __APPLE__ /* This is a trick to skip OpenSSL header on Apple platforms since Swift Package Manager is not smart enough to exclude - * some headers. + * some headers. */ # define AWS_C_CAL_OPENSSLCRYPTO_COMMON_H #endif diff --git a/aws-common-runtime/s2n b/aws-common-runtime/s2n index ffe0bf42..493b7716 160000 --- a/aws-common-runtime/s2n +++ b/aws-common-runtime/s2n @@ -1 +1 @@ -Subproject commit ffe0bf42da8f139eff8fd2237f47fbde40b478fb +Subproject commit 493b77167dc367c394de23cfe78a029298e2a254