1 |
commit: 81f044d7b5f70314f72ec500664d240877ea2242 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 17 22:39:16 2023 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 17 23:56:11 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81f044d7 |
7 |
|
8 |
media-gfx/gphoto2: fix build w/ clang 16 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/896212 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../gphoto2/files/gphoto2-2.5.28-clang-16.patch | 77 ++++++++++++++++++++++ |
14 |
media-gfx/gphoto2/gphoto2-2.5.28-r1.ebuild | 54 +++++++++++++++ |
15 |
2 files changed, 131 insertions(+) |
16 |
|
17 |
diff --git a/media-gfx/gphoto2/files/gphoto2-2.5.28-clang-16.patch b/media-gfx/gphoto2/files/gphoto2-2.5.28-clang-16.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..e21d38b311e9 |
20 |
--- /dev/null |
21 |
+++ b/media-gfx/gphoto2/files/gphoto2-2.5.28-clang-16.patch |
22 |
@@ -0,0 +1,77 @@ |
23 |
+https://bugs.gentoo.org/896212 |
24 |
+https://github.com/gphoto/gphoto2/pull/569 |
25 |
+https://github.com/gphoto/gphoto2/commit/ccc4c1f092bd21ebc713f4d7b9be85be49f92f1e |
26 |
+https://github.com/gphoto/gphoto2/commit/366930ccc1a261c3eb883da2bf3c655162ccd75f |
27 |
+ |
28 |
+From ccc4c1f092bd21ebc713f4d7b9be85be49f92f1e Mon Sep 17 00:00:00 2001 |
29 |
+From: Khem Raj <raj.khem@×××××.com> |
30 |
+Date: Fri, 2 Sep 2022 12:59:46 -0700 |
31 |
+Subject: [PATCH] gphoto2: Use pthread_t abstract type for thead IDs |
32 |
+ |
33 |
+This is not a plain old datatype in every libc, e.g. with musl this |
34 |
+would fail in type conversion |
35 |
+ |
36 |
+Signed-off-by: Khem Raj <raj.khem@×××××.com> |
37 |
+--- a/gphoto2/main.c |
38 |
++++ b/gphoto2/main.c |
39 |
+@@ -1198,7 +1198,7 @@ thread_func (void *data) |
40 |
+ pthread_cleanup_pop (1); |
41 |
+ } |
42 |
+ |
43 |
+-static unsigned int |
44 |
++static pthread_t |
45 |
+ start_timeout_func (Camera *camera, unsigned int timeout, |
46 |
+ CameraTimeoutFunc func, void __unused__ *data) |
47 |
+ { |
48 |
+@@ -1219,7 +1219,7 @@ start_timeout_func (Camera *camera, unsigned int timeout, |
49 |
+ } |
50 |
+ |
51 |
+ static void |
52 |
+-stop_timeout_func (Camera __unused__ *camera, unsigned int id, |
53 |
++stop_timeout_func (Camera __unused__ *camera, pthread_t id, |
54 |
+ void __unused__ *data) |
55 |
+ { |
56 |
+ pthread_t tid = id; |
57 |
+ |
58 |
+ |
59 |
+From 366930ccc1a261c3eb883da2bf3c655162ccd75f Mon Sep 17 00:00:00 2001 |
60 |
+From: Khem Raj <raj.khem@×××××.com> |
61 |
+Date: Wed, 1 Mar 2023 22:58:37 -0800 |
62 |
+Subject: [PATCH] Match prototypes of callbacks with libgphoto |
63 |
+ |
64 |
+In https://github.com/gphoto/gphoto2/pull/535/commits/ccc4c1f092bd21ebc713f4d7b9be85be49f92f1e |
65 |
+we tried to fix by using pthread_t but it also needs to make changes in |
66 |
+libgphoto and these changes can be invasive, therefore lets revert to |
67 |
+older types and to fix musl problem fix it via type casts |
68 |
+ |
69 |
+Signed-off-by: Khem Raj <raj.khem@×××××.com> |
70 |
+--- a/gphoto2/main.c |
71 |
++++ b/gphoto2/main.c |
72 |
+@@ -1198,7 +1198,7 @@ thread_func (void *data) |
73 |
+ pthread_cleanup_pop (1); |
74 |
+ } |
75 |
+ |
76 |
+-static pthread_t |
77 |
++static unsigned int |
78 |
+ start_timeout_func (Camera *camera, unsigned int timeout, |
79 |
+ CameraTimeoutFunc func, void __unused__ *data) |
80 |
+ { |
81 |
+@@ -1215,14 +1215,14 @@ start_timeout_func (Camera *camera, unsigned int timeout, |
82 |
+ |
83 |
+ pthread_create (&tid, NULL, thread_func, td); |
84 |
+ |
85 |
+- return (tid); |
86 |
++ return (unsigned int)tid; |
87 |
+ } |
88 |
+ |
89 |
+ static void |
90 |
+-stop_timeout_func (Camera __unused__ *camera, pthread_t id, |
91 |
++stop_timeout_func (Camera __unused__ *camera, unsigned int id, |
92 |
+ void __unused__ *data) |
93 |
+ { |
94 |
+- pthread_t tid = id; |
95 |
++ pthread_t tid = (pthread_t)id; |
96 |
+ |
97 |
+ pthread_cancel (tid); |
98 |
+ pthread_join (tid, NULL); |
99 |
+ |
100 |
|
101 |
diff --git a/media-gfx/gphoto2/gphoto2-2.5.28-r1.ebuild b/media-gfx/gphoto2/gphoto2-2.5.28-r1.ebuild |
102 |
new file mode 100644 |
103 |
index 000000000000..451c24940a8e |
104 |
--- /dev/null |
105 |
+++ b/media-gfx/gphoto2/gphoto2-2.5.28-r1.ebuild |
106 |
@@ -0,0 +1,54 @@ |
107 |
+# Copyright 1999-2023 Gentoo Authors |
108 |
+# Distributed under the terms of the GNU General Public License v2 |
109 |
+ |
110 |
+EAPI=8 |
111 |
+ |
112 |
+inherit autotools |
113 |
+ |
114 |
+DESCRIPTION="Free, redistributable digital camera software application" |
115 |
+HOMEPAGE="http://www.gphoto.org/" |
116 |
+SRC_URI="mirror://sourceforge/gphoto/${P}.tar.xz" |
117 |
+ |
118 |
+LICENSE="GPL-2" |
119 |
+SLOT="0" |
120 |
+KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86" |
121 |
+IUSE="aalib ncurses nls readline" |
122 |
+ |
123 |
+# aalib -> needs libjpeg |
124 |
+RDEPEND=" |
125 |
+ >=dev-libs/popt-1.6.1 |
126 |
+ >=media-libs/libexif-0.6.9 |
127 |
+ >=media-libs/libgphoto2-2.5.17:=[exif] |
128 |
+ aalib? ( |
129 |
+ media-libs/aalib |
130 |
+ media-libs/libjpeg-turbo |
131 |
+ ) |
132 |
+ ncurses? ( dev-libs/cdk:= ) |
133 |
+ readline? ( sys-libs/readline:= ) |
134 |
+" |
135 |
+DEPEND="${RDEPEND}" |
136 |
+BDEPEND=" |
137 |
+ virtual/pkgconfig |
138 |
+ nls? ( >=sys-devel/gettext-0.14.1 ) |
139 |
+" |
140 |
+ |
141 |
+PATCHES=( |
142 |
+ "${FILESDIR}"/${P}-clang-16.patch |
143 |
+) |
144 |
+ |
145 |
+src_prepare() { |
146 |
+ default |
147 |
+ # Leave GCC debug builds under user control |
148 |
+ sed -r '/(C|LD)FLAGS/ s/ -g( |")/\1/' \ |
149 |
+ -i configure{.ac,} || die |
150 |
+ eautoreconf |
151 |
+} |
152 |
+ |
153 |
+src_configure() { |
154 |
+ econf \ |
155 |
+ $(use_with aalib) \ |
156 |
+ $(use_with aalib jpeg) \ |
157 |
+ $(use_with ncurses cdk) \ |
158 |
+ $(use_enable nls) \ |
159 |
+ $(use_with readline) |
160 |
+} |