Backport upstream patch to fix C99 compatibility issue

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2023-11-28 14:44:16 +01:00
parent 941f2f6348
commit acddabbd47
2 changed files with 54 additions and 2 deletions

48
perl-IO-Tty-c99.patch Normal file
View File

@ -0,0 +1,48 @@
commit 1735a78561dbe139fd138caef2d44d81f5494fe7
Author: Khem Raj <raj.khem@gmail.com>
Date: Tue Apr 4 12:28:11 2023 -0700
Make function checks more robust within shared libs
Previous attempt to error at link like was with
https://github.com/toddr/IO-Tty/commit/1747cdf9f98cfd3aada9bf6c09f9d46297e18a5e
this however causes issues with newer clang where it detects
the assignment as -Wint-conversion warning which is treated at error
and builds with clang fail. So this is an attempt to instruct
linker explicitly to error out if the symbol is not found during link
time when building a shared library, this fixes both the problems
as reported in
https://github.com/toddr/IO-Tty/issues/23
as well as
https://github.com/toddr/IO-Tty/pull/33#issuecomment-1260147256
Signed-off-by: Khem Raj <raj.khem@gmail.com>
diff --git a/Makefile.PL b/Makefile.PL
index 6b1b6fab1a57f457..2efb6f9bb54d7ff8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -163,7 +163,8 @@ main ()
#if defined (__stub_$f) || defined (__stub___$f)
choke me
#else
-f = $f ();
+f = $f;
+f();
#endif
;
@@ -173,7 +174,7 @@ ESQ
close(TST);
print "Looking for $f()" . "." x (13-length($f)) . " ";
- if (system("$cfg{'cc'} $flags $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) {
+ if (system("$cfg{'cc'} $flags -Wl,--no-undefined $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) {
print "not found.\n";
} else {
$define{"-DHAVE_\U$f"} = undef;

View File

@ -1,10 +1,11 @@
Name: perl-IO-Tty
Version: 1.17
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Perl interface to pseudo tty's
License: (GPL-1.0-or-later OR Artistic-1.0-Perl) AND BSD-2-Clause
URL: https://metacpan.org/release/IO-Tty
Source0: https://cpan.metacpan.org/modules/by-module/IO/IO-Tty-%{version}.tar.gz
Patch0: perl-IO-Tty-c99.patch
# Module Build
BuildRequires: coreutils
BuildRequires: findutils
@ -37,7 +38,7 @@ BuildRequires: perl(Test::More)
IO::Tty and IO::Pty provide an interface to pseudo tty's.
%prep
%setup -q -n IO-Tty-%{version}
%autosetup -p1 -n IO-Tty-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1
@ -60,6 +61,9 @@ make test
%{_mandir}/man3/IO::Tty::Constant.3*
%changelog
* Tue Nov 28 2023 Florian Weimer <fweimer@redhat.com> - 1.17-5
- Backport upstream patch to fix C99 compatibility issue
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.17-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild