add the glue to generate future libset, which are currently 100% unused
authorespie <espie@openbsd.org>
Wed, 24 Jan 2018 16:52:44 +0000 (16:52 +0000)
committerespie <espie@openbsd.org>
Wed, 24 Jan 2018 16:52:44 +0000 (16:52 +0000)
usr.sbin/pkg_add/OpenBSD/PackingElement.pm
usr.sbin/pkg_add/OpenBSD/PkgCreate.pm

index 3d632e8..4ce7be1 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.248 2018/01/01 14:02:37 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.249 2018/01/24 16:52:44 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -1097,6 +1097,22 @@ sub category() { "libset" }
 sub keyword() { "libset" }
 __PACKAGE__->register_with_factory;
 
+sub new
+{
+       my ($class, $args) = @_;
+       if ($args =~ m/(.*)\:(.*)/) {
+               return bless {name => $1, libs => [split(/\,/, $2)]}, $class;
+       } else {
+               die "Bad args for libset: $args";
+       }
+}
+
+sub stringize
+{
+       my $self = shift;
+       return $self->{name}.':'.join(',', @{$self->{libs}});
+}
+
 package OpenBSD::PackingElement::PkgPath;
 our @ISA=qw(OpenBSD::PackingElement::Meta);
 
index 9dbd714..c01a70d 100644 (file)
@@ -1,6 +1,6 @@
 #! /usr/bin/perl
 # ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.130 2018/01/05 13:39:55 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.131 2018/01/24 16:52:45 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -103,16 +103,20 @@ sub handle_options
                            }
                            $state->{system_version} += $d;
                    },
+           'w' => sub {
+                           my $w = shift;
+                           $state->{libset}{$w} = 1;
+                   },
            'W' => sub {
                            my $w = shift;
                            $state->{wantlib}{$w} = 1;
                    },
        };
        $state->{no_exports} = 1;
-       $state->SUPER::handle_options('p:f:d:M:U:A:B:P:V:W:qQS',
+       $state->SUPER::handle_options('p:f:d:M:U:A:B:P:V:w:W:qQS',
            '[-nQqvSx] [-A arches] [-B pkg-destdir] [-D name[=value]]',
            '[-L localbase] [-M displayfile] [-P pkg-dependency]',
-           '[-U undisplayfile] [-V n] [-W wantedlib]',
+           '[-U undisplayfile] [-V n] [-W wantedlib] [-w libset]',
            '[-d desc -D COMMENT=value -f packinglist -p prefix]',
            'pkg-name');
 
@@ -810,7 +814,7 @@ sub solve_wantlibs
        my $okay = 1;
        my $lib_finder = OpenBSD::lookup::library->new($solver);
        my $h = $solver->{set}->{new}[0];
-       for my $lib (@{$h->{plist}->{wantlib}}) {
+       for my $lib (@{$h->{plist}{wantlib}}) {
                $solver->{localbase} = $h->{plist}->localbase;
                next if $lib_finder->lookup($solver,
                    $solver->{to_register}->{$h}, $state,
@@ -1191,6 +1195,9 @@ sub add_elements
        for my $w (sort keys %{$state->{wantlib}}) {
                OpenBSD::PackingElement::Wantlib->add($plist, $w);
        }
+       for my $w (sort keys %{$state->{libset}}) {
+               OpenBSD::PackingElement::Libset->add($plist, $w);
+       }
 
        if (defined $state->opt('A')) {
                OpenBSD::PackingElement::Arch->add($plist, $state->opt('A'));