Gentoo Archives: gentoo-commits

From: Yixun Lan <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/libjxl/files/, media-libs/libjxl/
Date: Sun, 27 Mar 2022 14:00:28
Message-Id: 1648389582.5cdf389fd2bdffd38450020639614522c63c2b82.dlan@gentoo
1 commit: 5cdf389fd2bdffd38450020639614522c63c2b82
2 Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 27 04:22:30 2022 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 27 13:59:42 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5cdf389f
7
8 media-libs/libjxl: use -pthread to fix missing atomic issue
9
10 Due to there is no 1, 2byte atomic instruction in 64bit RISC-V hardware,
11 the software layer have to emulate relavant function in atomic library
12
13 Let's explicitly pass -pthread here to work around pthread builtin since
14 glibc version 2.34
15 as the "-pthread" option will pull in libatomic for machines like RISC-V
16
17 Closes: https://bugs.gentoo.org/836125
18 Upstream: https://github.com/libjxl/libjxl/issues/1283
19 Package-Manager: Portage-3.0.30, Repoman-3.0.3
20 Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>
21
22 media-libs/libjxl/files/libjxl-0.7.0-pthread.patch | 40 ++++++++++++++++++++++
23 media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild | 2 ++
24 2 files changed, 42 insertions(+)
25
26 diff --git a/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch
27 new file mode 100644
28 index 000000000000..ea64e5805479
29 --- /dev/null
30 +++ b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch
31 @@ -0,0 +1,40 @@
32 +
33 +Due to there is no 1, 2byte atomic instruction in 64bit RISC-V hardware,
34 +the software layer have to emulate relavant function in atomic library
35 +
36 +Let's explicitly pass -pthread here to work around pthread builtin since glibc version 2.34
37 +as the "-pthread" option will pull in libatomic for machines like RISC-V
38 +
39 +the command of "gcc dumpspecs | grep pthread" will show accordingly in RISC-V:
40 +pthread:--push-state --as-needed -latomic --pop-state
41 +
42 +https://bugs.gentoo.org/836125
43 +https://github.com/libjxl/libjxl/issues/1283
44 +
45 +diff --git a/CMakeLists.txt b/CMakeLists.txt
46 +index 4df740b..59c7f03 100644
47 +--- a/CMakeLists.txt
48 ++++ b/CMakeLists.txt
49 +@@ -190,6 +190,9 @@ endif() # JPEGXL_STATIC
50 + # Threads
51 + set(THREADS_PREFER_PTHREAD_FLAG YES)
52 + find_package(Threads REQUIRED)
53 ++if(CMAKE_USE_PTHREADS_INIT)
54 ++ target_link_libraries(Threads::Threads INTERFACE -pthread)
55 ++endif()
56 +
57 + if(JPEGXL_STATIC)
58 + if (MINGW)
59 +diff --git a/tools/conformance/CMakeLists.txt b/tools/conformance/CMakeLists.txt
60 +index bd25b1c..d125dc5 100644
61 +--- a/tools/conformance/CMakeLists.txt
62 ++++ b/tools/conformance/CMakeLists.txt
63 +@@ -4,7 +4,7 @@
64 + # license that can be found in the LICENSE file.
65 +
66 + add_executable(djxl_conformance djxl_conformance.cc)
67 +-target_link_libraries(djxl_conformance jxl_dec)
68 ++target_link_libraries(djxl_conformance jxl_dec -pthread)
69 +
70 + if(BUILD_TESTING AND CMAKE_EXECUTABLE_SUFFIX STREQUAL "")
71 + # Script to validate the tooling.
72
73 diff --git a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild
74 index 1afe0678670a..f16373af5651 100644
75 --- a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild
76 +++ b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild
77 @@ -30,6 +30,8 @@ DEPEND="app-arch/brotli:=[${MULTILIB_USEDEP}]
78
79 RDEPEND="${DEPEND}"
80
81 +PATCHES=( "${FILESDIR}/${PN}-0.7.0-pthread.patch" )
82 +
83 S="${WORKDIR}/libjxl-libjxl-3f8e77f"
84
85 multilib_src_configure() {