Thread: Re: buildenv.pl/buildenv.bat

Re: buildenv.pl/buildenv.bat

From
Andrew Dunstan
Date:

Magnus Hagander wrote:
>>
>> You seem to have misunderstood what I am suggesting. Of course we should
>> document use of buildenv.pl in addition to the hacky fix to the .bat
>> files. The hack is the part that would be invisible. The docs would be
>> visible and contain what would be our ongoing practice.
>>
>
> Correct, I was misunderstanding it :-)
>
> I still can't say I like that hack though. I'd rather document that you
> have to do it in the .bat file for docs + gui build.
>
> But it's better than what I thought you were proposing :-)
>
>
>

Well, I honestly think we can live with it for one cycle. As soon as 8.4
opens I'll get to work converting these .bat files to pure one line
wrappers.

Meanwhile, here's the proposed patch. If you want something else you'll
have to do it.

I don't know how many people regularly build on Windows other than you,
me and Dave.

cheers

andrew
Index: doc/src/sgml/install-win32.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v
retrieving revision 1.42
diff -c -r1.42 install-win32.sgml
*** doc/src/sgml/install-win32.sgml    28 Nov 2007 15:42:31 -0000    1.42
--- doc/src/sgml/install-win32.sgml    9 Dec 2007 19:31:36 -0000
***************
*** 58,69 ****
    Before you build, edit the file <filename>config.pl</filename> to reflect the
    configuration options you want set, including the paths to libraries used.
    If you need to set any other environment variables, create a file called
!   <filename>buildenv.bat</filename> and put the required commands there. For
    example, to add the path for bison when it's not in the PATH, create a file
    containing:
    <screen>
!    @ECHO OFF
!    SET PATH=%PATH%;c:\some\where\bison\bin
    </screen>
   </para>

--- 58,68 ----
    Before you build, edit the file <filename>config.pl</filename> to reflect the
    configuration options you want set, including the paths to libraries used.
    If you need to set any other environment variables, create a file called
!   <filename>buildenv.pl</filename> and put the required commands there. For
    example, to add the path for bison when it's not in the PATH, create a file
    containing:
    <screen>
!    $ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin';
    </screen>
   </para>

***************
*** 209,218 ****
      </userinput>
     </screen>
     To change the default build configuration to debug, put the following
!    in the <filename>buildenv.bat</filename> file:
     <screen>
      <userinput>
!      set CONFIG=Debug
      </userinput>
     </screen>
    </para>
--- 208,217 ----
      </userinput>
     </screen>
     To change the default build configuration to debug, put the following
!    in the <filename>buildenv.pl</filename> file:
     <screen>
      <userinput>
!      $ENV{CONFIG}="Debug";
      </userinput>
     </screen>
    </para>
***************
*** 263,269 ****
     required parts first. Also, make sure that the DLLs required to load all
     parts of the system (such as the Perl and Python DLLs for the procedural
     languages) are present in the system path. If they are not, set it through
!    the <filename>buildenv.bat</filename> file. To run the tests, run one of
     the following commands from the <filename>src\tools\msvc</filename>
     directory:
     <screen>
--- 262,268 ----
     required parts first. Also, make sure that the DLLs required to load all
     parts of the system (such as the Perl and Python DLLs for the procedural
     languages) are present in the system path. If they are not, set it through
!    the <filename>buildenv.pl</filename> file. To run the tests, run one of
     the following commands from the <filename>src\tools\msvc</filename>
     directory:
     <screen>
***************
*** 339,349 ****
       </para></listitem>
      </varlistentry>
     </variablelist>
!    Edit the <filename>buildenv.bat</filename> file, and add a variable for the
     location of the root directory, for example:
     <screen>
!     @ECHO OFF
!     SET DOCROOT=c:\docbook
     </screen>
     To build the documentation, run the command
     <filename>builddoc.bat</filename>. Note that this will actually run the
--- 338,347 ----
       </para></listitem>
      </varlistentry>
     </variablelist>
!    Edit the <filename>buildenv.pl</filename> file, and add a variable for the
     location of the root directory, for example:
     <screen>
!     $ENV{DOCROOT}='c:\docbook';
     </screen>
     To build the documentation, run the command
     <filename>builddoc.bat</filename>. Note that this will actually run the
Index: src/tools/msvc/builddoc.bat
===================================================================
RCS file: /cvsroot/pgsql/src/tools/msvc/builddoc.bat,v
retrieving revision 1.5
diff -c -r1.5 builddoc.bat
*** src/tools/msvc/builddoc.bat    17 Mar 2007 14:01:01 -0000    1.5
--- src/tools/msvc/builddoc.bat    9 Dec 2007 19:31:36 -0000
***************
*** 1,5 ****
  @echo off
