From e986c680437cf56654e6d806a841ea303b086d63 Mon Sep 17 00:00:00 2001 From: alivraghi Date: Sun, 9 Oct 2016 23:14:14 +0200 Subject: [PATCH] 1.05 Sat Oct 18 18:26:14 2008 - Optimized compatibility with different version of cryptlib - Removed 'configure' shell script to simplify CPAN installation - Support for 'cryptlib.h' new types --- Changes | 5 +++++ GenPerl.pl | 12 +++++++++++- MANIFEST | 1 - Makefile.PL | 49 +++++++++++++++++++++++++++++++++++++++++++++---- PerlCryptLib.pm | 17 ++++++++--------- PerlCryptLib.xs | 2 +- README | 14 +++++++++----- 7 files changed, 79 insertions(+), 21 deletions(-) diff --git a/Changes b/Changes index 1260e48..9085326 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,11 @@ Revision history for Perl extension PerlCryptLib ================================================ +1.05 Sat Oct 18 18:26:14 2008 + - Optimized compatibility with different version of cryptlib + - Removed 'configure' shell script to simplify CPAN installation + - Support for 'cryptlib.h' new types + 1.04 Thu Apr 19 19:18:55 2007 - Granted compatibility with different version of cryptlib - Introduced 'configure' shell script diff --git a/GenPerl.pl b/GenPerl.pl index b52cc1d..4bedf9e 100644 --- a/GenPerl.pl +++ b/GenPerl.pl @@ -3,7 +3,7 @@ # Copyright (C) 2007 Alvaro Livraghi ##### -# G E N P E R L . P L Version 0.1 (last changes 2007-06-0) +# G E N P E R L . P L Version 0.2 (last changes 2008-08-17) # -------------------------------------------------------------------- # Based upon GenVB.pl by Wolfgang Gothier # @@ -139,6 +139,12 @@ redo if @source; } + # continued function declaration + if (s/\,s*?$/,/) { + $_ .= shift @source; + redo if @source; + } + # incomplete typedef / enum lines if (/^\s*(typedef\s+enum|typedef\s+struct|enum)\s*\{[^}]*$/) { $_ .= shift @source; @@ -184,6 +190,10 @@ if ( s/(\bC_RET\s*\w+\s*\(\s*[^)]+\s*\)\s*;)/#$1/ ) { s/\n/\n#/g; } + + if ( s/^(\s*?)(C_CHECK_RETVAL|C_NONNULL_ARG)(.*?)/# $1$2$3/ ) { + s/\n/\n#/g; + } # C-macro definitions are ignored if (s/\s*#define\s+(.*)/$1/) { diff --git a/MANIFEST b/MANIFEST index be81dd7..b527656 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,3 @@ -configure Changes MANIFEST Makefile.PL diff --git a/Makefile.PL b/Makefile.PL index e94d865..1e0a309 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,10 +2,51 @@ use 5.008; use ExtUtils::MakeMaker; use Data::Dumper; -my $PERL_CRYPT_LIB_HEADER = undef; -while ( !($PERL_CRYPT_LIB_HEADER = `cat ./.cl_h 2>/dev/null`) ) { - die "Installation aborted!\n\n" if system("./configure"); -}; + +my $CRYPT_LIB_HEADER = 'cryptlib.h'; +my $PERL_CRYPT_LIB_HEADER = $ENV{PERL_CRYPT_LIB_HEADER}; + +unless ( defined $PERL_CRYPT_LIB_HEADER ) { + print "Looking for '$CRYPT_LIB_HEADER', please wait... "; + my @found = qx{find /home -type f -iname '$CRYPT_LIB_HEADER' 2>/dev/null}; + if ( scalar(@found) == 0 ) { + print "NOT FOUND", "\n"; + print "$0 ABORTED!", "\n"; + print "\n"; + print "You need CryptLib source code distribution in order to build PerlCryptLib.", "\n"; + exit 1; + } + print "DONE", "\n"; + print "Found(ed):", "\n"; + foreach my $h (sort @found) { + chomp $h; + print "\t", $h; + my $v = qx{grep 'CRYPTLIB_VERSION' $h 2>/dev/null}; + $v =~ m/(\d+)/; + print "\t", "(Ver. ", $1, ")"; + print "\n"; + } + if ( scalar(@found) > 1 ) { + print "$0 ABORTED!", "\n"; + print "\n"; + print "You have to set environment variable PERL_CRYPT_LIB_HEADER to specify which one header file to use.", "\n"; + print "\n"; + print "ie:", "\n"; + print "\n"; + print "export PERL_CRYPT_LIB_HEADER='$found[0]'", "\n"; + print "\n"; + exit 1; + } + $PERL_CRYPT_LIB_HEADER = $found[0]; +} + +print "Writing 'PerlCryptLib.ph', please wait... "; +print qx{perl ./GenPerl.pl $PERL_CRYPT_LIB_HEADER ./PerlCryptLib.ph 1>/dev/null}; +if ( $? != 0 ) { + print "ERROR $?", "\n"; + exit 1; +} +print "OK", "\n"; WriteMakefile( 'NAME' => 'PerlCryptLib' diff --git a/PerlCryptLib.pm b/PerlCryptLib.pm index b99d344..df4ba88 100644 --- a/PerlCryptLib.pm +++ b/PerlCryptLib.pm @@ -8,7 +8,7 @@ use Carp; require Exporter; use AutoLoader; -our $VERSION = '1.04'; +our $VERSION = '1.05'; ############################################################################# @@ -196,17 +196,16 @@ version of the 'cryptlib' library used by your system. This is done translating on-the-fly the cryptlib.h header file into a correspondent Perl header file (named PerlCryptLib.ph) that will be used by the main module. -To do that, you simply have to suggest the full-path to the cryptlib.h header -file when prompted by the configuration utility: - - ./configure - -After the configuration you can build, test and install as usual: +PerlCryptLib need to know the path to cryptlib.h header file for the libcl +installed in the system. +You can set (export) environment variable B or, +alternatively, Makefile.PL try itself to search for B in B +directory. perl Makefile.PL make make test TEST_VERBOSE=1 # or, simply, the canonical make test - make install + sudo make install =head1 SYNOPSIS @@ -449,7 +448,7 @@ Alvaro Livraghi, =head1 COPYRIGHT AND LICENSE -Copyright (C) 2006-2007 Alvaro Livraghi. All Rights Reserved. +Copyright (C) 2006-2008 Alvaro Livraghi. All Rights Reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/PerlCryptLib.xs b/PerlCryptLib.xs index 5a590a0..1dff82a 100644 --- a/PerlCryptLib.xs +++ b/PerlCryptLib.xs @@ -2,7 +2,7 @@ Perl extesione interface (XS) to 'cryptlib' library (PerlCryptLib) - Copyright (C) 2006-2007 Alvaro Livraghi. All Rights Reserved. + Copyright (C) 2006-2008 Alvaro Livraghi. All Rights Reserved. Alvaro Livraghi, *******************************************************************************/ diff --git a/README b/README index 4858533..6bb8419 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ ============================ -PerlCryptLib v.1.04 - README +PerlCryptLib v.1.05 - README ============================ @@ -34,22 +34,26 @@ Pre-installation notes * Versions and platforms supported: - - cryptlib v.3.2.2 (or later) on linux + - cryptlib v.3.2.2 (or later) on unix/linux Installation ------------ +PerlCryptLib need to know the path to cryptlib.h header file for the libcl +installed in the system. +You can set (export) environment variable PERL_CRYPT_LIB_HEADER or, +alternatively, Makefile.PL try itself to search for cryptlib.h in /home +directory. + Simply do: $ tar -xvzf PerlCryptLib-x.xx.tar.gz $ cd PerlCryptLib-x.xx - $ ./configure $ perl Makefile.PL $ make $ make test - $ su ~ - $ make install + $ sudo make install Note: to get test-verbosity try 'make test TEST_VERBOSE=1' instead 'make test'.