Thread: Fix for MSVC header installation

Fix for MSVC header installation

From
Dave Page
Date:
The MSVC installer doesn't install the headers in the same directory
structure as the Mingw build. This causes other apps (such as Slony) to
fail their configure tests.

The attached patch fixes this.

Regards, Dave
Index: Install.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Install.pm,v
retrieving revision 1.12
diff -c -r1.12 Install.pm
*** Install.pm    23 Apr 2007 17:18:58 -0000    1.12
--- Install.pm    25 Apr 2007 13:49:14 -0000
***************
*** 299,307 ****
  {
      my $target = shift;

!     EnsureDirectories($target, 'include', 'include/libpq', 'include/postgresql',
!         'include/postgresql/internal', 'include/postgresql/internal/libpq',
!         'include/postgresql/server');

      CopyFiles(
          'Public headers',
--- 299,307 ----
  {
      my $target = shift;

!     EnsureDirectories($target, 'include', 'include/libpq',
!         'include/internal', 'include/internal/libpq',
!         'include/server');

      CopyFiles(
          'Public headers',
***************
*** 314,337 ****
      CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h');
      CopyFiles(
          'Libpq internal headers',
!         $target .'/include/postgresql/internal/',
          'src/interfaces/libpq/', 'libpq-int.h', 'pqexpbuffer.h'
      );

      CopyFiles(
          'Internal headers',
!         $target . '/include/postgresql/internal/',
          'src/include/', 'c.h', 'port.h', 'postgres_fe.h'
      );
!     copy('src/include/libpq/pqcomm.h', $target . '/include/postgresql/internal/libpq/')
        || croak 'Could not copy pqcomm.h';

      CopyFiles(
          'Server headers',
!         $target . '/include/postgresql/server/',
          'src/include/', 'pg_config.h', 'pg_config_os.h'
      );
!     CopySetOfFiles('', "src\\include\\*.h", $target . '/include/postgresql/server/', 1, 1);
      my $D;
      opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";

--- 314,337 ----
      CopyFiles('Libpq headers', $target . '/include/', 'src/interfaces/libpq/', 'libpq-fe.h');
      CopyFiles(
          'Libpq internal headers',
!         $target .'/include/internal/',
          'src/interfaces/libpq/', 'libpq-int.h', 'pqexpbuffer.h'
      );

      CopyFiles(
          'Internal headers',
!         $target . '/include/internal/',
          'src/include/', 'c.h', 'port.h', 'postgres_fe.h'
      );
!     copy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
        || croak 'Could not copy pqcomm.h';

      CopyFiles(
          'Server headers',
!         $target . '/include/server/',
          'src/include/', 'pg_config.h', 'pg_config_os.h'
      );
!     CopySetOfFiles('', "src\\include\\*.h", $target . '/include/server/', 1, 1);
      my $D;
      opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";

***************
*** 341,349 ****
          next if ($d eq 'CVS');
          next unless (-d 'src/include/' . $d);

!         EnsureDirectories($target . '/include/postgresql/server', $d);
          system(
!             "xcopy /s /i /q /r /y src\\include\\$d\\*.h \"$target\\include\\postgresql\\server\\$d\\\"")
            && croak("Failed to copy include directory $d\n");
      }
      closedir($D);
--- 341,349 ----
          next if ($d eq 'CVS');
          next unless (-d 'src/include/' . $d);

!         EnsureDirectories($target . '/include/server', $d);
          system(
!             "xcopy /s /i /q /r /y src\\include\\$d\\*.h \"$target\\include\\server\\$d\\\"")
            && croak("Failed to copy include directory $d\n");
      }
      closedir($D);
***************
*** 358,367 ****
          'ecpg_config.h', split /\s+/,$1
      );
      $mf =~ /^informix_headers\s*=\s*(.*)$/m || croak "Could not find informix_headers line\n";
!     EnsureDirectories($target . '/include/postgresql', 'informix', 'informix/esql');
      CopyFiles(
          'ECPG informix headers',
!         $target .'/include/postgresql/informix/esql/',
          'src/interfaces/ecpg/include/',
          split /\s+/,$1
      );
--- 358,367 ----
          'ecpg_config.h', split /\s+/,$1
      );
      $mf =~ /^informix_headers\s*=\s*(.*)$/m || croak "Could not find informix_headers line\n";
!     EnsureDirectories($target . '/include', 'informix', 'informix/esql');
      CopyFiles(
          'ECPG informix headers',
!         $target .'/include/informix/esql/',
          'src/interfaces/ecpg/include/',
          split /\s+/,$1
      );

Re: Fix for MSVC header installation

From
Magnus Hagander
Date:
On Wed, Apr 25, 2007 at 02:57:41PM +0100, Dave Page wrote:
> The MSVC installer doesn't install the headers in the same directory
> structure as the Mingw build. This causes other apps (such as Slony) to
> fail their configure tests.
>
> The attached patch fixes this.

Applied, thanks.

FWIW, I mimicked the install layout on my Linux box. But we should
definitly be consistent with mingw instead :-)

//Magnus

Re: Fix for MSVC header installation

From
Dave Page
Date:
Magnus Hagander wrote:
> On Wed, Apr 25, 2007 at 02:57:41PM +0100, Dave Page wrote:
>> The MSVC installer doesn't install the headers in the same directory
>> structure as the Mingw build. This causes other apps (such as Slony) to
>> fail their configure tests.
>>
>> The attached patch fixes this.
>
> Applied, thanks.
>
> FWIW, I mimicked the install layout on my Linux box. But we should
> definitly be consistent with mingw instead :-)