! REM Adjust path for your docbook installation in buildenv.bat

  REM $PostgreSQL: pgsql/src/tools/msvc/builddoc.bat,v 1.5 2007/03/17 14:01:01 mha Exp $

--- 1,5 ----
  @echo off
! REM Adjust path for your docbook installation in buildenv.pl

  REM $PostgreSQL: pgsql/src/tools/msvc/builddoc.bat,v 1.5 2007/03/17 14:01:01 mha Exp $

***************
*** 10,16 ****

  IF EXIST ..\msvc IF EXIST ..\..\..\src cd ..\..\..
  IF NOT EXIST doc\src\sgml\version.sgml goto noversion
! IF EXIST src\tools\msvc\buildenv.bat CALL src\tools\msvc\buildenv.bat

  IF NOT EXIST %DOCROOT%\%OPENJADE% SET NF=OpenJade
  IF NOT EXIST %DOCROOT%\docbook SET NF=docbook
--- 10,21 ----

  IF EXIST ..\msvc IF EXIST ..\..\..\src cd ..\..\..
  IF NOT EXIST doc\src\sgml\version.sgml goto noversion
!
! IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
! perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
! CALL bldenv.bat
! del bldenv.bat
! :nobuildenv

  IF NOT EXIST %DOCROOT%\%OPENJADE% SET NF=OpenJade
  IF NOT EXIST %DOCROOT%\docbook SET NF=docbook
Index: src/tools/msvc/install.bat
===================================================================
RCS file: /cvsroot/pgsql/src/tools/msvc/install.bat,v
retrieving revision 1.2
diff -c -r1.2 install.bat
*** src/tools/msvc/install.bat    26 Jun 2007 11:43:56 -0000    1.2
--- src/tools/msvc/install.bat    9 Dec 2007 19:31:36 -0000
***************
*** 13,19 ****
  :RUN_INSTALL

  SETLOCAL
! if exist buildenv.bat call buildenv.bat

  perl install.pl "%1"

--- 13,24 ----
  :RUN_INSTALL

  SETLOCAL
!
! IF NOT EXIST buildenv.pl goto nobuildenv
! perl -e "require 'buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
! CALL bldenv.bat
! del bldenv.bat
! :nobuildenv

  perl install.pl "%1"

Index: src/tools/msvc/pgbison.bat
===================================================================
RCS file: /cvsroot/pgsql/src/tools/msvc/pgbison.bat,v
retrieving revision 1.7
diff -c -r1.7 pgbison.bat
*** src/tools/msvc/pgbison.bat    7 Jul 2007 07:43:21 -0000    1.7
--- src/tools/msvc/pgbison.bat    9 Dec 2007 19:31:36 -0000
***************
*** 1,7 ****
  @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/pgbison.bat,v 1.7 2007/07/07 07:43:21 mha Exp $

! if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat

  SET BV=
  for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
--- 1,11 ----
  @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/pgbison.bat,v 1.7 2007/07/07 07:43:21 mha Exp $

! IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
! perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
! CALL bldenv.bat
! del bldenv.bat
! :nobuildenv

  SET BV=
  for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
Index: src/tools/msvc/pgflex.bat
===================================================================
RCS file: /cvsroot/pgsql/src/tools/msvc/pgflex.bat,v
retrieving revision 1.4
diff -c -r1.4 pgflex.bat
*** src/tools/msvc/pgflex.bat    17 Mar 2007 14:01:01 -0000    1.4
--- src/tools/msvc/pgflex.bat    9 Dec 2007 19:31:36 -0000
***************
*** 1,7 ****
  @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/pgflex.bat,v 1.4 2007/03/17 14:01:01 mha Exp $

! if exist src\tools\msvc\buildenv.bat call src\tools\msvc\buildenv.bat

  flex -V > NUL
  if errorlevel 1 goto noflex
--- 1,11 ----
  @echo off
  REM $PostgreSQL: pgsql/src/tools/msvc/pgflex.bat,v 1.4 2007/03/17 14:01:01 mha Exp $

! IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
! perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
! CALL bldenv.bat
! del bldenv.bat
! :nobuildenv

  flex -V > NUL
  if errorlevel 1 goto noflex

Re: buildenv.pl/buildenv.bat

