arch: Restrict solaris ports to amd64, i386, sparc and sparc64
[dpkg.git] / scripts / dpkg-buildapi.pl
blob72d32629a60ca5f86fcf6edd959de5c0098888e0
1 #!/usr/bin/perl
3 # dpkg-buildapi
5 # Copyright © 2022 Guillem Jover <guillem@debian.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 use warnings;
21 use strict;
23 use Dpkg ();
24 use Dpkg::Gettext;
25 use Dpkg::ErrorHandling;
26 use Dpkg::BuildAPI qw(get_build_api);
27 use Dpkg::Control::Info;
29 textdomain('dpkg-dev');
31 sub version()
33 printf(g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
36 sub usage()
38 printf(g_("Usage: %s [<option>...]\n"), $Dpkg::PROGNAME);
40 print(g_('
41 Options:
42 -c<control-file> get control info from this file.
43 -?, --help show this help message.
44 -v, --version show the version.
45 '));
48 my $controlfile = 'debian/control';
50 while (@ARGV) {
51 $_ = shift(@ARGV);
52 if (m/^-\?|--help$/) {
53 usage();
54 exit 0;
55 } elsif (m/^-v|--version$/) {
56 version();
57 exit 0;
58 } elsif (m/-c(.*)$/) {
59 $controlfile = $1;
60 } elsif (m/^--$/) {
61 last;
62 } elsif (m/^-/) {
63 usageerr(g_("unknown option '%s'"), $_);
64 } else {
65 usageerr(g_('no arguments accepted'));
69 my $ctrl = Dpkg::Control::Info->new($controlfile);
71 print get_build_api($ctrl) . "\n";