summaryrefslogtreecommitdiff
path: root/getoptflags
diff options
context:
space:
mode:
authorMichael Schröder <mls@suse.de>2006-06-06 10:52:55 +0000
committerMichael Schröder <mls@suse.de>2006-06-06 10:52:55 +0000
commit83b7bc9b2fb1db5b950f9da5b011d3c664286599 (patch)
treee7a477c03aef94880755fc15903eaefa28a6f3d6 /getoptflags
parent77cb8e110c0e530e1fb90e6fb04fdb41178ff2ae (diff)
downloadbuild-83b7bc9b2fb1db5b950f9da5b011d3c664286599.tar.gz
build-83b7bc9b2fb1db5b950f9da5b011d3c664286599.tar.bz2
build-83b7bc9b2fb1db5b950f9da5b011d3c664286599.zip
update to current version
Diffstat (limited to 'getoptflags')
-rwxr-xr-xgetoptflags60
1 files changed, 60 insertions, 0 deletions
diff --git a/getoptflags b/getoptflags
new file mode 100755
index 0000000..abcc5a1
--- /dev/null
+++ b/getoptflags
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+}
+
+use strict;
+
+use Build;
+
+my ($dist, $archs, $configdir);
+
+while (@ARGV) {
+ if ($ARGV[0] eq '--dist') {
+ shift @ARGV;
+ $dist = shift @ARGV;
+ next;
+ }
+ if ($ARGV[0] eq '--archpath') {
+ shift @ARGV;
+ $archs = shift @ARGV;
+ next;
+ }
+ if ($ARGV[0] eq '--configdir') {
+ shift @ARGV;
+ $configdir = shift @ARGV;
+ next;
+ }
+ last;
+}
+$configdir = '.' unless defined $configdir;
+$archs = '' unless defined $archs;
+$dist = '' unless defined $dist;
+
+die("Usage: getoptflags --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if !defined($dist) || @ARGV;
+
+my @archs = split(':', $archs);
+push @archs, 'noarch' unless grep {$_ eq 'noarch'} @archs;
+
+my $cf;
+if ($dist =~ /\//) {
+ die("$dist: $!\n") unless -e $dist;
+ $cf = Build::read_config($archs[0], $dist);
+} else {
+ $dist =~ s/-.*//;
+ $dist = "sl$dist" if $dist =~ /^\d/;
+ $cf = Build::read_config($archs[0], "$configdir/$dist.conf");
+ if (!$cf) {
+ $cf = Build::read_config($archs[0], "$configdir/default.conf");
+ }
+}
+die("config not found\n") unless $cf;
+
+exit 0 unless $cf->{'optflags'};
+my $all = $cf->{'optflags'}->{'*'};
+$all = defined($all) && $all ne '' ? " $all" : '';
+for (sort keys %{$cf->{'optflags'}}) {
+ next if $_ eq '*';
+ print "optflags: $_ $cf->{'optflags'}->{$_}$all\n";
+}