From
Magnus Hagander
Date:
On Sun, Dec 09, 2007 at 02:40:37PM -0500, Andrew Dunstan wrote:
>
>
> Magnus Hagander wrote:
> >>
> >>You seem to have misunderstood what I am suggesting. Of course we should
> >>document use of buildenv.pl in addition to the hacky fix to the .bat
> >>files. The hack is the part that would be invisible. The docs would be
> >>visible and contain what would be our ongoing practice.
> >>
> >
> >Correct, I was misunderstanding it :-)
> >
> >I still can't say I like that hack though. I'd rather document that you
> >have to do it in the .bat file for docs + gui build.
> >
> >But it's better than what I thought you were proposing :-)
> >
> >
> >
>
> Well, I honestly think we can live with it for one cycle. As soon as 8.4
> opens I'll get to work converting these .bat files to pure one line
> wrappers.

Ok. We obviously don't agree on what to do here, so let's open it up for somebody
else to comment on what they think is best.

My take is document the fact that you have to do it twice. Andrews is this
patch.

> Meanwhile, here's the proposed patch. If you want something else you'll
> have to do it.
>
> I don't know how many people regularly build on Windows other than you,
> me and Dave.

I know a couple of others. But - it was Dave that got bitten by this thing
first, which is when I noticed it and brought it up :-P

//Magnus

Re: buildenv.pl/buildenv.bat

From
Andrew Dunstan
Date:

Magnus Hagander wrote:
>>>
>>>
>>>
>> Well, I honestly think we can live with it for one cycle. As soon as 8.4
>> opens I'll get to work converting these .bat files to pure one line
>> wrappers.
>>
>
> Ok. We obviously don't agree on what to do here, so let's open it up for somebody
> else to comment on what they think is best.
>
> My take is document the fact that you have to do it twice. Andrews is this
> patch.
>
>


Nobody else seems to care :-)

My reasoning is that I don't want to make people change their setups in
future. The should just be able to set up buildenv.pl now and continue
to use it even when I've fixed the .bat files next release.

Writing and calling a temp .bat file might be yucky - having to keep two
environment files is a lot more yucky, IMNSHO, and we shouldn't make
people do it.

cheers

andrew

Re: [HACKERS] buildenv.pl/buildenv.bat

From
Dave Page
Date:
Andrew Dunstan wrote:
> Writing and calling a temp .bat file might be yucky - having to keep two
> environment files is a lot more yucky, IMNSHO, and we shouldn't make
> people do it.

+1

/D

Re: [HACKERS] buildenv.pl/buildenv.bat

From
Magnus Hagander
Date:
On Fri, Dec 14, 2007 at 03:39:14PM +0000, Dave Page wrote:
> Andrew Dunstan wrote:
> > Writing and calling a temp .bat file might be yucky - having to keep two
> > environment files is a lot more yucky, IMNSHO, and we shouldn't make
> > people do it.
>
> +1

Ok, I guess I'm outvoted ;-) I don't care *that* much about it, so let's do
it your way.

You need help testing that patch further, or do you consider it ready for
application? If so, go.

//Magnus

Re: [HACKERS] buildenv.pl/buildenv.bat

From
Andrew Dunstan
Date:

Magnus Hagander wrote:
> On Fri, Dec 14, 2007 at 03:39:14PM +0000, Dave Page wrote:
>
>> Andrew Dunstan wrote:
>>
>>> Writing and calling a temp .bat file might be yucky - having to keep two
>>> environment files is a lot more yucky, IMNSHO, and we shouldn't make
>>> people do it.
>>>
>> +1
>>
>
> Ok, I guess I'm outvoted ;-) I don't care *that* much about it, so let's do
> it your way.
>
> You need help testing that patch further, or do you consider it ready for
> application? If so, go.
>
>
>

Yes, please do test it - I don't use buildenv.* at all normally, as then
buildfarm client takes care of its own environment, and that's what I
usually use to build on Windows.


cheers

andrew.

Re: [HACKERS] buildenv.pl/buildenv.bat

From
Magnus Hagander
Date:
On Fri, Dec 14, 2007 at 10:47:02AM -0500, Andrew Dunstan wrote:
>
>
> Magnus Hagander wrote:
> >On Fri, Dec 14, 2007 at 03:39:14PM +0000, Dave Page wrote:
> >
> >>Andrew Dunstan wrote:
> >>
> >>>Writing and calling a temp .bat file might be yucky - having to keep two
> >>>environment files is a lot more yucky, IMNSHO, and we shouldn't make
> >>>people do it.
> >>>
> >>+1
> >>
> >
> >Ok, I guess I'm outvoted ;-) I don't care *that* much about it, so let's do
> >it your way.
> >
> >You need help testing that patch further, or do you consider it ready for
> >application? If so, go.
> >
> >
> >
>
> Yes, please do test it - I don't use buildenv.* at all normally, as then
> buildfarm client takes care of its own environment, and that's what I
> usually use to build on Windows.

It works in my two standalone environments (win32 and win64 machine),
so I've applied the patch now to get full buildfarm testing.

//Magnus