From 9675584c3afb9b7630c198ece4189806a550d472 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Wed, 8 Oct 2008 22:49:48 +0200 Subject: [PATCH] Change configure scripts to modules --- free/libs/configure | 11 ++++++----- free/libs/examples/internal/configure | 11 ++++++----- ucw/perl/UCW/Configure.pm | 12 +++++++++--- ucw/{autoconf.cfg => perl/UCW/Configure/Autoconf.pm} | 3 +++ ucw/{paths.cfg => perl/UCW/Configure/Paths.pm} | 7 +++++-- ucw/{ucw.cfg => perl/UCW/Configure/UCW.pm} | 5 +++++ 6 files changed, 34 insertions(+), 15 deletions(-) rename ucw/{autoconf.cfg => perl/UCW/Configure/Autoconf.pm} (99%) rename ucw/{paths.cfg => perl/UCW/Configure/Paths.pm} (92%) rename ucw/{ucw.cfg => perl/UCW/Configure/UCW.pm} (96%) diff --git a/free/libs/configure b/free/libs/configure index 6728ce20..f0f701e0 100755 --- a/free/libs/configure +++ b/free/libs/configure @@ -17,17 +17,18 @@ BEGIN { die "Don't know how to find myself. Please set SRCDIR manually."; } } - require "$srcdir/ucw/perl/UCW/Configure.pm"; - UCW::Configure::import UCW::Configure; } +use lib "$srcdir/ucw/perl/"; +use UCW::Configure; + Init($srcdir, "default.cfg"); Include "ucw/default.cfg"; Log "### Configuring Sherlock Libraries " . Get("SHERLOCK_VERSION") . " with configuration " . Get("CONFIG") . "\n"; Include Get("CONFIG"); -Include "ucw/paths.cfg"; -Include "ucw/autoconf.cfg"; -Include "ucw/ucw.cfg"; +require UCW::Configure::Paths; +require UCW::Configure::Autoconf; +require UCW::Configure::UCW; Finish(); Log "\nConfigured, run `make' to build everything.\n"; diff --git a/free/libs/examples/internal/configure b/free/libs/examples/internal/configure index 6f4a678d..3196cbe0 100755 --- a/free/libs/examples/internal/configure +++ b/free/libs/examples/internal/configure @@ -17,17 +17,18 @@ BEGIN { die "Don't know how to find myself. Please set SRCDIR manually."; } } - require "$srcdir/ucw/perl/UCW/Configure.pm"; - UCW::Configure::import UCW::Configure; } +use lib "$srcdir/ucw/perl/"; +use UCW::Configure; + Init($srcdir, "default.cfg"); Include "ucw/default.cfg"; Log "### Configuring TestApp ###\n\n"; Include Get("CONFIG"); -Include "ucw/paths.cfg"; -Include "ucw/autoconf.cfg"; -Include "ucw/ucw.cfg"; +require UCW::Configure::Paths; +require UCW::Configure::Autoconf; +require UCW::Configure::UCW; Finish(); Log "\nConfigured, run `make' to build everything.\n"; diff --git a/ucw/perl/UCW/Configure.pm b/ucw/perl/UCW/Configure.pm index e0f501d7..a776d1d0 100644 --- a/ucw/perl/UCW/Configure.pm +++ b/ucw/perl/UCW/Configure.pm @@ -16,13 +16,18 @@ BEGIN { our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.0; @ISA = qw(Exporter); - @EXPORT = qw(&Init &Log &Notice &Warn &Fail &IsSet &IsGiven &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile &TryCmd &PkgConfig &TrivConfig); + @EXPORT = qw(&Init &Log &Notice &Warn &Fail &IsSet &IsGiven &Set &UnSet &Append &Override &Get &Test &Include &Finish &FindFile &TryFindFile &TryCmd &PkgConfig &TrivConfig &debPrint); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } -our %vars = (); -our %overriden = (); +our %vars; +our %overriden; + +sub debPrint() { + print "VARS:\n"; +# print "$_: $vars{$_}\n" foreach( keys %vars ); +} sub Log($) { print @_; @@ -107,6 +112,7 @@ sub FindFile($) { } sub Init($$) { + print "YYY\n"; my ($srcdir,$defconfig) = @_; sub usage($) { my ($dc) = @_; diff --git a/ucw/autoconf.cfg b/ucw/perl/UCW/Configure/Autoconf.pm similarity index 99% rename from ucw/autoconf.cfg rename to ucw/perl/UCW/Configure/Autoconf.pm index b28be834..6d916197 100644 --- a/ucw/autoconf.cfg +++ b/ucw/perl/UCW/Configure/Autoconf.pm @@ -5,6 +5,9 @@ ### OS ### +package UCW::Configure::Autoconf; +use UCW::Configure; + Test("OS", "Checking on which OS we run", sub { my $os = `uname`; chomp $os; diff --git a/ucw/paths.cfg b/ucw/perl/UCW/Configure/Paths.pm similarity index 92% rename from ucw/paths.cfg rename to ucw/perl/UCW/Configure/Paths.pm index 199401d6..b00300d2 100644 --- a/ucw/paths.cfg +++ b/ucw/perl/UCW/Configure/Paths.pm @@ -4,9 +4,12 @@ # (c) 2005--2008 Martin Mares # (c) 2006 Robert Spalek +package UCW::Configure::Paths; +use UCW::Configure; + Log "Determining installation prefix ... "; if (IsSet("CONFIG_LOCAL")) { - Log "local build\n"; + Log("local build\n"); Set("INSTALL_PREFIX", ""); Set("INSTALL_USR_PREFIX", ""); Set("INSTALL_VAR_PREFIX", ""); @@ -19,7 +22,7 @@ if (IsSet("CONFIG_LOCAL")) { Set("INSTALL_USR_PREFIX", $upx); $upx =~ s{^/usr\b}{/var}; Set("INSTALL_VAR_PREFIX", $upx); - Log Get("PREFIX") . "\n"; + Log(Get("PREFIX") . "\n"); } Set("INSTALL_CONFIG_DIR", '$(INSTALL_PREFIX)$(CONFIG_DIR)'); diff --git a/ucw/ucw.cfg b/ucw/perl/UCW/Configure/UCW.pm similarity index 96% rename from ucw/ucw.cfg rename to ucw/perl/UCW/Configure/UCW.pm index c79844be..6c7dc62d 100644 --- a/ucw/ucw.cfg +++ b/ucw/perl/UCW/Configure/UCW.pm @@ -4,6 +4,9 @@ # (c) 2005--2008 Martin Mares # (c) 2006 Robert Spalek +package UCW::Configure::UCW; +use UCW::Configure; + # Determine page size Test("CPU_PAGE_SIZE", "Determining page size", sub { my $p; @@ -44,3 +47,5 @@ if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) { # Remember PKG_CONFIG_PATH used for building, so that it will be propagated to # pkg-config's run locally in the makefiles. Set("PKG_CONFIG_PATH", $ENV{"PKG_CONFIG_PATH"}) if defined $ENV{"PKG_CONFIG_PATH"}; + +1; -- 2.39.2