vcbuild optional packages

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

This patch fixes vcbuild so you can build without OpenSSL and libz
should you want to. This disables the sslinfo and pgcrypto modules
because they require the libraries to build at all.

//Magnus

Attachments:

vcbuild.patchtext/plain; name=vcbuild.patchDownload
Index: src\tools\msvc/mkvcbuild.pl
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/mkvcbuild.pl,v
retrieving revision 1.8
diff -c -r1.8 mkvcbuild.pl
*** src\tools\msvc/mkvcbuild.pl	21 Nov 2006 17:54:26 -0000	1.8
--- src\tools\msvc/mkvcbuild.pl	8 Jan 2007 19:49:13 -0000
***************
*** 182,203 ****
  	push @contrib_excludes,'xml2';
  }

! # Pgcrypto makefile too complex to parse....
! my $pgcrypto = $solution->AddProject('pgcrypto','dll','crypto');
! $pgcrypto->AddFiles('contrib\pgcrypto','pgcrypto.c','px.c','px-hmac.c','px-crypt.c',
! 		'crypt-gensalt.c','crypt-blowfish.c','crypt-des.c','crypt-md5.c','mbuf.c',
! 		'pgp.c','pgp-armor.c','pgp-cfb.c','pgp-compress.c','pgp-decrypt.c','pgp-encrypt.c',
! 		'pgp-info.c','pgp-mpi.c','pgp-pubdec.c','pgp-pubenc.c','pgp-pubkey.c','pgp-s2k.c',
! 		'pgp-pgsql.c');
! if ($solution->{options}->{openssl}) {
! 	$pgcrypto->AddFiles('contrib\pgcrypto', 'openssl.c','pgp-mpi-openssl.c');
  }
! else {
! 	$pgcrypto->AddFiles('contrib\pgcrypto', 'md5.c','sha1.c','sha2.c','internal.c','internal-sha2.c',
! 			'blf.c','rijndael.c','fortuna.c','random.c','pgp-mpi-internal.c','imath.c');
  }
- $pgcrypto->AddReference($postgres);
- $pgcrypto->AddLibrary('wsock32.lib');

  my $D;
  opendir($D, 'contrib') || croak "Could not opendir on contrib!\n";
--- 182,210 ----
  	push @contrib_excludes,'xml2';
  }

! if (!$solution->{options}->{openssl}) {
!    push @contrib_excludes,'sslinfo';
  }
!
! # Pgcrypto makefile too complex to parse....
! # Pgcrypto requires zlib
! if ($solution->{options}->{zlib}) {
!    my $pgcrypto = $solution->AddProject('pgcrypto','dll','crypto');
!    $pgcrypto->AddFiles('contrib\pgcrypto','pgcrypto.c','px.c','px-hmac.c','px-crypt.c',
!    		'crypt-gensalt.c','crypt-blowfish.c','crypt-des.c','crypt-md5.c','mbuf.c',
!    		'pgp.c','pgp-armor.c','pgp-cfb.c','pgp-compress.c','pgp-decrypt.c','pgp-encrypt.c',
!    		'pgp-info.c','pgp-mpi.c','pgp-pubdec.c','pgp-pubenc.c','pgp-pubkey.c','pgp-s2k.c',
!    		'pgp-pgsql.c');
!    if ($solution->{options}->{openssl}) {
!    	$pgcrypto->AddFiles('contrib\pgcrypto', 'openssl.c','pgp-mpi-openssl.c');
!    }
!    else {
!    	$pgcrypto->AddFiles('contrib\pgcrypto', 'md5.c','sha1.c','sha2.c','internal.c','internal-sha2.c',
!    			'blf.c','rijndael.c','fortuna.c','random.c','pgp-mpi-internal.c','imath.c');
!    }
!    $pgcrypto->AddReference($postgres);
!    $pgcrypto->AddLibrary('wsock32.lib');
  }

  my $D;
  opendir($D, 'contrib') || croak "Could not opendir on contrib!\n";
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: vcbuild optional packages

Magnus Hagander <magnus@hagander.net> writes:

This patch fixes vcbuild so you can build without OpenSSL and libz
should you want to. This disables the sslinfo and pgcrypto modules
because they require the libraries to build at all.

Applied.

regards, tom lane

