From 7d38b11b4908c9052151be2c4e54b8510c212b9f Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 12 Apr 2005 14:36:54 +0000 Subject: [PATCH] More pieces of new configure. --- build/sherlock.cfg | 4 ++-- lib/perl/Configure.pm | 45 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/build/sherlock.cfg b/build/sherlock.cfg index a94eb57d..abdeb4ae 100644 --- a/build/sherlock.cfg +++ b/build/sherlock.cfg @@ -72,7 +72,7 @@ Set("CONFIG_MAX_CONTEXTS" => 256); Set("CONFIG_32BIT_REFERENCES"); # Debugging tools -Set("CONFIG_DEBUG"); +UnSet("CONFIG_DEBUG"); # Search server: Enable EXPLAIN command (slows searching down slightly) Set("CONFIG_EXPLAIN"); @@ -122,7 +122,7 @@ UnSet("CONFIG_UFAL_DICT_SK"); UnSet("CONFIG_PL_STEMMER"); # Dynamic weights -Set("CONFIG_WEIGHTS"); +UnSet("CONFIG_WEIGHTS"); #endif diff --git a/lib/perl/Configure.pm b/lib/perl/Configure.pm index bbc6e82c..6900dbe3 100644 --- a/lib/perl/Configure.pm +++ b/lib/perl/Configure.pm @@ -16,7 +16,7 @@ BEGIN { our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.0; @ISA = qw(Exporter); - @EXPORT = qw(&Init &Log &Fail &IsSet &Set &UnSet &Override &Get &Test &Include); + @EXPORT = qw(&Init &Log &Fail &IsSet &Set &UnSet &Override &Get &Test &Include &Finish &FindFile &TryFindFile); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } @@ -129,4 +129,47 @@ sub Include($) { require $f; } +sub Finish() { + print "\n"; + + if (Get("SRCDIR") ne ".") { + Log "Preparing for compilation from directory " . Get("SRCDIR") . " to obj/ ... "; + -l "src" and unlink "src"; + symlink Get("SRCDIR"), "src" or Fail "Cannot link source directory to src: $!"; + Override("SRCDIR" => "src"); + -l "Makefile" and unlink "Makefile"; + -f "Makefile" and Fail "Makefile already exists"; + symlink "src/Makefile", "Makefile" or Fail "Cannot link Makefile: $!"; + } else { + Log "Preparing for compilation from current directory to obj/ ... "; + } + `rm -rf obj` if -d "obj"; Fail "Cannot delete old obj directory" if $?; + -d "obj" or mkdir("obj", 0777) or Fail "Cannot create obj directory: $!"; + -d "obj/lib" or mkdir("obj/lib", 0777) or Fail "Cannot create obj/lib directory: $!"; + Log "done\n"; + + Log "Generating autoconf.h... "; + open X, ">obj/lib/autoconf.h" or Fail $!; + print X "/* Generated automatically by $0, please don't touch manually. */\n"; + foreach my $x (sort keys %vars) { + # Don't export variables which contain no underscores + next unless $x =~ /_/; + my $v = $vars{$x}; + # Try to add quotes if necessary + $v = '"' . $v . '"' unless ($v =~ /^"/ || $v =~ /^\d*$/); + print X "#define $x $v\n"; + } + close X; + Log "done\n"; + + Log "Generating config.mk... "; + open X, ">obj/config.mk" or Fail $!; + print X "# Generated automatically by $0, please don't touch manually.\n"; + foreach my $x (sort keys %vars) { + print X "$x=$vars{$x}\n"; + } + close X; + Log "done\n"; +} + 1; # OK -- 2.39.2