Hmm, wonder why they are different? Especially as 8.2.4 on
developer.pgadmin.org (Slackware 11) seems to have the same layout as mingw!

Regards, Dave.

Re: Fix for MSVC header installation

From
Andrew Dunstan
Date:
Dave Page wrote:
> Magnus Hagander wrote:
>> On Wed, Apr 25, 2007 at 02:57:41PM +0100, Dave Page wrote:
>>> The MSVC installer doesn't install the headers in the same directory
>>> structure as the Mingw build. This causes other apps (such as Slony)
>>> to fail their configure tests.
>>>
>>> The attached patch fixes this.
>>
>> Applied, thanks.
>>
>> FWIW, I mimicked the install layout on my Linux box. But we should
>> definitly be consistent with mingw instead :-)
>
> Hmm, wonder why they are different? Especially as 8.2.4 on
> developer.pgadmin.org (Slackware 11) seems to have the same layout as
> mingw!


pg_config IYF.

try:  pg_config | grep INCLUDE

cheers

andrew



Re: Fix for MSVC header installation

From
Dave Page
Date:
Andrew Dunstan wrote:
> Dave Page wrote:
>> Magnus Hagander wrote:
>>> On Wed, Apr 25, 2007 at 02:57:41PM +0100, Dave Page wrote:
>>>> The MSVC installer doesn't install the headers in the same directory
>>>> structure as the Mingw build. This causes other apps (such as Slony)
>>>> to fail their configure tests.
>>>>
>>>> The attached patch fixes this.
>>>
>>> Applied, thanks.
>>>
>>> FWIW, I mimicked the install layout on my Linux box. But we should
>>> definitly be consistent with mingw instead :-)
>>
>> Hmm, wonder why they are different? Especially as 8.2.4 on
>> developer.pgadmin.org (Slackware 11) seems to have the same layout as
>> mingw!
>
>
> pg_config IYF.
>
> try:  pg_config | grep INCLUDE

Right, but some of the directories that were in the wrong place were not
  ones that could be located in the pg_config output - for example,
$INCLUDEDIR/internal was under $INCLUDEDIR/postgresql/internal.

And we really should make VC++ install in the same locations as mingw by
default anyway.

Regards, Dave.


Re: Fix for MSVC header installation

From
Tom Lane
Date:
Dave Page <dpage@postgresql.org> writes:
> And we really should make VC++ install in the same locations as mingw by
> default anyway.

I think you guys may be misinterpreting what's happening: this behavior
is not platform-sensitive, it is path-sensitive.  In particular, the
configure script will interpolate /postgresql into some of the
installation paths unless the given path already contains "postgres"
or "pgsql".  On some of my machines I build working versions into
/home/postgres, and there I get paths like
    /home/postgres/version82/share/timezone/...
and on others I build into /home/tgl and get paths like
    /home/tgl/version82/share/postgresql/timezone/...

So what I think is happening is that Magnus is getting fooled by which
username he builds under.  The thing to standardize on is the full
path you want the stuff to install in (and make sure it doesn't mention
postgres twice).

            regards, tom lane

Re: Fix for MSVC header installation

From
Magnus Hagander
Date:
Tom Lane wrote:
> Dave Page <dpage@postgresql.org> writes:
>> And we really should make VC++ install in the same locations as mingw by
>> default anyway.
>
> I think you guys may be misinterpreting what's happening: this behavior
> is not platform-sensitive, it is path-sensitive.  In particular, the
> configure script will interpolate /postgresql into some of the
> installation paths unless the given path already contains "postgres"
> or "pgsql".  On some of my machines I build working versions into
> /home/postgres, and there I get paths like
>     /home/postgres/version82/share/timezone/...
> and on others I build into /home/tgl and get paths like
>     /home/tgl/version82/share/postgresql/timezone/...
>
> So what I think is happening is that Magnus is getting fooled by which
> username he builds under.  The thing to standardize on is the full
> path you want the stuff to install in (and make sure it doesn't mention
> postgres twice).

Yup. I had no idea it did that :-) It certainly explains the difference.
Since the default path is /usr/local/pgsql.. But on the linux box in
question I build into /home/mha/pginst/HEAD/.

//Magnus

Re: Fix for MSVC header installation

From
"Dave Page"
Date:

> ------- Original Message -------
> From: Magnus Hagander <magnus@hagander.net>
> To: Tom Lane <tgl@sss.pgh.pa.us>
> Sent: 25/04/07, 22:31:20
> Subject: Re: [PATCHES] Fix for MSVC header installation
>
> Yup. I had no idea it did that :-) It certainly explains the difference.

No, nor I, but it makes sense if you consider an install into /usr/local vs. /usr/local/pgsql for example.

> Since the default path is /usr/local/pgsql.. But on the linux box in
> question I build into /home/mha/pginst/HEAD/.

Hmm, that presents a possible problem as I can't see any way to restructure the layout based on the selected
installationpath in pgInstaller :-(. We should probably stick with the postgresql-already-in-the-path layout - no-one's
evercomplained, and that'll be the smallest issue for anyone porting code to win32. 

Fixing the perl code shouldn't be an issue of course.

/D