#3Marko Kreen
markokr@gmail.com
In reply to: Magnus Hagander (#1)
Re: [PATCHES] vcbuild optional packages

On 1/8/07, Magnus Hagander <magnus@hagander.net> wrote:

This patch fixes vcbuild so you can build without OpenSSL and libz
should you want to. This disables the sslinfo and pgcrypto modules
because they require the libraries to build at all.

Both openssl and zlib are optional for pgcrypto. Please
look at the real Makefile. (Put -DDISABLE_ZLIB into CFLAGS.)

--
marko

#4Magnus Hagander
magnus@hagander.net
In reply to: Marko Kreen (#3)
Re: [PATCHES] vcbuild optional packages

Marko Kreen wrote:

On 1/8/07, Magnus Hagander <magnus@hagander.net> wrote:

This patch fixes vcbuild so you can build without OpenSSL and libz
should you want to. This disables the sslinfo and pgcrypto modules
because they require the libraries to build at all.

Both openssl and zlib are optional for pgcrypto. Please
look at the real Makefile. (Put -DDISABLE_ZLIB into CFLAGS.)

Ah, I see. Will have to take a look at that later then.

Is there any reason why the check is "backwards" in pgcrypto compared to
the rest of the system? All the other places check for HAVE_ZLIB from
what I can tell.

//Magnus

#5Marko Kreen
markokr@gmail.com
In reply to: Magnus Hagander (#4)
1 attachment(s)
Re: [PATCHES] vcbuild optional packages

On 1/14/07, Magnus Hagander <magnus@hagander.net> wrote:

Is there any reason why the check is "backwards" in pgcrypto compared to
the rest of the system? All the other places check for HAVE_ZLIB from
what I can tell.

Eh, just an oversight from my part. I was so focused on Makefile
hacking so I forgot to check if there is already a define
somewhere. And its reverse to have less clutter in command-line
in default case.

Attached patch replaces unnecessary DISABLE_ZLIB define in
pgcrypto with HAVE_LIBZ from core. Result is bit simpler
Makefile which is only good.

--
marko

Attachments:

pgcrypto-simpler-zlib.diffapplication/octet-stream; name=pgcrypto-simpler-zlib.diffDownload
Index: contrib/pgcrypto/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/pgcrypto/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- contrib/pgcrypto/Makefile	13 Jul 2006 04:15:24 -0000	1.24
+++ contrib/pgcrypto/Makefile	14 Jan 2007 16:08:43 -0000
@@ -9,17 +9,13 @@
 OSSL_SRCS = openssl.c pgp-mpi-openssl.c
 OSSL_TESTS = sha2 des 3des cast5
 
-ZLIB_OFF_CFLAGS = -DDISABLE_ZLIB
 ZLIB_TST = pgp-compression
 ZLIB_OFF_TST = pgp-zlib-DISABLED
 
 CF_SRCS = $(if $(subst no,,$(with_openssl)), $(OSSL_SRCS), $(INT_SRCS))
 CF_TESTS = $(if $(subst no,,$(with_openssl)), $(OSSL_TESTS), $(INT_TESTS))
-CF_CFLAGS = $(if $(subst yes,,$(with_zlib)), $(ZLIB_OFF_CFLAGS))
 CF_PGP_TESTS = $(if $(subst no,,$(with_zlib)), $(ZLIB_TST), $(ZLIB_OFF_TST))
 
-PG_CPPFLAGS	= $(CF_CFLAGS)
-
 SRCS		= pgcrypto.c px.c px-hmac.c px-crypt.c \
 		crypt-gensalt.c crypt-blowfish.c crypt-des.c \
 		crypt-md5.c $(CF_SRCS) \
Index: contrib/pgcrypto/pgp-compress.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/pgcrypto/pgp-compress.c,v
retrieving revision 1.5
diff -u -r1.5 pgp-compress.c
--- contrib/pgcrypto/pgp-compress.c	15 Oct 2005 02:49:06 -0000	1.5
+++ contrib/pgcrypto/pgp-compress.c	14 Jan 2007 16:08:43 -0000
@@ -40,7 +40,7 @@
  * Compressed pkt writer
  */
 
-#ifndef DISABLE_ZLIB
+#ifdef HAVE_LIBZ
 
 #include <zlib.h>
 
@@ -312,7 +312,8 @@
 {
 	return pullf_create(res, &decompress_filter, ctx, src);
 }
-#else							/* DISABLE_ZLIB */
+
+#else							/* !HAVE_ZLIB */
 
 int
 pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst)
#6Alvaro Herrera
alvherre@commandprompt.com
In reply to: Marko Kreen (#5)
Re: [PATCHES] vcbuild optional packages

Marko Kreen wrote:

On 1/14/07, Magnus Hagander <magnus@hagander.net> wrote:

Is there any reason why the check is "backwards" in pgcrypto compared to
the rest of the system? All the other places check for HAVE_ZLIB from
what I can tell.

Eh, just an oversight from my part. I was so focused on Makefile
hacking so I forgot to check if there is already a define
somewhere. And its reverse to have less clutter in command-line
in default case.

Attached patch replaces unnecessary DISABLE_ZLIB define in
pgcrypto with HAVE_LIBZ from core. Result is bit simpler
Makefile which is only good.

Applied.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support