diff --git a/Package.swift b/Package.swift index 2a1d99e8..8d463327 100644 --- a/Package.swift +++ b/Package.swift @@ -46,7 +46,8 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-nio.git", from: "2.55.0"), - .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0-beta.1"), + .package(url: "https://github.com/apple/swift-nio-ssl", from: "2.25.0"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.1.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), // The zstd Swift package produces warnings that we cannot resolve: // https://github.com/facebook/zstd/issues/3328 @@ -56,7 +57,7 @@ let package = Package( .target( name: "Crdkafka", dependencies: [ - "COpenSSL", + .product(name: "NIOSSL", package: "swift-nio-ssl"), .product(name: "libzstd", package: "zstd"), ], exclude: rdkafkaExclude, @@ -65,7 +66,9 @@ let package = Package( cSettings: [ // dummy folder, because config.h is included as "../config.h" in librdkafka .headerSearchPath("./custom/config/dummy"), + .headerSearchPath("./custom/include"), .headerSearchPath("./librdkafka/src"), + .define("_GNU_SOURCE", to: "1"), // Fix build error for Swift 5.9 onwards ], linkerSettings: [ .linkedLibrary("curl"), @@ -88,14 +91,6 @@ let package = Package( "Kafka", ] ), - .systemLibrary( - name: "COpenSSL", - pkgConfig: "openssl", - providers: [ - .brew(["libressl"]), - .apt(["libssl-dev"]), - ] - ), .testTarget( name: "KafkaTests", dependencies: ["Kafka"] diff --git a/Sources/COpenSSL/module.modulemap b/Sources/COpenSSL/module.modulemap deleted file mode 100644 index e69de29b..00000000 diff --git a/Sources/Crdkafka/custom/include/openssl/err.h b/Sources/Crdkafka/custom/include/openssl/err.h new file mode 100644 index 00000000..61a232a5 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/err.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_err.h" diff --git a/Sources/Crdkafka/custom/include/openssl/evp.h b/Sources/Crdkafka/custom/include/openssl/evp.h new file mode 100644 index 00000000..54218188 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/evp.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_evp.h" diff --git a/Sources/Crdkafka/custom/include/openssl/hmac.h b/Sources/Crdkafka/custom/include/openssl/hmac.h new file mode 100644 index 00000000..60a44389 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/hmac.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_hmac.h" diff --git a/Sources/Crdkafka/custom/include/openssl/pkcs12.h b/Sources/Crdkafka/custom/include/openssl/pkcs12.h new file mode 100644 index 00000000..5d13efe2 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/pkcs12.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_pkcs12.h" diff --git a/Sources/Crdkafka/custom/include/openssl/sha.h b/Sources/Crdkafka/custom/include/openssl/sha.h new file mode 100644 index 00000000..e58bcc98 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/sha.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_sha.h" diff --git a/Sources/Crdkafka/custom/include/openssl/ssl.h b/Sources/Crdkafka/custom/include/openssl/ssl.h new file mode 100644 index 00000000..634d88d4 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/ssl.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_ssl.h" diff --git a/Sources/Crdkafka/custom/include/openssl/x509.h b/Sources/Crdkafka/custom/include/openssl/x509.h new file mode 100644 index 00000000..3db443e9 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/x509.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_x509.h" diff --git a/Sources/Crdkafka/custom/include/openssl/x509_vfy.h b/Sources/Crdkafka/custom/include/openssl/x509_vfy.h new file mode 100644 index 00000000..aba8dcb1 --- /dev/null +++ b/Sources/Crdkafka/custom/include/openssl/x509_vfy.h @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-kafka-client open source project +// +// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +#include "CNIOBoringSSL_x509_vfy.h" diff --git a/docker/Dockerfile b/docker/Dockerfile index f1d19afd..31ae9a21 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,6 @@ ENV LANGUAGE en_US.UTF-8 # Dependencies RUN apt-get update RUN apt-get install libsasl2-dev -y -RUN apt-get install libssl-dev -y # tools RUN mkdir -p $HOME/.tools