Gentoo Archives: gentoo-commits

From: Alfredo Tupone <tupone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ada/gprbuild/files/, dev-ada/gprbuild/
Date: Sun, 27 Feb 2022 09:52:32
Message-Id: 1645955537.c8c82bae8e84eed2f7692a228e6306febec0e7c5.tupone@gentoo
1 commit: c8c82bae8e84eed2f7692a228e6306febec0e7c5
2 Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 27 09:52:17 2022 +0000
4 Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 27 09:52:17 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8c82bae
7
8 dev-ada/gprbuild: adding compatibility with gnat_2020
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
12
13 dev-ada/gprbuild/files/gprbuild-22.0.0-2020.patch | 47 +++++++++++++++++++++++
14 dev-ada/gprbuild/gprbuild-22.0.0-r1.ebuild | 16 +++++++-
15 2 files changed, 61 insertions(+), 2 deletions(-)
16
17 diff --git a/dev-ada/gprbuild/files/gprbuild-22.0.0-2020.patch b/dev-ada/gprbuild/files/gprbuild-22.0.0-2020.patch
18 new file mode 100644
19 index 000000000000..ba5c2f858de7
20 --- /dev/null
21 +++ b/dev-ada/gprbuild/files/gprbuild-22.0.0-2020.patch
22 @@ -0,0 +1,47 @@
23 +--- a/gpr/src/gpr_imports.c 2022-02-27 10:10:34.053638209 +0100
24 ++++ b/gpr/src/gpr_imports.c 2022-02-27 10:12:03.898276758 +0100
25 +@@ -114,6 +114,44 @@
26 + const char *__gnat_default_libgcc_subdir = "lib";
27 + #endif
28 +
29 ++#include <sys/types.h>
30 ++#include <sys/stat.h>
31 ++#include <limits.h>
32 ++#include <unistd.h>
33 ++
34 ++ extern long long __gnat_file_time(char* name)
35 ++ {
36 ++ long long result;
37 ++
38 ++ if (name == NULL) {
39 ++ return LLONG_MIN;
40 ++ }
41 ++ /* Number of seconds between <Jan 1st 1970> and <Jan 1st 2150>. */
42 ++ static const long long ada_epoch_offset = (136 * 365 + 44 * 366) * 86400LL;
43 ++ struct stat sb;
44 ++ if (stat(name, &sb) != 0) {
45 ++ return LLONG_MIN;
46 ++ }
47 ++
48 ++ // return (sb.st_mtim.tv_sec - ada_epoch_offset) * 1E9
49 ++ // + sb.st_mtim.tv_nsec;
50 ++ // with check overflow below
51 ++
52 ++ if (__builtin_ssubll_overflow(sb.st_mtim.tv_sec, ada_epoch_offset, &result)) {
53 ++ return LLONG_MIN;
54 ++ }
55 ++
56 ++ if (__builtin_smulll_overflow(result, 1E9, &result)) {
57 ++ return LLONG_MIN;
58 ++ }
59 ++
60 ++ if (__builtin_saddll_overflow(result, sb.st_mtim.tv_nsec, &result)) {
61 ++ return LLONG_MIN;
62 ++ }
63 ++
64 ++ return result;
65 ++ }
66 ++
67 + #ifdef __cplusplus
68 + }
69 + #endif
70
71 diff --git a/dev-ada/gprbuild/gprbuild-22.0.0-r1.ebuild b/dev-ada/gprbuild/gprbuild-22.0.0-r1.ebuild
72 index 06eb16e01235..97506af95abf 100644
73 --- a/dev-ada/gprbuild/gprbuild-22.0.0-r1.ebuild
74 +++ b/dev-ada/gprbuild/gprbuild-22.0.0-r1.ebuild
75 @@ -1,9 +1,9 @@
76 -# Copyright 1999-2021 Gentoo Authors
77 +# Copyright 1999-2022 Gentoo Authors
78 # Distributed under the terms of the GNU General Public License v2
79
80 EAPI=7
81
82 -ADA_COMPAT=( gnat_2021 )
83 +ADA_COMPAT=( gnat_202{0,1} )
84
85 inherit ada multiprocessing
86
87 @@ -53,6 +53,18 @@ src_prepare() {
88 -e "s:@GNATBIND@:${GNATBIND}:g" \
89 src/gprlib.adb \
90 || die
91 + if use ada_target_gnat_2020; then
92 + sed -i \
93 + -e "s:Append_Vector:Append:g" \
94 + -e "s:Insert_Vector:Insert:g" \
95 + src/gprbuild-link.adb \
96 + src/gprinstall-install.adb \
97 + src/gprlib.adb \
98 + src/gprlib-build_shared_lib.adb \
99 + src/gprbind.adb \
100 + || die
101 + eapply "${FILESDIR}"/${P}-2020.patch
102 + fi
103 }
104
105 bin_progs="gprbuild gprconfig gprclean gprinstall gprname gprls"