Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/liborigin/files/, sci-libs/liborigin/
Date: Wed, 20 May 2020 22:18:08
Message-Id: 1590013072.15ac48991620a8b7f73d67788bed75b7ab8853b7.asturm@gentoo
1 commit: 15ac48991620a8b7f73d67788bed75b7ab8853b7
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 20 21:36:43 2020 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Wed May 20 22:17:52 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15ac4899
7
8 sci-libs/liborigin: 3.0.0 version bump
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
12
13 sci-libs/liborigin/Manifest | 1 +
14 .../files/liborigin-3.0.0-buildsystem.patch | 166 ++++++++++++++++
15 .../files/liborigin-3.0.0-missing-header.patch | 38 ++++
16 .../files/liborigin-3.0.0-no-exit-calls.patch | 89 +++++++++
17 .../liborigin-3.0.0-no-standard-streams.patch | 210 +++++++++++++++++++++
18 sci-libs/liborigin/liborigin-3.0.0.ebuild | 55 ++++++
19 sci-libs/liborigin/metadata.xml | 6 +-
20 7 files changed, 562 insertions(+), 3 deletions(-)
21
22 diff --git a/sci-libs/liborigin/Manifest b/sci-libs/liborigin/Manifest
23 index 9f0b954a93d..9b2da118ce9 100644
24 --- a/sci-libs/liborigin/Manifest
25 +++ b/sci-libs/liborigin/Manifest
26 @@ -1 +1,2 @@
27 +DIST liborigin-3.0.0.tar.gz 156736 BLAKE2B 1c1fda3fc3ad47394b65637a808eca1ecf4cff19eb49de0811e50d395c3b7759f8ec19c680ed83f7a8191022aa17b4ba1211baa6ea16a48a5153736d9138ed5c SHA512 1cf00ec33a90b4baede0cd3b2a3e6d78ca4810511c6be58c4d1cce12e7e1001752422fe2ddbca80cd9016b91c5321eca1ab43606ace3acc21955a034ebc4094c
28 DIST liborigin2-20110829.zip 158364 BLAKE2B fb6902142fe20bd29c8f3dd4c6d0c77b6f94e66f082c6950809367a4049adc1092a5e1abc2705670a15a32d1d680c14fc05061d34d422cd55689bb778ee47fde SHA512 d0e4013a686fbc61c58b1f39e98aace91978bcadffbb2ef9d32576a3b2f19cc2443d595da2d3ecc19298ec6e29c20717db94e1fda6a64d71f3763841228a01c0
29
30 diff --git a/sci-libs/liborigin/files/liborigin-3.0.0-buildsystem.patch b/sci-libs/liborigin/files/liborigin-3.0.0-buildsystem.patch
31 new file mode 100644
32 index 00000000000..d8444dedafe
33 --- /dev/null
34 +++ b/sci-libs/liborigin/files/liborigin-3.0.0-buildsystem.patch
35 @@ -0,0 +1,166 @@
36 +From a751f00ebba9fa226860ed4e2c1ae5fa35622e89 Mon Sep 17 00:00:00 2001
37 +From: Andreas Sturmlechner <asturm@g.o>
38 +Date: Wed, 20 May 2020 22:33:08 +0200
39 +Subject: [PATCH 1/4] Don't install bundled tree.hh
40 +
41 +Signed-off-by: Andreas Sturmlechner <asturm@g.o>
42 +---
43 + CMakeLists.txt | 1 -
44 + 1 file changed, 1 deletion(-)
45 +
46 +diff --git a/CMakeLists.txt b/CMakeLists.txt
47 +index 17c613b..a6b4b8a 100644
48 +--- a/CMakeLists.txt
49 ++++ b/CMakeLists.txt
50 +@@ -25,7 +25,6 @@ set (devel-headers
51 + OriginObj.h
52 + OriginFile.h
53 + OriginParser.h
54 +- tree.hh
55 + )
56 +
57 + # LIB_SUFFIX can either be defined at cmake command line: cmake -DLIB_SUFFIX:STRING=64 ...
58 +--
59 +2.26.2
60 +
61 +
62 +From 0b4fa1ce0946bc293d798484c609c6a7ac5ab50a Mon Sep 17 00:00:00 2001
63 +From: Andreas Sturmlechner <asturm@g.o>
64 +Date: Wed, 20 May 2020 22:35:02 +0200
65 +Subject: [PATCH 2/4] No static target, compile opj2dat against the shared lib
66 +
67 +Signed-off-by: Andreas Sturmlechner <asturm@g.o>
68 +---
69 + CMakeLists.txt | 8 +-------
70 + 1 file changed, 1 insertion(+), 7 deletions(-)
71 +
72 +diff --git a/CMakeLists.txt b/CMakeLists.txt
73 +index a6b4b8a..6f2d87b 100644
74 +--- a/CMakeLists.txt
75 ++++ b/CMakeLists.txt
76 +@@ -52,22 +52,16 @@ set_target_properties(origin PROPERTIES
77 + VERSION ${LIBORIGIN_VERSION_MAJOR}.${LIBORIGIN_VERSION_MINOR}.${LIBORIGIN_VERSION_BUGFIX}
78 + SOVERSION ${LIBORIGIN_VERSION_MAJOR} )
79 +
80 +-# static library
81 +-add_library (origin-static STATIC ${sources})
82 +-set_target_properties(origin-static PROPERTIES OUTPUT_NAME "origin" POSITION_INDEPENDENT_CODE ON)
83 +-
84 + # inform on log setting
85 + if (DEFINED GENERATE_CODE_FOR_LOG)
86 + message("File parsing will be logged.")
87 + target_compile_definitions(origin PRIVATE GENERATE_CODE_FOR_LOG=${GENERATE_CODE_FOR_LOG})
88 +- target_compile_definitions(origin-static PRIVATE GENERATE_CODE_FOR_LOG=${GENERATE_CODE_FOR_LOG})
89 + else()
90 + message("File parsing will NOT be logged. Define GENERATE_CODE_FOR_LOG to activate logging.")
91 + endif ()
92 +
93 + # install libraries
94 + install(TARGETS origin DESTINATION lib${LIB_SUFFIX} OPTIONAL)
95 +-install(TARGETS origin-static DESTINATION lib${LIB_SUFFIX} OPTIONAL)
96 +
97 + # install headers
98 + install(FILES ${devel-headers} DESTINATION include/liborigin)
99 +@@ -77,7 +71,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liborigin.pc DESTINATION lib${LIB_SUFF
100 +
101 + # command line util
102 + add_executable(opj2dat opj2dat.cpp)
103 +-target_link_libraries (opj2dat origin-static)
104 ++target_link_libraries (opj2dat origin)
105 +
106 + install(TARGETS opj2dat DESTINATION bin OPTIONAL)
107 +
108 +--
109 +2.26.2
110 +
111 +
112 +From 5f4c497408a6f144e581dd17fb3e49963e8b6b2b Mon Sep 17 00:00:00 2001
113 +From: Andreas Sturmlechner <asturm@g.o>
114 +Date: Wed, 20 May 2020 22:43:52 +0200
115 +Subject: [PATCH 3/4] Don't install README COPYING etc., distro package does
116 + that
117 +
118 +Signed-off-by: Andreas Sturmlechner <asturm@g.o>
119 +---
120 + CMakeLists.txt | 1 -
121 + 1 file changed, 1 deletion(-)
122 +
123 +diff --git a/CMakeLists.txt b/CMakeLists.txt
124 +index 6f2d87b..4fc16e0 100644
125 +--- a/CMakeLists.txt
126 ++++ b/CMakeLists.txt
127 +@@ -76,7 +76,6 @@ target_link_libraries (opj2dat origin)
128 + install(TARGETS opj2dat DESTINATION bin OPTIONAL)
129 +
130 + # documentation
131 +-install(FILES COPYING FORMAT README DESTINATION share/doc/liborigin OPTIONAL)
132 + configure_file(doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
133 + find_package(Doxygen)
134 + if(DOXYGEN_FOUND)
135 +--
136 +2.26.2
137 +
138 +
139 +From bb554d88b78e7575c04cf3e79098f35b776c3878 Mon Sep 17 00:00:00 2001
140 +From: Andreas Sturmlechner <asturm@g.o>
141 +Date: Wed, 20 May 2020 22:47:22 +0200
142 +Subject: [PATCH 4/4] Drop 'OPTIONAL' from install targets, add ENABLE_TOOLS
143 + option
144 +
145 +I've never seen an optional install of library.
146 +ENABLE_TOOLS takes care of the binary.
147 +Doxygen is already optional.
148 +
149 +Signed-off-by: Andreas Sturmlechner <asturm@g.o>
150 +---
151 + CMakeLists.txt | 14 +++++++++-----
152 + 1 file changed, 9 insertions(+), 5 deletions(-)
153 +
154 +diff --git a/CMakeLists.txt b/CMakeLists.txt
155 +index 4fc16e0..1759eee 100644
156 +--- a/CMakeLists.txt
157 ++++ b/CMakeLists.txt
158 +@@ -9,6 +9,8 @@ set(LIBORIGIN_VERSION_MAJOR 3)
159 + set(LIBORIGIN_VERSION_MINOR 0)
160 + set(LIBORIGIN_VERSION_BUGFIX 0)
161 +
162 ++option(ENABLE_TOOLS "Install opj2dat command line util" ON)
163 ++
164 + # compile-time configuration variables to be linked in
165 + configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
166 + include_directories(${CMAKE_CURRENT_BINARY_DIR})
167 +@@ -61,7 +63,7 @@ else()
168 + endif ()
169 +
170 + # install libraries
171 +-install(TARGETS origin DESTINATION lib${LIB_SUFFIX} OPTIONAL)
172 ++install(TARGETS origin DESTINATION lib${LIB_SUFFIX})
173 +
174 + # install headers
175 + install(FILES ${devel-headers} DESTINATION include/liborigin)
176 +@@ -70,10 +72,12 @@ install(FILES ${devel-headers} DESTINATION include/liborigin)
177 + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liborigin.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
178 +
179 + # command line util
180 +-add_executable(opj2dat opj2dat.cpp)
181 +-target_link_libraries (opj2dat origin)
182 ++if(ENABLE_TOOLS)
183 ++ add_executable(opj2dat opj2dat.cpp)
184 ++ target_link_libraries (opj2dat origin)
185 +
186 +-install(TARGETS opj2dat DESTINATION bin OPTIONAL)
187 ++ install(TARGETS opj2dat DESTINATION bin)
188 ++endif()
189 +
190 + # documentation
191 + configure_file(doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
192 +@@ -82,5 +86,5 @@ if(DOXYGEN_FOUND)
193 + add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
194 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
195 + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/html)
196 +- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/liborigin OPTIONAL)
197 ++ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/liborigin)
198 + endif(DOXYGEN_FOUND)
199 +--
200 +2.26.2
201 +
202
203 diff --git a/sci-libs/liborigin/files/liborigin-3.0.0-missing-header.patch b/sci-libs/liborigin/files/liborigin-3.0.0-missing-header.patch
204 new file mode 100644
205 index 00000000000..162dd93c3c5
206 --- /dev/null
207 +++ b/sci-libs/liborigin/files/liborigin-3.0.0-missing-header.patch
208 @@ -0,0 +1,38 @@
209 +From 78da3c4456cef15c91b5e5fcc1e82ca2364ea654 Mon Sep 17 00:00:00 2001
210 +From: Andreas Sturmlechner <asturm@g.o>
211 +Date: Wed, 20 May 2020 22:28:21 +0200
212 +Subject: [PATCH] Add missing header
213 +
214 +Signed-off-by: Andreas Sturmlechner <asturm@g.o>
215 +---
216 + OriginAnyParser.cpp | 1 +
217 + opj2dat.cpp | 1 +
218 + 2 files changed, 2 insertions(+)
219 +
220 +diff --git a/OriginAnyParser.cpp b/OriginAnyParser.cpp
221 +index 07a619e..c90f6e4 100644
222 +--- a/OriginAnyParser.cpp
223 ++++ b/OriginAnyParser.cpp
224 +@@ -22,6 +22,7 @@
225 + #include "OriginAnyParser.h"
226 + #include <sstream>
227 + #include <cinttypes>
228 ++#include <iostream>
229 +
230 + /* define a macro to get an int (or uint) from a istringstream in binary mode */
231 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
232 +diff --git a/opj2dat.cpp b/opj2dat.cpp
233 +index 230ac84..67b0815 100644
234 +--- a/opj2dat.cpp
235 ++++ b/opj2dat.cpp
236 +@@ -31,6 +31,7 @@
237 + #include <cmath>
238 + #include <fstream>
239 + #include <sstream>
240 ++#include <iostream>
241 + #include <string>
242 +
243 + using namespace std;
244 +--
245 +2.26.2
246 +
247
248 diff --git a/sci-libs/liborigin/files/liborigin-3.0.0-no-exit-calls.patch b/sci-libs/liborigin/files/liborigin-3.0.0-no-exit-calls.patch
249 new file mode 100644
250 index 00000000000..44b56a296fd
251 --- /dev/null
252 +++ b/sci-libs/liborigin/files/liborigin-3.0.0-no-exit-calls.patch
253 @@ -0,0 +1,89 @@
254 +From a8b25b489b48086e2616df98688969f89e63fa69 Mon Sep 17 00:00:00 2001
255 +From: Miquel Garriga <gbmiquel@×××××.com>
256 +Date: Fri, 23 Nov 2018 00:15:04 +0100
257 +Subject: [PATCH] Remove exit() calls
258 +
259 +---
260 + OriginFile.cpp | 15 ++++++++++-----
261 + OriginFile.h | 2 +-
262 + opj2dat.cpp | 2 ++
263 + 3 files changed, 13 insertions(+), 6 deletions(-)
264 +
265 +diff --git a/OriginFile.cpp b/OriginFile.cpp
266 +index f6c41b4..bcdcccb 100644
267 +--- a/OriginFile.cpp
268 ++++ b/OriginFile.cpp
269 +@@ -33,14 +33,15 @@
270 + #include <string>
271 +
272 + OriginFile::OriginFile(const string& fileName)
273 +-: fileVersion(0)
274 ++: fileVersion(0), ioError(0)
275 + {
276 + ifstream file(fileName.c_str(), ios_base::binary);
277 +
278 + if (!file.is_open())
279 + {
280 +- cerr << "Could not open " << fileName.c_str() << "!" << endl;
281 +- exit(EXIT_FAILURE);
282 ++ cerr << endl << "liborigin: " << strerror(errno) << ": " << fileName.c_str() << endl;
283 ++ ioError = errno;
284 ++ return;
285 + }
286 +
287 + #ifdef GENERATE_CODE_FOR_LOG
288 +@@ -48,8 +49,9 @@ OriginFile::OriginFile(const string& fileName)
289 + logfile = fopen("./opjfile.log", "w");
290 + if (logfile == nullptr)
291 + {
292 +- cerr << "Could not open opjfile.log !" << endl;
293 +- exit(EXIT_FAILURE);
294 ++ cerr << endl << "liborigin: " << strerror(errno) << ": opjfile.log" << endl;
295 ++ ioError = errno;
296 ++ return;
297 + }
298 + #endif // GENERATE_CODE_FOR_LOG
299 +
300 +@@ -152,10 +154,13 @@ OriginFile::OriginFile(const string& fileName)
301 + fclose(logfile);
302 + #endif // GENERATE_CODE_FOR_LOG
303 + parser.reset(createOriginAnyParser(fileName));
304 ++ ioError=0;
305 + }
306 +
307 + bool OriginFile::parse()
308 + {
309 ++ if (ioError != 0)
310 ++ return false;
311 + parser->buildVersion = buildVersion;
312 + parser->fileVersion = fileVersion;
313 + return parser->parse();
314 +diff --git a/OriginFile.h b/OriginFile.h
315 +index 80b6ff2..3a49395 100644
316 +--- a/OriginFile.h
317 ++++ b/OriginFile.h
318 +@@ -70,7 +70,7 @@ public:
319 + string resultsLogString() const; //!< get Results Log
320 +
321 + private:
322 +- unsigned int fileVersion, buildVersion;
323 ++ unsigned int fileVersion, buildVersion, ioError;
324 + unique_ptr<OriginParser> parser;
325 + };
326 +
327 +diff --git a/opj2dat.cpp b/opj2dat.cpp
328 +index ff53309..230ac84 100644
329 +--- a/opj2dat.cpp
330 ++++ b/opj2dat.cpp
331 +@@ -54,6 +54,8 @@ int main(int argc, char *argv[]) {
332 + OriginFile opj(inputfile);
333 + int status = opj.parse();
334 + cout << "Parsing status = " << status << endl;
335 ++ if (! status)
336 ++ return -1;
337 + cout << "OPJ PROJECT \"" << inputfile.c_str() << "\" VERSION = " << opj.version() << endl;
338 +
339 + cout << "number of datasets = " << opj.datasetCount() << endl;
340 +--
341 +2.26.2
342 +
343
344 diff --git a/sci-libs/liborigin/files/liborigin-3.0.0-no-standard-streams.patch b/sci-libs/liborigin/files/liborigin-3.0.0-no-standard-streams.patch
345 new file mode 100644
346 index 00000000000..227ce7b14d5
347 --- /dev/null
348 +++ b/sci-libs/liborigin/files/liborigin-3.0.0-no-standard-streams.patch
349 @@ -0,0 +1,210 @@
350 +From 6cb6d9b328195e11c1f168f6e4b915b522c7089f Mon Sep 17 00:00:00 2001
351 +From: Stefan Gerlach <stefan.gerlach@××××××××××××.de>
352 +Date: Wed, 15 May 2019 23:16:09 +0200
353 +Subject: [PATCH 1/3] do not output to standard streams (cout,
354 + cerr) by default
355 +
356 +it might be better to hide all such usage behind #ifdefs,
357 +since the streams might not belong to the shared library
358 +
359 +provided by Ivan Krylov (Ropj)
360 +---
361 + OriginAnyParser.cpp | 11 +++++------
362 + OriginAnyParser.h | 2 +-
363 + OriginFile.cpp | 2 --
364 + 3 files changed, 6 insertions(+), 9 deletions(-)
365 +
366 +diff --git a/OriginAnyParser.cpp b/OriginAnyParser.cpp
367 +index d45026b..ff7b8f7 100644
368 +--- a/OriginAnyParser.cpp
369 ++++ b/OriginAnyParser.cpp
370 +@@ -756,7 +756,7 @@ void OriginAnyParser::readProjectTree() {
371 +
372 + // log info on project tree
373 + #ifdef GENERATE_CODE_FOR_LOG
374 +- outputProjectTree();
375 ++ outputProjectTree(cout);
376 + #endif // GENERATE_CODE_FOR_LOG
377 +
378 + return;
379 +@@ -2835,7 +2835,6 @@ void OriginAnyParser::getColorMap(ColorMap& cmap, const string& cmapdata, unsign
380 + // check we have enough data to fill the map
381 + unsigned int minDataSize = cmoffset + 0x114 + (colorMapSize+2)*0x38;
382 + if (minDataSize > cmapdatasz) {
383 +- cerr << "WARNING: Too few data while getting ColorMap. Needed: at least " << minDataSize << " bytes. Have: " << cmapdatasz << " bytes." << endl;
384 + LOG_PRINT(logfile, "WARNING: Too few data while getting ColorMap. Needed: at least %d bytes. Have: %d bytes.\n", minDataSize, cmapdatasz)
385 + return;
386 + }
387 +@@ -2988,15 +2987,15 @@ void OriginAnyParser::getProjectFolderProperties(tree<ProjectNode>::iterator cur
388 + (*current_folder).modificationDate = doubleToPosixTime(modificationDate);
389 + }
390 +
391 +-void OriginAnyParser::outputProjectTree() {
392 ++void OriginAnyParser::outputProjectTree(std::ostream & out) {
393 + size_t windowsCount = spreadSheets.size()+matrixes.size()+excels.size()+graphs.size()+notes.size();
394 +
395 +- cout << "Project has " << windowsCount << " windows." << endl;
396 +- cout << "Origin project Tree" << endl;
397 ++ out << "Project has " << windowsCount << " windows." << endl;
398 ++ out << "Origin project Tree" << endl;
399 +
400 + char cdsz[21];
401 + for (tree<ProjectNode>::iterator it = projectTree.begin(projectTree.begin()); it != projectTree.end(projectTree.begin()); ++it) {
402 + strftime(cdsz, sizeof(cdsz), "%F %T", gmtime(&(*it).creationDate));
403 +- cout << string(projectTree.depth(it) - 1, ' ') << (*it).name.c_str() << "\t" << cdsz << endl;
404 ++ out << string(projectTree.depth(it) - 1, ' ') << (*it).name.c_str() << "\t" << cdsz << endl;
405 + }
406 + }
407 +diff --git a/OriginAnyParser.h b/OriginAnyParser.h
408 +index ed62bbb..bd7c1ae 100644
409 +--- a/OriginAnyParser.h
410 ++++ b/OriginAnyParser.h
411 +@@ -68,7 +68,7 @@ protected:
412 + void getZcolorsMap(ColorMap&, const string&, unsigned int);
413 + void getProjectLeafProperties(tree<ProjectNode>::iterator, const string&, unsigned int);
414 + void getProjectFolderProperties(tree<ProjectNode>::iterator, const string&, unsigned int);
415 +- void outputProjectTree();
416 ++ void outputProjectTree(std::ostream &);
417 +
418 + inline time_t doubleToPosixTime(double jdt)
419 + {
420 +diff --git a/OriginFile.cpp b/OriginFile.cpp
421 +index 5ac8e22..dba050f 100644
422 +--- a/OriginFile.cpp
423 ++++ b/OriginFile.cpp
424 +@@ -39,7 +39,6 @@ OriginFile::OriginFile(const string& fileName)
425 +
426 + if (!file.is_open())
427 + {
428 +- cerr << endl << "liborigin: " << strerror(errno) << ": " << fileName.c_str() << endl;
429 + ioError = errno;
430 + return;
431 + }
432 +@@ -49,7 +48,6 @@ OriginFile::OriginFile(const string& fileName)
433 + logfile = fopen("./opjfile.log", "w");
434 + if (logfile == nullptr)
435 + {
436 +- cerr << endl << "liborigin: " << strerror(errno) << ": opjfile.log" << endl;
437 + ioError = errno;
438 + return;
439 + }
440 +--
441 +2.26.2
442 +
443 +
444 +From 588bbc357cd34b9d353470ed6c0632b6f00805f5 Mon Sep 17 00:00:00 2001
445 +From: Stefan Gerlach <stefan.gerlach@××××××××××××.de>
446 +Date: Wed, 15 May 2019 23:28:46 +0200
447 +Subject: [PATCH 2/3] fix bugs found by UBSan
448 +
449 + - check values before casting to enum Attach
450 + - default-initialize sensitive struct elements
451 +
452 +provided by Ivan Krylov (Ropj)
453 +---
454 + OriginAnyParser.cpp | 1 +
455 + OriginObj.h | 5 ++++-
456 + README | 3 +++
457 + 3 files changed, 8 insertions(+), 1 deletion(-)
458 +
459 +diff --git a/OriginAnyParser.cpp b/OriginAnyParser.cpp
460 +index ff7b8f7..9f9731c 100644
461 +--- a/OriginAnyParser.cpp
462 ++++ b/OriginAnyParser.cpp
463 +@@ -1543,6 +1543,7 @@ void OriginAnyParser::getAnnotationProperties(const string& anhd, unsigned int a
464 + GET_SHORT(stmp, r.bottom)
465 +
466 + unsigned char attach = anhd[0x28];
467 ++ if (attach >= (unsigned char)Attach::End_) attach = Attach::Frame;
468 + unsigned char border = anhd[0x29];
469 +
470 + Color color = getColor(anhd.substr(0x33,4));
471 +diff --git a/OriginObj.h b/OriginObj.h
472 +index 3a9f719..aeeeb6b 100644
473 +--- a/OriginObj.h
474 ++++ b/OriginObj.h
475 +@@ -67,7 +67,7 @@ namespace Origin
476 + enum DayOfWeekFormat {DAY_DDD = 0, DAY_DDDD = 1, DAY_LETTER = 2};
477 +
478 + enum NumericDisplayType {DefaultDecimalDigits = 0, DecimalPlaces = 1, SignificantDigits = 2};
479 +- enum Attach {Frame = 0, Page = 1, Scale = 2};
480 ++ enum Attach {Frame = 0, Page = 1, Scale = 2, End_};
481 + enum BorderType {BlackLine = 0, Shadow = 1, DarkMarble = 2, WhiteOut = 3, BlackOut = 4, None = -1};
482 + enum FillPattern {NoFill = 0, BDiagDense = 1, BDiagMedium = 2, BDiagSparse = 3, FDiagDense = 4, FDiagMedium = 5, FDiagSparse = 6,
483 + DiagCrossDense = 7, DiagCrossMedium = 8, DiagCrossSparse = 9, HorizontalDense = 10, HorizontalMedium = 11, HorizontalSparse = 12,
484 +@@ -345,6 +345,7 @@ namespace Origin
485 + , width(8)
486 + , index(_index)
487 + , view(DataView)
488 ++ , colorMap()
489 + {coordinates.push_back(10.0);coordinates.push_back(10.0);coordinates.push_back(1.0);coordinates.push_back(1.0);};
490 + };
491 +
492 +@@ -895,9 +896,11 @@ namespace Origin
493 + GraphLayer()
494 + : backgroundColor({Color::Regular, {Color::White}})
495 + , borderType(BlackLine)
496 ++ , xAxis(), yAxis(), zAxis()
497 + , histogramBin(0.5)
498 + , histogramBegin(0.0)
499 + , histogramEnd(10.0)
500 ++ , colorMap()
501 + , xAngle(0)
502 + , yAngle(0)
503 + , zAngle(0)
504 +diff --git a/README b/README
505 +index 1dd56ef..598eacc 100644
506 +--- a/README
507 ++++ b/README
508 +@@ -7,6 +7,9 @@ It is based on the code at
509 + http://sourceforge.net/projects/liborigin
510 + http://soft.proindependent.com/liborigin2
511 +
512 ++Additionally, some fixes were applied to silence UBSan warnings caused by
513 ++uninitialised POD struct members.
514 ++
515 + AUTHORS: Knut Franke, Miquel Garriga, Stefan Gerlach, Alex Kargovsky, Russell Standish, Ion Vasilief
516 +
517 + DEPENDENCIES: tree.hh (included) http://tree.phi-sci.com/
518 +--
519 +2.26.2
520 +
521 +
522 +From 88b4de31e1860b8b5de6e3eea4a32e92f2e58c71 Mon Sep 17 00:00:00 2001
523 +From: Stefan Gerlach <stefan.gerlach@××××××××××××.de>
524 +Date: Wed, 15 May 2019 23:32:50 +0200
525 +Subject: [PATCH 3/3] readProjectTree: provide root node to append
526 + to
527 +
528 +append_child() is not supposed to work on an empty tree,
529 +and I couldn't find any initialization before its use.
530 +All inserted nodes seemed to end up below tree_node::feet
531 +(or something) and were not cleaned up by the destructor.
532 +
533 +Using insert() to create a dummy node for others to be
534 +children of fixes the leak.
535 +
536 +provided by Ivan Krylov (Ropj)
537 +---
538 + OriginAnyParser.cpp | 5 ++++-
539 + 1 file changed, 4 insertions(+), 1 deletion(-)
540 +
541 +diff --git a/OriginAnyParser.cpp b/OriginAnyParser.cpp
542 +index 9f9731c..4a79423 100644
543 +--- a/OriginAnyParser.cpp
544 ++++ b/OriginAnyParser.cpp
545 +@@ -743,7 +743,10 @@ void OriginAnyParser::readProjectTree() {
546 + string pte_pre2 = readObjectAsString(pte_pre2_size);
547 +
548 + // root element and children
549 +- unsigned int rootfolder = readFolderTree(projectTree.begin(), pte_depth);
550 ++ unsigned int rootfolder = readFolderTree(
551 ++ projectTree.insert(projectTree.begin(), ProjectNode("", ProjectNode::Folder)),
552 ++ pte_depth
553 ++ );
554 + if (rootfolder > 0) {
555 + LOG_PRINT(logfile, "Number of files at root: %d\n", rootfolder)
556 + }
557 +--
558 +2.26.2
559 +
560
561 diff --git a/sci-libs/liborigin/liborigin-3.0.0.ebuild b/sci-libs/liborigin/liborigin-3.0.0.ebuild
562 new file mode 100644
563 index 00000000000..aa4538748af
564 --- /dev/null
565 +++ b/sci-libs/liborigin/liborigin-3.0.0.ebuild
566 @@ -0,0 +1,55 @@
567 +# Copyright 1999-2020 Gentoo Authors
568 +# Distributed under the terms of the GNU General Public License v2
569 +
570 +EAPI=7
571 +
572 +inherit cmake
573 +
574 +DESCRIPTION="Library for reading OriginLab OPJ project files"
575 +HOMEPAGE="https://sourceforge.net/projects/liborigin/"
576 +SRC_URI="http://downloads.sourceforge.net/liborigin/${P}.tar.gz"
577 +
578 +LICENSE="GPL-3"
579 +SLOT="2"
580 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
581 +IUSE="debug doc tools"
582 +
583 +BDEPEND="
584 + doc? ( app-doc/doxygen )
585 +"
586 +RDEPEND="
587 + dev-cpp/tree
588 +"
589 +DEPEND="${RDEPEND}"
590 +
591 +PATCHES=(
592 + # git master
593 + "${FILESDIR}/${P}-no-exit-calls.patch"
594 + "${FILESDIR}/${P}-no-standard-streams.patch"
595 + # TODO upstream
596 + "${FILESDIR}/${P}-missing-header.patch"
597 + # downstream
598 + "${FILESDIR}/${P}-buildsystem.patch" # ENABLE_TOOLS, shared link, doc paths
599 +)
600 +
601 +src_prepare() {
602 + cmake_src_prepare
603 + rm tree.hh || die "failed to remove bundled tree.hh"
604 +
605 + sed -e "/install.*html/s/liborigin/${PF}/" \
606 + -i CMakeLists.txt || die "failed to fix htmldoc install path"
607 +}
608 +
609 +src_configure() {
610 + local mycmakeargs=(
611 + -DGENERATE_CODE_FOR_LOG=$(usex debug)
612 + $(cmake_use_find_package doc Doxygen)
613 + -DENABLE_TOOLS=$(usex tools)
614 + )
615 + cmake_src_configure
616 +}
617 +
618 +src_compile() {
619 + cmake_src_compile
620 + use doc && cmake_src_compile doc
621 +}
622
623 diff --git a/sci-libs/liborigin/metadata.xml b/sci-libs/liborigin/metadata.xml
624 index c049cd0777b..e7dc202da9b 100644
625 --- a/sci-libs/liborigin/metadata.xml
626 +++ b/sci-libs/liborigin/metadata.xml
627 @@ -5,7 +5,7 @@
628 <email>sci@g.o</email>
629 <name>Gentoo Science Project</name>
630 </maintainer>
631 - <longdescription>
632 - A library providing IO for Microcal Origin files.
633 - </longdescription>
634 + <use>
635 + <flag name="tools">Install opj2dat command line util</flag>
636 + </use>
637 </pkgmetadata>