diff --git a/Package.swift b/Package.swift index b13b685..da4aa61 100644 --- a/Package.swift +++ b/Package.swift @@ -24,6 +24,12 @@ let rdkafkaExclude = [ "./librdkafka/src/rdkafka_sasl_win32.c", "./librdkafka/src/rdwin32.h", "./librdkafka/src/win32_config.h", + // Remove dependency on cURL. Disabling `ENABLE_CURL` and `WITH_CURL` does + // not appear to prevent processing of the below files, so we have to exclude + // them explicitly. + "./librdkafka/src/rdkafka_sasl_oauthbearer.c", + "./librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c", + "./librdkafka/src/rdhttp.c", ] let package = Package( @@ -72,7 +78,6 @@ let package = Package( .define("_GNU_SOURCE", to: "1"), // Fix build error for Swift 5.9 onwards ], linkerSettings: [ - .linkedLibrary("curl"), .linkedLibrary("sasl2"), .linkedLibrary("z"), // zlib ] diff --git a/Sources/Crdkafka/custom/config/config.h b/Sources/Crdkafka/custom/config/config.h index a84565d..d571535 100644 --- a/Sources/Crdkafka/custom/config/config.h +++ b/Sources/Crdkafka/custom/config/config.h @@ -23,7 +23,7 @@ #define ENABLE_ZSTD 1 #define ENABLE_SSL 1 #define ENABLE_GSSAPI 1 -#define ENABLE_CURL 1 +#define ENABLE_CURL 0 #define ENABLE_DEVEL 0 #define ENABLE_VALGRIND 0 #define ENABLE_REFCNT_DEBUG 0 @@ -35,7 +35,6 @@ #define ENABLE_ZSTD 1 #define ENABLE_SSL 1 #define ENABLE_GSSAPI 1 -#define ENABLE_CURL 1 #define ENABLE_LZ4_EXT 1 #define WITH_STATIC_LINKING 1 #define MKL_APP_NAME "librdkafka" @@ -136,7 +135,7 @@ // libzstd #define WITH_ZSTD 1 // libcurl -#define WITH_CURL 1 +#define WITH_CURL 0 // WITH_HDRHISTOGRAM #define WITH_HDRHISTOGRAM 1 // WITH_SNAPPY @@ -146,9 +145,9 @@ // WITH_SASL_SCRAM #define WITH_SASL_SCRAM 1 // WITH_SASL_OAUTHBEARER -#define WITH_SASL_OAUTHBEARER 1 +#define WITH_SASL_OAUTHBEARER 0 // WITH_OAUTHBEARER_OIDC -#define WITH_OAUTHBEARER_OIDC 1 +#define WITH_OAUTHBEARER_OIDC 0 // regex #define HAVE_REGEX 1 // strndup diff --git a/Sources/Kafka/Configuration/KafkaConfiguration+Security.swift b/Sources/Kafka/Configuration/KafkaConfiguration+Security.swift index 0dd4466..83bcffc 100644 --- a/Sources/Kafka/Configuration/KafkaConfiguration+Security.swift +++ b/Sources/Kafka/Configuration/KafkaConfiguration+Security.swift @@ -309,7 +309,7 @@ extension KafkaConfiguration { } } - public struct OAuthBearerMethod: Sendable, Hashable { + struct OAuthBearerMethod: Sendable, Hashable { internal enum _OAuthBearerMethod: Sendable, Hashable { case `default`( configuration: String? @@ -337,7 +337,7 @@ extension KafkaConfiguration { /// For example: `principalClaimName=azp principal=admin scopeClaimName=roles scope=role1,role2 lifeSeconds=600`. /// In addition, SASL extensions can be communicated to the broker via `extension_NAME=value`. /// For example: `principal=admin extension_traceId=123` - public static func `default`(configuration: String? = nil) -> OAuthBearerMethod { + static func `default`(configuration: String? = nil) -> OAuthBearerMethod { OAuthBearerMethod(_internal: .default(configuration: configuration)) } @@ -359,7 +359,7 @@ extension KafkaConfiguration { /// - scope: The client uses this to specify the scope of the access request to the broker. /// - extensions: Allow additional information to be provided to the broker. /// Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea". - public static func oidc( + static func oidc( configuration: String? = nil, clientID: String, clientSecret: String, @@ -419,7 +419,8 @@ extension KafkaConfiguration { } /// Use the OAUTHBEARER mechanism. - public static func oAuthBearer(method: OAuthBearerMethod) -> SASLMechanism { + // This is currently disabled since it requires a curl dependency otherwise. + static func oAuthBearer(method: OAuthBearerMethod) -> SASLMechanism { SASLMechanism( _internal: .oAuthBearer(method: method) )