diff options
author | Yixun Lan <dlan@gentoo.org> | 2022-03-27 12:22:30 +0800 |
---|---|---|
committer | Yixun Lan <dlan@gentoo.org> | 2022-03-27 21:59:42 +0800 |
commit | 5cdf389fd2bdffd38450020639614522c63c2b82 (patch) | |
tree | 7c57f2831bb5755745d3d1a513ccfbdd0f4ce259 /media-libs | |
parent | profiles: lastrite libtaginfo and xnoise (diff) | |
download | gentoo-5cdf389fd2bdffd38450020639614522c63c2b82.tar.gz gentoo-5cdf389fd2bdffd38450020639614522c63c2b82.tar.bz2 gentoo-5cdf389fd2bdffd38450020639614522c63c2b82.zip |
media-libs/libjxl: use -pthread to fix missing atomic issue
Due to there is no 1, 2byte atomic instruction in 64bit RISC-V hardware,
the software layer have to emulate relavant function in atomic library
Let's explicitly pass -pthread here to work around pthread builtin since
glibc version 2.34
as the "-pthread" option will pull in libatomic for machines like RISC-V
Closes: https://bugs.gentoo.org/836125
Upstream: https://github.com/libjxl/libjxl/issues/1283
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Diffstat (limited to 'media-libs')
-rw-r--r-- | media-libs/libjxl/files/libjxl-0.7.0-pthread.patch | 40 | ||||
-rw-r--r-- | media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild | 2 |
2 files changed, 42 insertions, 0 deletions
diff --git a/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch new file mode 100644 index 000000000000..ea64e5805479 --- /dev/null +++ b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch @@ -0,0 +1,40 @@ + +Due to there is no 1, 2byte atomic instruction in 64bit RISC-V hardware, +the software layer have to emulate relavant function in atomic library + +Let's explicitly pass -pthread here to work around pthread builtin since glibc version 2.34 +as the "-pthread" option will pull in libatomic for machines like RISC-V + +the command of "gcc dumpspecs | grep pthread" will show accordingly in RISC-V: +pthread:--push-state --as-needed -latomic --pop-state + +https://bugs.gentoo.org/836125 +https://github.com/libjxl/libjxl/issues/1283 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4df740b..59c7f03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -190,6 +190,9 @@ endif() # JPEGXL_STATIC + # Threads + set(THREADS_PREFER_PTHREAD_FLAG YES) + find_package(Threads REQUIRED) ++if(CMAKE_USE_PTHREADS_INIT) ++ target_link_libraries(Threads::Threads INTERFACE -pthread) ++endif() + + if(JPEGXL_STATIC) + if (MINGW) +diff --git a/tools/conformance/CMakeLists.txt b/tools/conformance/CMakeLists.txt +index bd25b1c..d125dc5 100644 +--- a/tools/conformance/CMakeLists.txt ++++ b/tools/conformance/CMakeLists.txt +@@ -4,7 +4,7 @@ + # license that can be found in the LICENSE file. + + add_executable(djxl_conformance djxl_conformance.cc) +-target_link_libraries(djxl_conformance jxl_dec) ++target_link_libraries(djxl_conformance jxl_dec -pthread) + + if(BUILD_TESTING AND CMAKE_EXECUTABLE_SUFFIX STREQUAL "") + # Script to validate the tooling. diff --git a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild index 1afe0678670a..f16373af5651 100644 --- a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild +++ b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild @@ -30,6 +30,8 @@ DEPEND="app-arch/brotli:=[${MULTILIB_USEDEP}] RDEPEND="${DEPEND}" +PATCHES=( "${FILESDIR}/${PN}-0.7.0-pthread.patch" ) + S="${WORKDIR}/libjxl-libjxl-3f8e77f" multilib_src_configure() { |