vcpkg/ports/libjxl/fix_static_suffix.patch
jim wang 07c93b8cd5
[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>
2024-03-05 23:49:20 -08:00

67 lines
2.3 KiB
Diff

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