Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/advancecomp/, app-arch/advancecomp/files/
Date: Thu, 29 Apr 2021 19:56:46
Message-Id: 1619726143.30eb83dd80937406bc984e5834b82e73f8738be3.mgorny@gentoo
1 commit: 30eb83dd80937406bc984e5834b82e73f8738be3
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 29 18:41:13 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 29 19:55:43 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30eb83dd
7
8 app-arch/advancecomp: Backport C++17 (GCC 11) fix
9
10 Closes: https://bugs.gentoo.org/786534
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 .../advancecomp/advancecomp-2.2_pre20190301.ebuild | 7 +-
14 .../files/advancecomp-2.2_pre20190301-gcc-11.patch | 184 +++++++++++++++++++++
15 2 files changed, 189 insertions(+), 2 deletions(-)
16
17 diff --git a/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild b/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
18 index e103631dcc4..edb31f6a8c4 100644
19 --- a/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
20 +++ b/app-arch/advancecomp/advancecomp-2.2_pre20190301.ebuild
21 @@ -1,4 +1,4 @@
22 -# Copyright 1999-2019 Gentoo Authors
23 +# Copyright 1999-2021 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25
26 EAPI=7
27 @@ -10,6 +10,7 @@ DESCRIPTION="Recompress ZIP, PNG and MNG, considerably improving compression"
28 HOMEPAGE="https://www.advancemame.it/comp-readme.html"
29 SRC_URI="https://github.com/amadvance/advancecomp/archive/${EGIT_COMMIT}.tar.gz
30 -> ${PN}-${EGIT_COMMIT}.tar.gz"
31 +S=${WORKDIR}/${PN}-${EGIT_COMMIT}
32
33 LICENSE="GPL-2+ Apache-2.0 LGPL-2.1+ MIT"
34 SLOT="0"
35 @@ -24,7 +25,9 @@ DEPEND="${RDEPEND}"
36 # https://sourceforge.net/p/advancemame/bugs/270/
37 RESTRICT="test"
38
39 -S=${WORKDIR}/${PN}-${EGIT_COMMIT}
40 +PATCHES=(
41 + "${FILESDIR}"/${P}-gcc-11.patch
42 +)
43
44 src_prepare() {
45 default
46
47 diff --git a/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch b/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch
48 new file mode 100644
49 index 00000000000..b72a6824a30
50 --- /dev/null
51 +++ b/app-arch/advancecomp/files/advancecomp-2.2_pre20190301-gcc-11.patch
52 @@ -0,0 +1,184 @@
53 +From 7b08f7a2af3f66ab95437e4490499cebb20e5e41 Mon Sep 17 00:00:00 2001
54 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
55 +Date: Wed, 28 Apr 2021 22:11:42 +0200
56 +Subject: [PATCH] Remove dynamic exception specification to fix C++17
57 + compatibility
58 +
59 +The dynamic exception specifications have been deprecated in C++11
60 +and eventually removed in C++17 [1]. GCC-11 uses gnu++17 by default,
61 +causing advancecomp to fail to compile:
62 +
63 + In file included from rezip.cc:24:
64 + file.h:70:43: error: ISO C++17 does not allow dynamic exception specifications
65 + 70 | bool file_exists(const std::string& file) throw (error);
66 + | ^~~~~
67 + file.h:71:75: error: ISO C++17 does not allow dynamic exception specifications
68 + 71 | e(const std::string& path, const char* data, unsigned size) throw (error);
69 + | ^~~~~
70 + ...
71 +
72 +Since there is really no gain from having these specifications anymore,
73 +just remove them to fix the build.
74 +
75 +[1] https://en.cppreference.com/w/cpp/language/except_spec
76 +---
77 + file.cc | 26 +++++++++++++-------------
78 + file.h | 24 ++++++++++++------------
79 + 2 files changed, 25 insertions(+), 25 deletions(-)
80 +
81 +diff --git a/file.cc b/file.cc
82 +index 1e90348..d676d25 100644
83 +--- a/file.cc
84 ++++ b/file.cc
85 +@@ -98,7 +98,7 @@ void infopath::readonly_set(bool Areadonly)
86 + /**
87 + * Check if a file exists.
88 + */
89 +-bool file_exists(const string& path) throw (error)
90 ++bool file_exists(const string& path)
91 + {
92 + struct stat s;
93 + if (stat(path.c_str(), &s) != 0) {
94 +@@ -114,7 +114,7 @@ bool file_exists(const string& path) throw (error)
95 + /**
96 + * Write a whole file.
97 + */
98 +-void file_write(const string& path, const char* data, unsigned size) throw (error)
99 ++void file_write(const string& path, const char* data, unsigned size)
100 + {
101 + FILE* f = fopen(path.c_str(), "wb");
102 + if (!f)
103 +@@ -134,7 +134,7 @@ void file_write(const string& path, const char* data, unsigned size) throw (erro
104 + /**
105 + * Read a whole file.
106 + */
107 +-void file_read(const string& path, char* data, unsigned size) throw (error)
108 ++void file_read(const string& path, char* data, unsigned size)
109 + {
110 + file_read(path, data, 0, size);
111 + }
112 +@@ -142,7 +142,7 @@ void file_read(const string& path, char* data, unsigned size) throw (error)
113 + /**
114 + * Read a whole file.
115 + */
116 +-void file_read(const string& path, char* data, unsigned offset, unsigned size) throw (error)
117 ++void file_read(const string& path, char* data, unsigned offset, unsigned size)
118 + {
119 + FILE* f = fopen(path.c_str(), "rb");
120 + if (!f)
121 +@@ -166,7 +166,7 @@ void file_read(const string& path, char* data, unsigned offset, unsigned size) t
122 + /**
123 + * Get the time of a file.
124 + */
125 +-time_t file_time(const string& path) throw (error)
126 ++time_t file_time(const string& path)
127 + {
128 + struct stat s;
129 + if (stat(path.c_str(), &s)!=0)
130 +@@ -178,7 +178,7 @@ time_t file_time(const string& path) throw (error)
131 + /**
132 + * Set the time of a file.
133 + */
134 +-void file_utime(const string& path, time_t tod) throw (error)
135 ++void file_utime(const string& path, time_t tod)
136 + {
137 + struct utimbuf u;
138 +
139 +@@ -192,7 +192,7 @@ void file_utime(const string& path, time_t tod) throw (error)
140 + /**
141 + * Get the size of a file.
142 + */
143 +-unsigned file_size(const string& path) throw (error)
144 ++unsigned file_size(const string& path)
145 + {
146 + struct stat s;
147 + if (stat(path.c_str(), &s)!=0)
148 +@@ -204,7 +204,7 @@ unsigned file_size(const string& path) throw (error)
149 + /**
150 + * Get the crc of a file.
151 + */
152 +-crc_t file_crc(const string& path) throw (error)
153 ++crc_t file_crc(const string& path)
154 + {
155 + unsigned size = file_size(path);
156 +
157 +@@ -227,7 +227,7 @@ crc_t file_crc(const string& path) throw (error)
158 + /**
159 + * Copy a file.
160 + */
161 +-void file_copy(const string& path1, const string& path2) throw (error)
162 ++void file_copy(const string& path1, const string& path2)
163 + {
164 + unsigned size;
165 +
166 +@@ -249,7 +249,7 @@ void file_copy(const string& path1, const string& path2) throw (error)
167 + /**
168 + * Move a file.
169 + */
170 +-void file_move(const string& path1, const string& path2) throw (error)
171 ++void file_move(const string& path1, const string& path2)
172 + {
173 + if (rename(path1.c_str(), path2.c_str())!=0
174 + && errno==EXDEV) {
175 +@@ -271,7 +271,7 @@ void file_move(const string& path1, const string& path2) throw (error)
176 + /**
177 + * Remove a file.
178 + */
179 +-void file_remove(const string& path1) throw (error)
180 ++void file_remove(const string& path1)
181 + {
182 + if (remove(path1.c_str())!=0) {
183 + throw error() << "Failed remove of " << path1;
184 +@@ -281,7 +281,7 @@ void file_remove(const string& path1) throw (error)
185 + /**
186 + * Rename a file.
187 + */
188 +-void file_rename(const string& path1, const string& path2) throw (error)
189 ++void file_rename(const string& path1, const string& path2)
190 + {
191 + if (rename(path1.c_str(), path2.c_str())!=0) {
192 + throw error() << "Failed rename of " << path1 << " to " << path2;
193 +@@ -409,7 +409,7 @@ string file_adjust(const string& path) throw ()
194 + /**
195 + * Make a drectory tree.
196 + */
197 +-void file_mktree(const std::string& path) throw (error)
198 ++void file_mktree(const std::string& path)
199 + {
200 + string dir = file_dir(path);
201 + string name = file_name(path);
202 +diff --git a/file.h b/file.h
203 +index 1b0cf85..49429b5 100644
204 +--- a/file.h
205 ++++ b/file.h
206 +@@ -67,18 +67,18 @@ typedef unsigned crc_t;
207 + crc_t crc_compute(const char* data, unsigned len);
208 + crc_t crc_compute(crc_t pred, const char* data, unsigned len);
209 +
210 +-bool file_exists(const std::string& file) throw (error);
211 +-void file_write(const std::string& path, const char* data, unsigned size) throw (error);
212 +-void file_read(const std::string& path, char* data, unsigned size) throw (error);
213 +-void file_read(const std::string& path, char* data, unsigned offset, unsigned size) throw (error);
214 +-time_t file_time(const std::string& path) throw (error);
215 +-void file_utime(const std::string& path, time_t tod) throw (error);
216 +-unsigned file_size(const std::string& path) throw (error);
217 +-crc_t file_crc(const std::string& path) throw (error);
218 +-void file_copy(const std::string& path1, const std::string& path2) throw (error);
219 +-void file_move(const std::string& path1, const std::string& path2) throw (error);
220 +-void file_remove(const std::string& path1) throw (error);
221 +-void file_mktree(const std::string& path1) throw (error);
222 ++bool file_exists(const std::string& file);
223 ++void file_write(const std::string& path, const char* data, unsigned size);
224 ++void file_read(const std::string& path, char* data, unsigned size);
225 ++void file_read(const std::string& path, char* data, unsigned offset, unsigned size);
226 ++time_t file_time(const std::string& path);
227 ++void file_utime(const std::string& path, time_t tod);
228 ++unsigned file_size(const std::string& path);
229 ++crc_t file_crc(const std::string& path);
230 ++void file_copy(const std::string& path1, const std::string& path2);
231 ++void file_move(const std::string& path1, const std::string& path2);
232 ++void file_remove(const std::string& path1);
233 ++void file_mktree(const std::string& path1);
234 +
235 + std::string file_temp(const std::string& path) throw ();
236 + std::string file_randomize(const std::string& path, int n) throw ();