From c20c322ae37d170f2cb09bdd7ee04a22a8cc44c5 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Fri, 18 Sep 2026 11:24:48 -0500 Subject: [PATCH 1/5] account for non GNU cp on Solaris --- lib/Alien/Build/Plugin/Build/Copy.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Alien/Build/Plugin/Build/Copy.pm b/lib/Alien/Build/Plugin/Build/Copy.pm index 65456dbf..366c9075 100644 --- a/lib/Alien/Build/Plugin/Build/Copy.pm +++ b/lib/Alien/Build/Plugin/Build/Copy.pm @@ -81,7 +81,7 @@ sub init $build->system(qq{xcopy . "$stage" /E}); }); } - elsif($^O eq 'darwin') + elsif($^O eq 'darwin' || $^O eq 'solaris') { # On recent macOS -pPR is the same as -aR # on older Mac OS X (10.5 at least) -a is not supported but -pPR is. @@ -91,6 +91,9 @@ sub init # differences between -pPR and -aR on coreutils, that may or may not be # important enough to care about. + # Solaris /usr/bin/cp and /usr/xpg4/bin/cp don't support -a at all, + # but do support -p, -P and -R. + $meta->register_hook(build => [ 'cp -pPR * "%{.install.stage}"', ]); From 766fd2de0237ffc7dcfb483641fcb1622eab0df5 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Fri, 18 Sep 2026 11:25:27 -0500 Subject: [PATCH 2/5] acclount for old pkg-config on Solaris --- .../Build/Plugin/PkgConfig/CommandLine.pm | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/Alien/Build/Plugin/PkgConfig/CommandLine.pm b/lib/Alien/Build/Plugin/PkgConfig/CommandLine.pm index 1f85c29b..6d22c0da 100644 --- a/lib/Alien/Build/Plugin/PkgConfig/CommandLine.pm +++ b/lib/Alien/Build/Plugin/PkgConfig/CommandLine.pm @@ -4,6 +4,7 @@ use strict; use warnings; use 5.008004; use Alien::Build::Plugin; +use Capture::Tiny qw( capture_merged ); use Carp (); # ABSTRACT: Probe system and determine library or tool properties using the pkg-config command line interface @@ -44,18 +45,31 @@ has '+pkg_name' => sub { # NOT used, for compat with other PkgConfig plugins has register_prereqs => 1; +sub _supports_static { + my($bin) = @_; + # Some very old pkg-config implementations (e.g. the one still + # found on some Solaris installs) predate the --static flag + # entirely, and this plugin relies on it to gather the + # {libs,cflags}_static properties. + my $help = capture_merged { system $bin, '--help' }; + return $help =~ /--static\b/ ? 1 : 0; +} + sub _bin_name { # We prefer pkgconf to pkg-config because it seems to be the future. require File::Which; - File::Which::which($ENV{PKG_CONFIG}) - ? $ENV{PKG_CONFIG} - : File::Which::which('pkgconf') - ? 'pkgconf' - : File::Which::which('pkg-config') - ? 'pkg-config' - : undef; + + foreach my $bin ($ENV{PKG_CONFIG}, 'pkgconf', 'pkg-config') + { + next unless $bin; + next unless File::Which::which($bin); + next unless _supports_static($bin); + return $bin; + } + + undef; }; has bin_name => \&_bin_name; From 635bc72cf731e225f1242ca91aecf628e9c0873b Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Fri, 18 Sep 2026 11:33:02 -0500 Subject: [PATCH 3/5] update mock tests to work around _supports_static --- t/alien_build_plugin_pkgconfig_commandline.t | 9 +++++++++ t/alien_build_plugin_pkgconfig_negotiate__pick.t | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/t/alien_build_plugin_pkgconfig_commandline.t b/t/alien_build_plugin_pkgconfig_commandline.t index 55aab1d1..40081bb1 100644 --- a/t/alien_build_plugin_pkgconfig_commandline.t +++ b/t/alien_build_plugin_pkgconfig_commandline.t @@ -43,6 +43,15 @@ subtest 'available' => sub { ], ); + # these tests are about the which()-based negotiation logic, not + # about whether the (fake, non-existent) binaries actually support + # --static, so pretend they all do. + my $mock_static = mock 'Alien::Build::Plugin::PkgConfig::CommandLine' => ( + override => [ + _supports_static => sub { 1 }, + ], + ); + subtest 'no command line' => sub { %which = (); diff --git a/t/alien_build_plugin_pkgconfig_negotiate__pick.t b/t/alien_build_plugin_pkgconfig_negotiate__pick.t index 98620145..06306a33 100644 --- a/t/alien_build_plugin_pkgconfig_negotiate__pick.t +++ b/t/alien_build_plugin_pkgconfig_negotiate__pick.t @@ -88,6 +88,15 @@ subtest 'CommandLine' => sub { ], ); + # these tests are about the which()-based negotiation logic, not + # about whether the (fake, non-existent) binaries actually support + # --static, so pretend they all do. + my $mock_static = mock 'Alien::Build::Plugin::PkgConfig::CommandLine' => ( + override => [ + _supports_static => sub { 1 }, + ], + ); + my $mock2 = mock 'Alien::Build::Plugin::PkgConfig::Negotiate'; if($^O =~ /^(solaris|MSWin32)$/) { From bdc2f2712a10e1cfdb2bb616a71f89f65b885dc7 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Fri, 18 Sep 2026 11:38:45 -0500 Subject: [PATCH 4/5] update Changes --- Changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changes b/Changes index 047cb12d..27ed460d 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for {{$dist->name}} {{$NEXT}} + - Fixes for Solaris (gh#442) + - Added checklib_args2 method to Alien::Build::Wrapper (gh#440) 2.87 2026-09-11 20:31:38 -0600 - Alien::Base::Wrapper->mm_args2 no longer overwrites a caller-specified From 205b65e697ee7355e61b1dc39de18e0358b47f50 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Fri, 18 Sep 2026 12:04:54 -0500 Subject: [PATCH 5/5] handle Solaris 32 bit --- lib/Alien/Build/Plugin/Core/Setup.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alien/Build/Plugin/Core/Setup.pm b/lib/Alien/Build/Plugin/Core/Setup.pm index 8da14754..26f5acde 100644 --- a/lib/Alien/Build/Plugin/Core/Setup.pm +++ b/lib/Alien/Build/Plugin/Core/Setup.pm @@ -213,7 +213,7 @@ sub _cpu_arch { | \b i386 \b # freebsd-i386 | \b i486 \b # i486-linux | \b i686 \b # i686-cygwin - | \b i86pc.*64 \b # i86pc-solaris-thread-multi-64 + | \b i86pc \b # i86pc-solaris, i86pc-solaris-thread-multi-64 /ix ) { $arch = { name => 'x86' }; } elsif( $Config{archname} =~ m/