# # spec file for package perl-Socket-GetAddrInfo # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Socket-GetAddrInfo Name: perl-Socket-GetAddrInfo Version: 0.220.0 Release: 0 # 0.22 -> normalize -> 0.220.0 %define cpan_version 0.22 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Address-family independent name resolving functions URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml Source100: README.md BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(ExtUtils::CBuilder) BuildRequires: perl(ExtUtils::CChecker) >= 0.06 BuildRequires: perl(Module::Build) BuildRequires: perl(Module::Build::Compat) BuildRequires: perl(Socket) >= 2.036 Requires: perl(Socket) >= 2.036 Provides: perl(Socket::GetAddrInfo) = %{version} Provides: perl(Socket::GetAddrInfo::Core) = %{version} Provides: perl(Socket::GetAddrInfo::Emul) = %{version} Provides: perl(Socket::GetAddrInfo::Socket6api) = %{version} Provides: perl(Socket::GetAddrInfo::Strict) = %{version} Provides: perl(Socket::GetAddrInfo::XS) = %{version} %undefine __perllib_provides %{perl_requires} %description The RFC 2553 functions 'getaddrinfo' and 'getnameinfo' provide an abstracted way to convert between a pair of host name/service name and socket addresses, or vice versa. 'getaddrinfo' converts names into a set of arguments to pass to the 'socket()' and 'connect()' syscalls, and 'getnameinfo' converts a socket address back into its host name/service name pair. These functions provide a useful interface for performing either of these name resolution operation, without having to deal with IPv4/IPv6 transparency, or whether the underlying host can support IPv6 at all, or other such issues. However, not all platforms can support the underlying calls at the C layer, which means a dilema for authors wishing to write forward-compatible code. Either to support these functions, and cause the code not to work on older platforms, or stick to the older "legacy" resolvers such as 'gethostbyname()', which means the code becomes more portable. This module attempts to solve this problem, by detecting at compiletime whether the underlying OS will support these functions. If it does not, the module will use pure-perl emulations of the functions using the legacy resolver functions instead. The emulations support the same interface as the real functions, and behave as close as is resonably possible to emulate using the legacy resolvers. See Socket::GetAddrInfo::Emul for details on the limits of this emulation. As of Perl version 5.14.0, Perl already supports 'getaddrinfo' in core. On such a system, this module simply uses the functions provided by 'Socket', and does not need to use its own compiled XS, or pure-perl legacy emulation. As 'Socket' in core now provides all the functions also provided by this module, it is likely this may be the last released version of this module. And code currently using this module would be advised to switch to using core 'Socket' instead. %prep %autosetup -n %{cpan_name}-%{cpan_version} %build perl Build.PL --installdirs=vendor optimize="%{optflags}" ./Build build --flags=%{?_smp_mflags} %check ./Build test %install ./Build install --destdir=%{buildroot} --create_packlist=0 %perl_gen_filelist %files -f %{name}.files %doc Changes README %license LICENSE %changelog