Skip to content

Commit

Permalink
Merge pull request #3 from alivraghi/1.05
Browse files Browse the repository at this point in the history
1.05  Sat Oct 18 18:26:14 2008
  • Loading branch information
alivraghi authored Oct 9, 2016
2 parents 399551b + e986c68 commit 5ab27bf
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 21 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 11 additions & 1 deletion GenPerl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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/) {
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
configure
Changes
MANIFEST
Makefile.PL
Expand Down
49 changes: 45 additions & 4 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
17 changes: 8 additions & 9 deletions PerlCryptLib.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Carp;
require Exporter;
use AutoLoader;

our $VERSION = '1.04';
our $VERSION = '1.05';


#############################################################################
Expand Down Expand Up @@ -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<PERL_CRYPT_LIB_HEADER> or,
alternatively, Makefile.PL try itself to search for B<cryptlib.h> in B</home>
directory.
perl Makefile.PL
make
make test TEST_VERBOSE=1 # or, simply, the canonical make test
make install
sudo make install
=head1 SYNOPSIS
Expand Down Expand Up @@ -449,7 +448,7 @@ Alvaro Livraghi, <perlcryptlib@gmail.com>
=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.
Expand Down
2 changes: 1 addition & 1 deletion PerlCryptLib.xs
Original file line number Diff line number Diff line change
Expand Up @@ -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, <perlcryptlib@gmail.com>
*******************************************************************************/
Expand Down
14 changes: 9 additions & 5 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
============================
PerlCryptLib v.1.04 - README
PerlCryptLib v.1.05 - README
============================


Expand Down Expand Up @@ -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'.

Expand Down

0 comments on commit 5ab27bf

Please sign in to comment.