[libjxl] Fix Pkgconfig files are totally broken on x64-windows-static triplet (#33990)

Fixes https://github.com/microsoft/vcpkg/issues/33390
Fix the inconsistency between the name of the link library and the name
of the compiled library in the PC file under static compilation

- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md)
- [ ] ~~SHA512s are updated for each updated download~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [X] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [X] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:

```
x64-windows
x64-windows-static
```

---------

Co-authored-by: Jim wang (BEYONDSOFT CONSULTING INC) <v-wangjim@microsoft.com>
This commit is contained in:
jim wang 2024-03-06 07:49:20 +00:00 committed by GitHub
parent 187b695031
commit 07c93b8cd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,66 @@
diff --git a/lib/jxl.cmake b/lib/jxl.cmake
index a42b6f0..77e850b 100644
--- a/lib/jxl.cmake
+++ b/lib/jxl.cmake
@@ -627,6 +627,7 @@ foreach(target IN ITEMS jxl jxl_dec)
endif()
endforeach()
+set(JXL_STATIC_SUFFIX "")
# Only install libjxl shared library. The libjxl_dec is not installed since it
# contains symbols also in libjxl which would conflict if programs try to use
# both.
@@ -637,6 +638,7 @@ install(TARGETS jxl
else()
add_library(jxl ALIAS jxl-static)
add_library(jxl_dec ALIAS jxl_dec-static)
+set(JXL_STATIC_SUFFIX "-static")
endif() # BUILD_SHARED_LIBS
# Add a pkg-config file for libjxl.
diff --git a/lib/jxl/libjxl.pc.in b/lib/jxl/libjxl.pc.in
index 4a7af65..2d8d433 100644
--- a/lib/jxl/libjxl.pc.in
+++ b/lib/jxl/libjxl.pc.in
@@ -7,7 +7,7 @@ Name: libjxl
Description: Loads and saves JPEG XL files
Version: @JPEGXL_LIBRARY_VERSION@
Requires.private: @JPEGXL_LIBRARY_REQUIRES@
-Libs: -L${libdir} -ljxl
+Libs: -L${libdir} -ljxl@JXL_STATIC_SUFFIX@
Libs.private: -lm
Cflags: -I${includedir}
Cflags.private: -DJXL_STATIC_DEFINE
diff --git a/lib/jxl_threads.cmake b/lib/jxl_threads.cmake
index b8ce66b..1634280 100644
--- a/lib/jxl_threads.cmake
+++ b/lib/jxl_threads.cmake
@@ -100,6 +100,7 @@ target_compile_definitions(jxl_threads
generate_export_header(jxl_threads
BASE_NAME JXL_THREADS
EXPORT_FILE_NAME include/jxl/jxl_threads_export.h)
+set(THREAD_STATIC_SUFFIX "")
else()
add_library(jxl_threads ALIAS jxl_threads-static)
# When not building the shared library generate the jxl_threads_export.h header
@@ -107,6 +108,7 @@ add_library(jxl_threads ALIAS jxl_threads-static)
generate_export_header(jxl_threads-static
BASE_NAME JXL_THREADS
EXPORT_FILE_NAME include/jxl/jxl_threads_export.h)
+set(THREAD_STATIC_SUFFIX "-static")
endif() # BUILD_SHARED_LIBS
diff --git a/lib/threads/libjxl_threads.pc.in b/lib/threads/libjxl_threads.pc.in
index 50b937a..26cebbc 100644
--- a/lib/threads/libjxl_threads.pc.in
+++ b/lib/threads/libjxl_threads.pc.in
@@ -7,7 +7,7 @@ Name: libjxl_threads
Description: JPEG XL multi-thread runner using std::threads.
Version: @JPEGXL_LIBRARY_VERSION@
Requires.private: @JPEGXL_THREADS_LIBRARY_REQUIRES@
-Libs: -L${libdir} -ljxl_threads
+Libs: -L${libdir} -ljxl_threads@THREAD_STATIC_SUFFIX@
Libs.private: -lm
Cflags: -I${includedir}
Cflags.private: -DJXL_THREADS_STATIC_DEFINE

View File

@ -7,6 +7,7 @@ vcpkg_from_github(
PATCHES
fix-dependencies.patch
trim-shared-build.patch
fix_static_suffix.patch #https://github.com/libjxl/libjxl/pull/2754
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

View File

@ -1,7 +1,7 @@
{
"name": "libjxl",
"version-semver": "0.8.2",
"port-version": 1,
"port-version": 2,
"description": "JPEG XL image format reference implementation",
"homepage": "https://github.com/libjxl/libjxl",
"license": "BSD-3-Clause",

View File

@ -4522,7 +4522,7 @@
},
"libjxl": {
"baseline": "0.8.2",
"port-version": 1
"port-version": 2
},
"libkeyfinder": {
"baseline": "2.2.8",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "dd6af6fdf8e082629d672d105607c51bc70b07c7",
"version-semver": "0.8.2",
"port-version": 2
},
{
"git-tree": "9e8bdc34b806242bb7ed7fbabdf75d4781b3f7b7",
"version-semver": "0.8.2",