I'm not a big user of it myself, so please test. Two improvements: - stop CPAN::Meta::Requirements from complaining, by explicitly passing it 0 for undefined requirements (e.g., any version). (alternately, we could inherit from CPAN::Meta::Requirements and override _blank_carp to NOT do anything)
- allow passing of -f VAR=value options through to make, the main intended usage being "portgen -f FETCH_PACKAGES= ..." to avoid rebuilding known dependencies. Index: bin/portgen =================================================================== RCS file: /cvs/ports/infrastructure/bin/portgen,v retrieving revision 1.4 diff -u -p -r1.4 portgen --- bin/portgen 2 Jul 2020 21:07:51 -0000 1.4 +++ bin/portgen 4 Jan 2022 17:29:59 -0000 @@ -28,6 +28,16 @@ BEGIN { } use lib ( "$portdir/infrastructure/lib", "$FindBin::Bin/../lib" ); +use OpenBSD::Getopt; + +my @opt_m; +getopts('m:', + { + 'm' => + sub { + push(@opt_m, shift); + } + }); my ( $type, $module ) = @ARGV; @@ -57,6 +67,10 @@ sub portgen_class } my $o = portgen_class($type)->new; + +if (@opt_m) { + $o->add_make_options(@opt_m); +} my @new_ports = $o->port($module); say for @new_ports; Index: lib/OpenBSD/PortGen/Dependency.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Dependency.pm,v retrieving revision 1.4 diff -u -p -r1.4 Dependency.pm --- lib/OpenBSD/PortGen/Dependency.pm 16 May 2020 21:44:23 -0000 1.4 +++ lib/OpenBSD/PortGen/Dependency.pm 4 Jan 2022 17:29:59 -0000 @@ -53,7 +53,8 @@ sub _add_dep { my ( $self, $type, $port, $reqs ) = @_; - $self->{deps}{$type} ||= CPAN::Meta::Requirements->new; + $self->{deps}{$type} //= CPAN::Meta::Requirements->new; + $reqs //= 0; # any version will do $self->{deps}{$type}->add_string_requirement( $port => $reqs ); } Index: lib/OpenBSD/PortGen/Port.pm =================================================================== RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port.pm,v retrieving revision 1.21 diff -u -p -r1.21 Port.pm --- lib/OpenBSD/PortGen/Port.pm 13 Jun 2021 18:30:50 -0000 1.21 +++ lib/OpenBSD/PortGen/Port.pm 4 Jan 2022 17:29:59 -0000 @@ -36,6 +36,14 @@ use OpenBSD::PortGen::Utils qw( ports_dir ); +my @make_options; + +sub add_make_options +{ + my $self = shift; + push(@make_options, @_); +} + sub _cp { my (@args) = @_; system('/bin/cp', @args) == 0; @@ -471,7 +479,7 @@ sub _format_comment sub _make { my $self = shift; - system( 'make', @_ ); + system( 'make', @_, @make_options); return $? >> 8; }