Use GNUInstallDirs to set the path for headers installation #545

Open
opened 2025-10-23 08:41:12 -05:00 by Begasus · 4 comments
Begasus commented 2025-10-23 08:41:12 -05:00 (Migrated from github.com)

Suggested enhancement

At the moment "include" directory is hardcoded, using CMAKE_INSTALL_INCLUDEDIR used the standard as done in GNUInstallDirs.

Justification

TF-PSA-Crypto needs this because

Haiku doesn't use $prefix/include, but rather $prefix/develop/headers which is covered with the above.

Atm I have a patchset here that works, but I'm unsure to which branch this would go as it would be required for mbedtls.

Current patchset:

From 1a358d5d983abeed012c8f6f3f43a7a7a6ab9f12 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Thu, 23 Oct 2025 15:23:11 +0200
Subject: Fix


diff --git a/drivers/builtin/CMakeLists.txt b/drivers/builtin/CMakeLists.txt
index de022a3..7485c1b 100644
--- a/drivers/builtin/CMakeLists.txt
+++ b/drivers/builtin/CMakeLists.txt
@@ -60,7 +60,7 @@ endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
 if(INSTALL_TF_PSA_CRYPTO_HEADERS)
 
   install(DIRECTORY include/mbedtls
-    DESTINATION include
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
     FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
     GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
diff --git a/drivers/everest/CMakeLists.txt b/drivers/everest/CMakeLists.txt
index ac02a5c..481e990 100644
--- a/drivers/everest/CMakeLists.txt
+++ b/drivers/everest/CMakeLists.txt
@@ -32,7 +32,7 @@ endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
 if(INSTALL_TF_PSA_CRYPTO_HEADERS)
 
   install(DIRECTORY include/tf-psa-crypto/private/everest
-    DESTINATION include/tf-psa-crypto/private/everest
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tf-psa-crypto/private/everest
     FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
     FILES_MATCHING PATTERN "*.h")
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 353a9b6..50978b5 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -6,15 +6,15 @@ if(INSTALL_TF_PSA_CRYPTO_HEADERS)
     file(GLOB mbedtls_crypto_headers "../drivers/builtin/include/mbedtls/*.h" "mbedtls/*.h")
 
     install(FILES ${psa_headers}
-        DESTINATION include/psa
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/psa
         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 
     install(FILES ${tf-psa-crypto_headers}
-        DESTINATION include/tf-psa-crypto
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tf-psa-crypto
         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 
     install(FILES ${mbedtls_crypto_headers}
-        DESTINATION include/mbedtls
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mbedtls
         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 endif(INSTALL_TF_PSA_CRYPTO_HEADERS)
 
-- 
2.51.0

### Suggested enhancement At the moment "include" directory is hardcoded, using CMAKE_INSTALL_INCLUDEDIR used the standard as done in GNUInstallDirs. ### Justification TF-PSA-Crypto needs this because Haiku doesn't use $prefix/include, but rather $prefix/develop/headers which is covered with the above. Atm I have a patchset here that works, but I'm unsure to which branch this would go as it would be required for mbedtls. Current patchset: ```diff From 1a358d5d983abeed012c8f6f3f43a7a7a6ab9f12 Mon Sep 17 00:00:00 2001 From: Luc Schrijvers <begasus@gmail.com> Date: Thu, 23 Oct 2025 15:23:11 +0200 Subject: Fix diff --git a/drivers/builtin/CMakeLists.txt b/drivers/builtin/CMakeLists.txt index de022a3..7485c1b 100644 --- a/drivers/builtin/CMakeLists.txt +++ b/drivers/builtin/CMakeLists.txt @@ -60,7 +60,7 @@ endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY) if(INSTALL_TF_PSA_CRYPTO_HEADERS) install(DIRECTORY include/mbedtls - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE diff --git a/drivers/everest/CMakeLists.txt b/drivers/everest/CMakeLists.txt index ac02a5c..481e990 100644 --- a/drivers/everest/CMakeLists.txt +++ b/drivers/everest/CMakeLists.txt @@ -32,7 +32,7 @@ endif(USE_SHARED_TF_PSA_CRYPTO_LIBRARY) if(INSTALL_TF_PSA_CRYPTO_HEADERS) install(DIRECTORY include/tf-psa-crypto/private/everest - DESTINATION include/tf-psa-crypto/private/everest + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tf-psa-crypto/private/everest FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES_MATCHING PATTERN "*.h") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 353a9b6..50978b5 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -6,15 +6,15 @@ if(INSTALL_TF_PSA_CRYPTO_HEADERS) file(GLOB mbedtls_crypto_headers "../drivers/builtin/include/mbedtls/*.h" "mbedtls/*.h") install(FILES ${psa_headers} - DESTINATION include/psa + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/psa PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) install(FILES ${tf-psa-crypto_headers} - DESTINATION include/tf-psa-crypto + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tf-psa-crypto PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) install(FILES ${mbedtls_crypto_headers} - DESTINATION include/mbedtls + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mbedtls PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) endif(INSTALL_TF_PSA_CRYPTO_HEADERS) -- 2.51.0 ```
ronald-cron-arm commented 2025-10-23 10:28:39 -05:00 (Migrated from github.com)

Thanks for the issue. If you are okay to create the PR, just target the development branch. The tf-psa-crypto submodule in the Mbed TLS development branch points to commits in the development branch of TF-PSA-Crypto. When the PR is merged, the changes will be picked up by Mbed TLS through a tf-psa-crypto submodule update.

Thanks for the issue. If you are okay to create the PR, just target the development branch. The tf-psa-crypto submodule in the Mbed TLS development branch points to commits in the development branch of TF-PSA-Crypto. When the PR is merged, the changes will be picked up by Mbed TLS through a tf-psa-crypto submodule update.
Begasus commented 2025-10-23 10:54:36 -05:00 (Migrated from github.com)

PR created to TF-PSA-Crypto.

PR created to TF-PSA-Crypto.
ronald-cron-arm commented 2025-10-23 10:55:10 -05:00 (Migrated from github.com)

PR created to TF-PSA-Crypto.

Thanks a lot.

> PR created to TF-PSA-Crypto. Thanks a lot.
Begasus commented 2025-10-23 10:56:10 -05:00 (Migrated from github.com)

No problem, makes it easier for the future, for the record got mbedtls-4.0.0 build/packaged/tested, all good. :)

No problem, makes it easier for the future, for the record got mbedtls-4.0.0 build/packaged/tested, all good. :)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#545
No description provided.