openbsd-ports/infrastructure/bin/modgo-gen-modules-helper
sthen c98f24d215 add a comment on the MODGO_VERSION line output by "make modgo-gen-modules"
that it shouldn't go into modules.inc; low-tech approach but hopefully
people will notice it if they read their diff before sending it out ;)
tb@ thinks it would help too.
2022-12-29 23:45:12 +00:00

50 lines
1.7 KiB
Perl

#!/usr/bin/perl
# $OpenBSD: modgo-gen-modules-helper,v 1.4 2022/12/29 23:45:12 sthen Exp $
#
# Copyright (c) 2020 Paco Esteban <paco@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use 5.012;
use strict;
use warnings;
my ($portdir);
use FindBin;
BEGIN {
$portdir = $ENV{PORTSDIR} || '/usr/ports';
}
use lib ( "$portdir/infrastructure/lib", "$FindBin::Bin/../lib" );
use OpenBSD::PortGen::Port::Go;
die if @ARGV < 1;
my $module = shift;
if (@ARGV == 1) {
$module .= '@'. shift;
}
my $port = OpenBSD::PortGen::Port::Go->new;
my $portinfo = $port->get_dist_info($module);
$port->set_other( MODGO_MODULES => "\\\n" . join(" \\\n", @{$portinfo->{Dist}})) if $portinfo->{Dist};
$port->set_other( MODGO_MODFILES => "\\\n" . join(" \\\n", @{$portinfo->{Mods}})) if $portinfo->{Mods};
say "MODGO_VERSION =\t$portinfo->{Version} # add this to Makefile, not modules.inc\n";
say "MODGO_MODULES =\t$port->{'MODGO_MODULES'}\n" if defined($port->{'MODGO_MODULES'});
say "MODGO_MODFILES =\t$port->{'MODGO_MODFILES'}\n" if defined($port->{'MODGO_MODFILES'});