On Mon, Mar 21, 2016 at 07:09:52PM +0000, Nigel Taylor wrote:
>
> Should portgen be updated?
>
> Perl ports should have normally a PKG_ARCH = * added to the Makefile.
> When perl uses C or other languages PKG_ARCH = * should not be present,
> a WANTLIB += perl should.
>
> To find which either read MANIFEST if files listed end in .xs excluding
> those under t/ xt/ inc/ or search for files using find
>
> $ find `make show=WRKSRC`/!(inc|t|xt) -name "*.xs"
> /usr/ports/pobj/p5-Cpanel-JSON-XS-3.0213/Cpanel-JSON-XS-3.0213/XS.xs
>
> So this port should not have PKG_ARCH = *
> needs a WANTLIB += perl in the Makefile, as a .xs file is present.
>
>
This diff syncs portgen with the recent changes in perl ports. OK?
Index: Port.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Port.pm
--- Port.pm 18 Jan 2016 18:08:19 -0000 1.1.1.1
+++ Port.pm 25 Mar 2016 22:54:38 -0000
@@ -222,6 +222,7 @@ sub write_makefile
$other_stuff =~ s/^#//;
$other_stuff =~ s/(\?\?\?|$)/$value\n/;
+ # handle cases where replacing '???' isn't enough
if ( $other_stuff =~ /^PERMIT_PACKAGE_CDROM/ ) {
$output .= "# $self->{license}\n";
} elsif ( $other_stuff =~ /_DEPENDS/ ) {
@@ -229,6 +230,8 @@ sub write_makefile
} elsif ( $other_stuff =~ /^COMMENT/ ) {
$output .= "# original: $self->{full_comment}\n"
if $self->{full_comment};
+ } elsif ( $other_stuff =~ /^WANTLIB/ ) {
+ $other_stuff =~ s/=/+=/;
}
$output .= $other_stuff;
Index: Port/CPAN.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/CPAN.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 CPAN.pm
--- Port/CPAN.pm 18 Jan 2016 18:08:20 -0000 1.1.1.1
+++ Port/CPAN.pm 25 Mar 2016 22:54:38 -0000
@@ -205,6 +205,13 @@ sub postextract
$self->set_descr( $self->read_descr($wrksrc) || $di->{abstract} );
$self->_find_hidden_test_deps($wrksrc);
+
+ if ( $self->_uses_xs($wrksrc) ) {
+ $self->set_other( 'WANTLIB', 'perl' );
+ }
+ else {
+ $self->set_other( 'PKG_ARCH', '*' );
+ }
}
sub try_building
@@ -266,6 +273,22 @@ sub _test_skips
return;
}
}
+}
+
+sub _uses_xs
+{
+ my ( $self, $dir ) = @_;
+ my $found_xs = 0;
+
+ find( sub {
+ if ( -d && /^(inc|t|xt)$/ ) {
+ $File::Find::prune = 1;
+ return;
+ }
+ $found_xs = 1 if -f && /\.xs$/;
+ }, $dir );
+
+ return $found_xs;
}
1;