Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-perl/TermReadKey/, dev-perl/TermReadKey/files/
Date: Thu, 01 Dec 2022 04:23:25
Message-Id: 1669867613.cc66bf80ad125d2f2e682fc92fd1a3a2803fbb77.sam@gentoo
1 commit: cc66bf80ad125d2f2e682fc92fd1a3a2803fbb77
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 1 04:06:53 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 04:06:53 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc66bf80
7
8 dev-perl/TermReadKey: fix configure w/ clang 16
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 ....380.0.ebuild => TermReadKey-2.380.0-r1.ebuild} | 4 +
13 .../TermReadKey-2.380.0-configure-clang16.patch | 147 +++++++++++++++++++++
14 2 files changed, 151 insertions(+)
15
16 diff --git a/dev-perl/TermReadKey/TermReadKey-2.380.0.ebuild b/dev-perl/TermReadKey/TermReadKey-2.380.0-r1.ebuild
17 similarity index 90%
18 rename from dev-perl/TermReadKey/TermReadKey-2.380.0.ebuild
19 rename to dev-perl/TermReadKey/TermReadKey-2.380.0-r1.ebuild
20 index 667ae933ef4b..ade673b4b431 100644
21 --- a/dev-perl/TermReadKey/TermReadKey-2.380.0.ebuild
22 +++ b/dev-perl/TermReadKey/TermReadKey-2.380.0-r1.ebuild
23 @@ -16,3 +16,7 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv
24 BDEPEND="
25 >=virtual/perl-ExtUtils-MakeMaker-6.580.0
26 "
27 +
28 +PATCHES=(
29 + "${FILESDIR}"/${P}-configure-clang16.patch
30 +)
31
32 diff --git a/dev-perl/TermReadKey/files/TermReadKey-2.380.0-configure-clang16.patch b/dev-perl/TermReadKey/files/TermReadKey-2.380.0-configure-clang16.patch
33 new file mode 100644
34 index 000000000000..c53eff0e150a
35 --- /dev/null
36 +++ b/dev-perl/TermReadKey/files/TermReadKey-2.380.0-configure-clang16.patch
37 @@ -0,0 +1,147 @@
38 +https://github.com/jonathanstowe/TermReadKey/commit/1e3455135ac17f25ce0c4f01722a184a1fb5c4d1
39 +
40 +From 1e3455135ac17f25ce0c4f01722a184a1fb5c4d1 Mon Sep 17 00:00:00 2001
41 +From: Florian Weimer <fweimer@××××××.com>
42 +Date: Fri, 25 Nov 2022 17:28:56 +0100
43 +Subject: [PATCH] Configure.pm: Specify the return type of main as int
44 +
45 +Implicit int is a language feature that was removed in the 1999
46 +version of the C language.
47 +
48 +I could not fix DeducePrototype because I do not see how it
49 +can work reliably with this approach. I don't think TermReadKey
50 +uses this function.
51 +--- a/Configure.pm
52 ++++ b/Configure.pm
53 +@@ -503,7 +503,7 @@ by the compiler is returned.
54 + =cut
55 +
56 + sub CheckHeader { #Find a header (or set of headers) that exists
57 +- ApplyHeaders("main(){}",@_);
58 ++ ApplyHeaders("int main(){}",@_);
59 + }
60 +
61 + =head2 CheckStructure
62 +@@ -516,7 +516,7 @@ properly will be returned. B<undef> will be returned if nothing succeeds.
63 +
64 + sub CheckStructure { # Check existance of a structure.
65 + my($structname,@headers) = @_;
66 +- ApplyHeaders("main(){ struct $structname s;}",@headers);
67 ++ ApplyHeaders("int main(){ struct $structname s;}",@headers);
68 + }
69 +
70 + =head2 CheckField
71 +@@ -530,7 +530,7 @@ be returned if nothing succeeds.
72 +
73 + sub CheckField { # Check for the existance of specified field in structure
74 + my($structname,$fieldname,@headers) = @_;
75 +- ApplyHeaders("main(){ struct $structname s1; struct $structname s2;
76 ++ ApplyHeaders("int main(){ struct $structname s1; struct $structname s2;
77 + s1.$fieldname = s2.$fieldname; }",@headers);
78 + }
79 +
80 +@@ -544,7 +544,7 @@ that symbol will be returned. B<undef> will be returned if nothing succeeds.
81 +
82 + sub CheckLSymbol { # Check for linkable symbol
83 + my($symbol,@libs) = @_;
84 +- ApplyLibs("main() { void * f = (void *)($symbol); }",@libs);
85 ++ ApplyLibs("int main() { void * f = (void *)($symbol); }",@libs);
86 + }
87 +
88 + =head2 CheckSymbol
89 +@@ -558,7 +558,8 @@ B<undef> will be returned if nothing succeeds.
90 +
91 + sub CheckSymbol { # Check for linkable/header symbol
92 + my($symbol,@lookup) = @_;
93 +- ApplyHeadersAndLibs("main() { void * f = (void *)($symbol); }",@lookup);
94 ++ ApplyHeadersAndLibs("int main() { void * f = (void *)($symbol); }",
95 ++ @lookup);
96 + }
97 +
98 + =head2 CheckHSymbol
99 +@@ -571,7 +572,7 @@ that symbol will be returned. B<undef> will be returned if nothing succeeds.
100 +
101 + sub CheckHSymbol { # Check for header symbol
102 + my($symbol,@headers) = @_;
103 +- ApplyHeaders("main() { void * f = (void *)($symbol); }",@headers);
104 ++ ApplyHeaders("int main() { void * f = (void *)($symbol); }",@headers);
105 + }
106 +
107 + =head2 CheckHPrototype (unexported)
108 +@@ -591,7 +592,7 @@ sub CheckHPrototype { # Check for header prototype.
109 + # names function doesn't exist, this call will _succeed_. Caveat Utilitor.
110 + my($function,$proto,@headers) = @_;
111 + my(@proto) = @{$proto};
112 +- ApplyHeaders("main() { extern ".$proto[0]." $function(".
113 ++ ApplyHeaders("int main() { extern ".$proto[0]." $function(".
114 + join(",",@proto[1..$#proto])."); }",@headers);
115 + }
116 +
117 +@@ -612,7 +613,8 @@ Example:
118 + sub GetSymbol { # Check for linkable/header symbol
119 + my($symbol,$printf,$cast,@lookup) = @_,"","";
120 + scalar(ApplyHeadersAndLibsAndExecute(
121 +- "main(){ printf(\"\%$printf\",($cast)($symbol));exit(0);}",@lookup));
122 ++ "int main(){ printf(\"\%$printf\",($cast)($symbol));exit(0);}",
123 ++ @lookup));
124 + }
125 +
126 + =head2 GetTextSymbol
127 +@@ -768,7 +770,7 @@ main(){ }");
128 + "double","long double",
129 + "char","unsigned char","short int","unsigned short int");
130 +
131 +- if(Compile("main(){flurfie a;}")) { @types = (); }
132 ++ if(Compile("int main(){flurfie a;}")) { @types = (); }
133 +
134 + $Verbose=0;
135 +
136 +@@ -781,7 +783,7 @@ main(){ }");
137 + if(Compile("
138 + extern void func($types[$i]);
139 + extern void func($types[$j]);
140 +-main(){}")) {
141 ++int main(){}")) {
142 + print "Removing type $types[$j] because it equals $types[$i]\n";
143 + splice(@types,$j,1);
144 + $j--;
145 +@@ -795,7 +797,7 @@ main(){}")) {
146 + if(Compile("
147 + $types[$i] func(void);
148 + extern $types[$j] func(void);
149 +-main(){}")) {
150 ++int main(){}")) {
151 + print "Removing type $types[$j] because it equals $types[$i]\n";
152 + splice(@types,$j,1);
153 + $j--;
154 +@@ -833,7 +835,7 @@ main(){}")) {
155 + # Can we check the return type without worry about arguements?
156 + if($checkreturn and (!$checknilargs or !$checkniletcargs)) {
157 + for (@types) {
158 +- if(ApplyHeaders("extern $_ $function(". ($checknilargs?"...":"").");main(){}",[@headers])) {
159 ++ if(ApplyHeaders("extern $_ $function(". ($checknilargs?"...":"").");int main(){}",[@headers])) {
160 + $rettype = $_; # Great, we found the return type.
161 + last;
162 + }
163 +@@ -847,9 +849,9 @@ main(){}")) {
164 + my $numargs=-1;
165 + my $varargs=0;
166 + for (0..32) {
167 +- if(ApplyHeaders("main(){ $function(".join(",",("0") x $_).");}",@headers)) {
168 ++ if(ApplyHeaders("int main(){ $function(".join(",",("0") x $_).");}",@headers)) {
169 + $numargs=$_;
170 +- if(ApplyHeaders("main(){ $function(".join(",",("0") x ($_+1)).");}",@headers)) {
171 ++ if(ApplyHeaders("int main(){ $function(".join(",",("0") x ($_+1)).");}",@headers)) {
172 + $varargs=1;
173 + }
174 + last
175 +@@ -865,7 +867,7 @@ main(){}")) {
176 +
177 + if(@args>0 and !defined($rettype)) {
178 + for (@types) {
179 +- if(defined(ApplyHeaders("extern $_ $function(".join(",",@args).");main(){}",[@headers]))) {
180 ++ if(defined(ApplyHeaders("extern $_ $function(".join(",",@args).");int main(){}",[@headers]))) {
181 + $rettype = $_; # Great, we found the return type.
182 + last;
183 + }
184 +