ada: add pkg-config file

This commit is contained in:
Duncaen 2025-05-01 21:04:07 +02:00
parent a9ef05175b
commit eb36028679
No known key found for this signature in database
GPG key ID: 335C1D17EC3D6E35
2 changed files with 182 additions and 1 deletions

View file

@ -0,0 +1,180 @@
From c94923410d0f528b7f5f363587821811bd38dd23 Mon Sep 17 00:00:00 2001
From: Daniel Lemire <daniel@lemire.me>
Date: Wed, 23 Apr 2025 17:09:13 -0400
Subject: [PATCH 01/10] adding pkg support
---
.github/workflows/pkg.yml | 33 +++++++++++++++++++++++++++++++++
CMakeLists.txt | 12 ++++++++++++
cmake/JoinPaths.cmake | 13 +++++++++++++
3 files changed, 58 insertions(+)
create mode 100644 .github/workflows/pkg.yml
create mode 100644 cmake/JoinPaths.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c32c86925..a7f007f76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,6 +163,18 @@ install(
COMPONENT example_development
)
+
+# pkg-config
+include(cmake/JoinPaths.cmake)
+join_paths(PKGCONFIG_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
+join_paths(PKGCONFIG_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
+
+configure_file("ada-url.pc.in" ""ada-url.pc" @ONLY)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/"ada-url.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
+
if(is_top_project)
set(CPACK_PACKAGE_VENDOR "Ada Authors")
set(CPACK_PACKAGE_CONTACT "yagiz@nizipli.com")
diff --git a/cmake/JoinPaths.cmake b/cmake/JoinPaths.cmake
new file mode 100644
index 000000000..7ada7eeb6
--- /dev/null
+++ b/cmake/JoinPaths.cmake
@@ -0,0 +1,13 @@
+function(join_paths joined_path first_path_segment)
+ set(temp_path "${first_path_segment}")
+ foreach(current_segment IN LISTS ARGN)
+ if(NOT ("${current_segment}" STREQUAL ""))
+ if(IS_ABSOLUTE "${current_segment}")
+ set(temp_path "${current_segment}")
+ else()
+ set(temp_path "${temp_path}/${current_segment}")
+ endif()
+ endif()
+ endforeach()
+ set(${joined_path} "${temp_path}" PARENT_SCOPE)
+endfunction()
\ No newline at end of file
From 47a0ba5ca10aa82f4f071ca2c5708c321317c9b7 Mon Sep 17 00:00:00 2001
From: Daniel Lemire <daniel@lemire.me>
Date: Wed, 23 Apr 2025 17:15:27 -0400
Subject: [PATCH 02/10] fixing quotes
---
CMakeLists.txt | 4 ++--
ada-url.pc.in | 11 +++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
create mode 100644 ada-url.pc.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7f007f76..040c51c02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,9 +169,9 @@ include(cmake/JoinPaths.cmake)
join_paths(PKGCONFIG_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
join_paths(PKGCONFIG_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
-configure_file("ada-url.pc.in" ""ada-url.pc" @ONLY)
+configure_file("ada-url.pc.in" "ada-url.pc" @ONLY)
install(
- FILES "${CMAKE_CURRENT_BINARY_DIR}/"ada-url.pc"
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/ada-url.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
diff --git a/ada-url.pc.in b/ada-url.pc.in
new file mode 100644
index 000000000..7312a0107
--- /dev/null
+++ b/ada-url.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=@PKGCONFIG_INCLUDEDIR@
+libdir=@PKGCONFIG_LIBDIR@
+
+Name: @PROJECT_NAME@
+Description: @PROJECT_DESCRIPTION@
+URL: @PROJECT_HOMEPAGE_URL@
+Version: @PROJECT_VERSION@
+Cflags: -I${includedir} @PKGCONFIG_CFLAGS@
+Libs: -L${libdir} -l@PROJECT_NAME@
+@PKGCONFIG_LIBS_PRIVATE@
From 92d18b763e5ab414264195b2e965d237833b9056 Mon Sep 17 00:00:00 2001
From: Daniel Lemire <daniel@lemire.me>
Date: Wed, 23 Apr 2025 17:17:28 -0400
Subject: [PATCH 06/10] fix indent
---
cmake/JoinPaths.cmake | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/cmake/JoinPaths.cmake b/cmake/JoinPaths.cmake
index 7ada7eeb6..4f0740a6c 100644
--- a/cmake/JoinPaths.cmake
+++ b/cmake/JoinPaths.cmake
@@ -1,13 +1,13 @@
function(join_paths joined_path first_path_segment)
- set(temp_path "${first_path_segment}")
- foreach(current_segment IN LISTS ARGN)
- if(NOT ("${current_segment}" STREQUAL ""))
- if(IS_ABSOLUTE "${current_segment}")
- set(temp_path "${current_segment}")
- else()
- set(temp_path "${temp_path}/${current_segment}")
- endif()
- endif()
- endforeach()
- set(${joined_path} "${temp_path}" PARENT_SCOPE)
-endfunction()
\ No newline at end of file
+ set(temp_path "${first_path_segment}")
+ foreach(current_segment IN LISTS ARGN)
+ if(NOT ("${current_segment}" STREQUAL ""))
+ if(IS_ABSOLUTE "${current_segment}")
+ set(temp_path "${current_segment}")
+ else()
+ set(temp_path "${temp_path}/${current_segment}")
+ endif()
+ endif()
+ endforeach()
+ set(${joined_path} "${temp_path}" PARENT_SCOPE)
+endfunction()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 040c51c02..1ab80727f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -171,8 +171,8 @@ join_paths(PKGCONFIG_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
configure_file("ada-url.pc.in" "ada-url.pc" @ONLY)
install(
- FILES "${CMAKE_CURRENT_BINARY_DIR}/ada-url.pc"
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/ada-url.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
if(is_top_project)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ab80727f..8a3674b66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,9 +169,9 @@ include(cmake/JoinPaths.cmake)
join_paths(PKGCONFIG_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
join_paths(PKGCONFIG_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
-configure_file("ada-url.pc.in" "ada-url.pc" @ONLY)
+configure_file("ada.pc.in" "ada.pc" @ONLY)
install(
- FILES "${CMAKE_CURRENT_BINARY_DIR}/ada-url.pc"
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/ada.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
diff --git a/ada-url.pc.in b/ada.pc.in
similarity index 100%
rename from ada-url.pc.in
rename to ada.pc.in

View file

@ -1,7 +1,7 @@
# Template file for 'ada'
pkgname=ada
version=3.2.1
revision=1
revision=2
build_style=cmake
# They all pull in CPM - CMake's missing package manager
configure_args="-DADA_TESTING=OFF -DADA_BENCHMARKS=OFF -DADA_TOOLS=OFF
@ -24,6 +24,7 @@ ada-devel_package() {
pkg_install() {
vmove usr/include
vmove usr/lib/cmake
vmove usr/lib/pkgconfig
vmove "usr/lib/*.so"
}
}