aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-05-30 20:53:49 +0000
committerGerrit Code Review <gerrit@lix-systems>2024-05-30 20:53:49 +0000
commit260db1ea64a8e217d09a167fe36e15e80e51937d (patch)
tree459189f03fded7373782a4943a68f7be00b1074b
parentc161687b5fa6e7604e99ee5df2e73388952baafb (diff)
parent647579367827d2db54ad773ecb30ebb1782fa578 (diff)
Merge "build: fix static aws-cpp-sdk" into main
-rw-r--r--meson.build4
-rw-r--r--package.nix3
-rw-r--r--subprojects/aws_sdk/meson.build15
3 files changed, 19 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 16cf80cf4..9db764f00 100644
--- a/meson.build
+++ b/meson.build
@@ -203,7 +203,7 @@ openssl = dependency('libcrypto', 'openssl', required : true)
deps += openssl
aws_sdk = dependency('aws-cpp-sdk-core', required : false)
-aws_sdk_transfer = dependency('aws-cpp-sdk-transfer', required : aws_sdk.found())
+aws_sdk_transfer = dependency('aws-cpp-sdk-transfer', required : aws_sdk.found(), fallback : ['aws_sdk', 'aws_cpp_sdk_transfer_dep'])
if aws_sdk.found()
# The AWS pkg-config adds -std=c++11.
# https://github.com/aws/aws-sdk-cpp/issues/2673
@@ -230,7 +230,7 @@ if aws_sdk.found()
)
endif
-aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
+aws_s3 = dependency('aws-cpp-sdk-s3', required : aws_sdk.found(), fallback : ['aws_sdk', 'aws_cpp_sdk_s3_dep'])
if aws_s3.found()
# The AWS pkg-config adds -std=c++11.
# https://github.com/aws/aws-sdk-cpp/issues/2673
diff --git a/package.nix b/package.nix
index cc5902a91..6251b28ba 100644
--- a/package.nix
+++ b/package.nix
@@ -144,6 +144,7 @@ let
./meson.options
./meson
./scripts/meson.build
+ ./subprojects
]);
functionalTestFiles = fileset.unions [
@@ -259,7 +260,7 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional internalApiDocs rapidcheck
++ lib.optional hostPlatform.isx86_64 libcpuid
# There have been issues building these dependencies
- ++ lib.optional (hostPlatform == buildPlatform) aws-sdk-cpp-nix
+ ++ lib.optional (hostPlatform.canExecute buildPlatform) aws-sdk-cpp-nix
++ lib.optionals (finalAttrs.dontBuild) maybePropagatedInputs;
checkInputs = [
diff --git a/subprojects/aws_sdk/meson.build b/subprojects/aws_sdk/meson.build
new file mode 100644
index 000000000..8685f8f41
--- /dev/null
+++ b/subprojects/aws_sdk/meson.build
@@ -0,0 +1,15 @@
+project('aws-sdk', 'cpp')
+
+# dependency() uses Meson's internal logic and generally relies on pkg-config or CMake,
+# but Meson can also use the project's compiler to find a library in the compiler's search
+# path. Not in the dependency() function, though. You have to use compiler.find_library(),
+# and Meson doesn't have a way to tell dependency() to simply fallback to find_library().
+# It *does* however allow dependency() to fallback to a variable defined in a subproject,
+# Hence: this file.
+
+# For some reason, these specific components of the AWS C++ SDK aren't found by CMake when
+# compiling statically, and `pkgsStatic.aws-sdk-cpp` doesn't even have a pkg-config at all.
+
+cxx = meson.get_compiler('cpp')
+aws_cpp_sdk_transfer_dep = cxx.find_library('aws-cpp-sdk-transfer')
+aws_cpp_sdk_s3_dep = cxx.find_library('aws-cpp-sdk-s3')