-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg-config: add initial pkg-config files #8691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your patch! Distros will be really happy :)
I've left a few suggestions that I think should be addressed before merging this. I'm not a project maintainer, I'm just a guy that played too much with CMake that happens to maintain the mbedtls Debian package.
Perfect thanks, i've never touched CMake and I know enough about pkg-config to maintain my projects at tpm2-software and to injure others. |
c916a8e
to
c2d16ce
Compare
@billatarm is this still draft - or ready for review? thanks |
Yes thanks |
c2d16ce
to
db03aac
Compare
4835684
to
c7a65de
Compare
@jtojnar could you comment if we could relicense this Cmake snippet under the dual Apache 2.0/GPL license scheme? |
Sure, feel free to relicense it. The intent is that anyone can use it in any software project. |
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
b1a8e34
to
a4da79f
Compare
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
a4da79f
to
c3f8c27
Compare
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Support querying pkg-config for mbedtls directories. When building against mbedtls, use the following search criteria to locate the mbedtls dependency: 1. Env Variables 2. pkg-config 3. vendor directory This will allow binary packages from distributions to work without modification and not require a vendored mbedtls package. The problem with vendored packages is upsates, and since mbedtls is a critical cryptographic suite, it's important that the distributions can quickly update a single mbedtls package that everyone links to. Related to: - Mbed-TLS/mbedtls#8691 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
@billatarm We have some CI failure on this PR. Would you be able to check them out please? |
The problem seems to be the useages of I'll just have to define the variables for now and use those. |
Add three package config files for mbedtls, mbedcrypto and mbedx509. Also update various project variables so the generated PC files have the required data needed without hardcoding it everywhere. This will help distros package the project following existing conventsions between a normal and -devel package that includes the headers and .pc files for pkg-config aware consumers. Fixes: Mbed-TLS#228 Signed-off-by: Bill Roberts <bill.roberts@arm.com>
c3f8c27
to
a4d17b3
Compare
Ahh it's documented as why the README and CIs are disparate: Lines 19 to 21 in 32c28ce
|
@billatarm Apologies for the delay on this. I was on leave last week. Thanks for addressing the CI failures. I have kicked off a new CI run just now so we should know if it was successful in a few hours. |
Fix syntax errors in Changelog (and tidy up punctuation) Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
I tweaked the changelog to fix trivial syntax errors, as I think this is the only thing blocking CI - hope that's OK @billatarm |
Thanks, appreciate it, yeah |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this all looks sensible. I have been playing around with it and it seems to work as I would expect, and the CMake stuff all looks sensible. Thanks @billatarm. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The version field is empty in all pkgconfig files. Is that expected? |
No and I can reproduce, let me see whats up |
Ok, so in the final version of the patch when I removed the HOMEPAGE_URL and DESCRIPTION, and let that go back to original form, it broke, I dunno why, and github doesn't show my the version delats AFAIK. But this patch fixes it: diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5585c78fa..3d6f14f4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,10 +33,17 @@ cmake_policy(SET CMP0011 NEW)
# is deprecated and will be removed in future versions.
cmake_policy(SET CMP0012 NEW)
+
if(TEST_CPP)
- project("Mbed TLS" LANGUAGES C CXX)
+ project("Mbed TLS"
+ LANGUAGES C CXX
+ VERSION 3.5.2
+ )
else()
- project("Mbed TLS" LANGUAGES C)
+ project("Mbed TLS"
+ LANGUAGES C
+ VERSION 3.5.2
+ )
endif()
include(GNUInstallDirs) I'll submit a PR |
Follow up patch to fix empty version field: #8850 |
@@ -0,0 +1,4 @@ | |||
Features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're announcing a new feature, but this isn't tested. Are you planning a follow-up with a test (either expanding an existing cmake-related component or a new component in tests/scripts/all.sh
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're announcing a new feature, but this isn't tested. Are you planning a follow-up with a test (either expanding an existing cmake-related component or a new component in
tests/scripts/all.sh
)?
Yeah the goal is to add this to automated tests doing a make install and then running pkg-config
, I have to look at how the test suite is constructed to see where the best place is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See PR for tests: #8988
Description: @PKGCONFIG_PROJECT_DESCRIPTION@ | ||
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@ | ||
Version: @PROJECT_VERSION@ | ||
Requires.private: mbedcrypto mbedx509 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late feedback: shouldn't this be Requires
instead of Requires.private
? The CMake code, for instance, has a PUBLIC
dependency on mbedx509
.
mbedtls/library/CMakeLists.txt
Lines 314 to 320 in 30978ec
add_library(${mbedx509_target} SHARED ${src_x509}) | |
set_target_properties(${mbedx509_target} PROPERTIES VERSION 3.6.0 SOVERSION 7) | |
target_link_libraries(${mbedx509_target} PUBLIC ${libs} ${mbedcrypto_target}) | |
add_library(${mbedtls_target} SHARED ${src_tls}) | |
set_target_properties(${mbedtls_target} PROPERTIES VERSION 3.6.0 SOVERSION 21) | |
target_link_libraries(${mbedtls_target} PUBLIC ${libs} ${mbedx509_target}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That depends on the following question. If a program links with mbedtls only dynamically, does it need to link with mbedcrypto and mbedx509 directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires.private is correct here. Those libraries are linked to the shared object not the requestor.
I think this explains it better than me:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That depends on the following question. If a program links with mbedtls only dynamically, does it need to link with mbedcrypto and mbedx509 directly?
I was under the impression that this was the case, but no, Requires.private
seems appropriate. mbedtls/ssl.h
includes mbedtls/x509_crt.h
, which is part of mbedx509
, so the user ends up needing the appropriate compiler flags for mbedx509
too, but unless it uses x509 functions it does not need its linking flags. Due to multiple reasons, pkg-config's Requires.private
propagates the Cflags
when doing shared builds, but not the Libs
, so this is exactly what we need.
In short: the pkg-config files are ok, but mebdtls
' PUBLIC
dependency on mbedx509
in CMake is probably wrong (or at least not precise enough).
Description
Add three package config files for mbedtls, mbedcrypto and mbedx509. Also update various project variables so the generated PC files have the required data needed without hardcoding it everywhere.
This will help distros package the project following existing conventsions between a normal and -devel package that includes the headers and .pc files for pkg-config aware consumers.
Fixes: #228
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")