Change to config.pl processing in the msvc build environment

Started by Magnus Haganderabout 16 years ago7 messages
#1Magnus Hagander
magnus@hagander.net
1 attachment(s)

I'd like to apply the attached patch to the msvc build environment,
which changes how config.pl is handled. (For the unenlightened, this
is the replacement stuff we have for autoconf)

Today, there is one config.pl. We ship it with a couple of defaults
(which points to a very old installation of mine, really, and probably
shouldn't have included those paths in the first place), and you are
supposed to edit this config.pl file in-place to change which 3rd
party libs etc you have.

This is pretty convenient for end-users building from source. Of which
we don't have many. And it's annoying for doing any development work
on it, because it shows up in your "git diff" or whatever, and you
can't ignore the file or you won't get new updates out.

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists. config.pl then lives completely outside the
source tree (should be in .cvsignore) and won't show up in any diffs
or anything.

It changes the format of the config.pl file (not the default one), so
that the user can now specify just one or two options, and doesn't hav
eto respecify all. So now you can have just:
$config->{zlib}='c:\zlib';

(or similar).

*If* you put in th place the old config.pl file, it will override
whatever is in the default file. Thus, I don't believe this would have
any effect on the buildfarm or the oneclick-installer build
environments.

Comments? Objectsions? Holes in the reasoning? :-)

(patch excludes the rename of config.pl to config.pl.default, for readability)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

Attachments:

msvc_config.patchapplication/octet-stream; name=msvc_config.patchDownload
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index c902376..7740e80 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -38,7 +38,8 @@ sub Install
 
     my $target = shift;
     our $config;
-    require 'config.pl';
+    require "config.pl.default";
+    require "config.pl" if (-f "config.pl");
 
     chdir("../../..") if (-f "../../../configure");
     chdir("../../../..") if (-f "../../../../configure");
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index 2654c86..a4becf0 100644
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -32,7 +32,8 @@ elsif (-e "./buildenv.pl" )
 
 # set up the project
 our $config;
-require "config.pl";
+require "config.pl.default";
+require "config.pl" if (-f "config.pl");
 
 Mkvcbuild::mkvcbuild($config);
 
diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl
index 4d495da..3f7d817 100644
--- a/src/tools/msvc/mkvcbuild.pl
+++ b/src/tools/msvc/mkvcbuild.pl
@@ -12,9 +12,11 @@ use Mkvcbuild;
 chdir('..\..\..') if (-d '..\msvc' && -d '..\..\..\src');
 die 'Must run from root or msvc directory' unless (-d 'src\tools\msvc' && -d 'src');
 
-die 'Could not find config.pl' unless (-f 'src/tools/msvc/config.pl');
+die 'Could not find config.pl.default' unless (-f 'src/tools/msvc/config.pl.default');
+print "Warning: no config.pl found, using default.\n" unless (-f 'src/tools/msvc/config.pl');
 
 our $config;
-require 'src/tools/msvc/config.pl';
+require 'src/tools/msvc/config.pl.default';
+require 'src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
 
 Mkvcbuild::mkvcbuild($config);
#2Alvaro Herrera
alvherre@commandprompt.com
In reply to: Magnus Hagander (#1)
Re: Change to config.pl processing in the msvc build environment

Magnus Hagander wrote:

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists. config.pl then lives completely outside the
source tree (should be in .cvsignore) and won't show up in any diffs
or anything.

I've used similar tricks elsewhere and find them pretty useful. The
patch looks reasonably sane to someone 101% unfamiliar with our MSVC
stuff (except that I'd get rid of the parentheses in the "do foo unless
-f $file" lines).

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#3Magnus Hagander
magnus@hagander.net
In reply to: Alvaro Herrera (#2)
Re: Change to config.pl processing in the msvc build environment

On Sat, Jan 2, 2010 at 02:20, Alvaro Herrera <alvherre@commandprompt.com> wrote:

Magnus Hagander wrote:

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists. config.pl then lives completely outside the
source tree (should be in .cvsignore) and won't show up in any diffs
or anything.

I've used similar tricks elsewhere and find them pretty useful.  The
patch looks reasonably sane to someone 101% unfamiliar with our MSVC
stuff (except that I'd get rid of the parentheses in the "do foo unless
-f $file" lines).

You now, that's what I had first. Then I changed it to add the
parentheses to make it look like a similar piece of code nearby,
written by somebody much more perly than I am. But now that I think of
it, it may well be me who wrote that code earlier as well, so that'd
no good excuse :-)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#1)
Re: Change to config.pl processing in the msvc build environment

On fre, 2010-01-01 at 16:32 +0100, Magnus Hagander wrote:

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists.

I'd keep the naming so that the extension .pl is preserved. Helps
editors and such.

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#4)
Re: Change to config.pl processing in the msvc build environment

Peter Eisentraut wrote:

On fre, 2010-01-01 at 16:32 +0100, Magnus Hagander wrote:

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists.

I'd keep the naming so that the extension .pl is preserved. Helps
editors and such.

Right ... let's call it "default_config.pl" or some such. Otherwise it
looks sane enough. I don't think the "parens on trailing conditions"
issue is anything other than just a matter of taste. I often use them
because I've occasionally been caught by not doing so.

cheers

andrew

#6Alvaro Herrera
alvherre@commandprompt.com
In reply to: Andrew Dunstan (#5)
Re: Change to config.pl processing in the msvc build environment

Andrew Dunstan wrote:

I don't think the "parens on trailing conditions" issue is anything
other than just a matter of taste.

Agreed

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#7Magnus Hagander
magnus@hagander.net
In reply to: Andrew Dunstan (#5)
Re: Change to config.pl processing in the msvc build environment

On Sun, Jan 3, 2010 at 05:13, Andrew Dunstan <andrew@dunslane.net> wrote:

Peter Eisentraut wrote:

On fre, 2010-01-01 at 16:32 +0100, Magnus Hagander wrote:

I therefor propose that we rename this file to "config.pl.default",
and change the scripts to first load config.pl.default, and then load
config.pl if it exists.

I'd keep the naming so that the extension .pl is preserved.  Helps
editors and such.

Right ... let's call it "default_config.pl" or some such. Otherwise it looks
sane enough. I don't think the "parens on trailing conditions" issue is
anything other than just a matter of taste. I often use them because I've
occasionally been caught by not doing so.

Ok, I've applied this patch with the name change to config_default.pl
(that way it still sorts next to config.pl etc, which was how Dave
convinced me of the config.pl.default name in the first place :D)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/