Skip to content

Commit

Permalink
Prepping for 0.12 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mgregoro committed Jun 12, 2018
1 parent 90be0dd commit bca1aae
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 11 deletions.
17 changes: 16 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ Revision history for Perl extension Crypt::Sodium.
- added tests for randombytes_random() and _uniform()
- added crypto_generichash_init(), _update(), and final()
to support multi-part hashing
0.12 Tue Jan 3 15:04:46 2017

0.12 Tue Jun 12 01:02:22 2018
- added documentation for crypto_generichash() and company
- re https://github.com/mgregoro/Crypt-Sodium/issues/13 did
my best to make the build process a bit more robust,
checking obvious places like /usr/local/include and
/usr/local/Cellar/libsodium/<version>/include, and trying
pkg-config and Alien::Sodium if available.
- merged pr #12 from @starbelly -- thx BP -- which exposes
crypto_aead_xchacha20poly1305_ietf functions
- added Crypt::Sodium::BuildVersion which contains info
about the version of libsodium this module was built
against. this allows us to introduce breaking function-
ality without sacrificing backwards compatibility in the
future
-


11 changes: 6 additions & 5 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Changes
lib/Crypt/Sodium.pm
lib/Crypt/Sodium/GenericHash/State.pm
Makefile.PL
MANIFEST
MANIFEST This list of files
MANIFEST.SKIP
META.json
META.yml
ppport.h
README
README.md
Sodium.xs
t/Crypt-Sodium.t
lib/Crypt/Sodium.pm
lib/Crypt/Sodium/GenericHash/State.pm
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
45 changes: 45 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!start included /usr/share/perl/5.8/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\B\.git\b
\B\.gitignore\b

# Avoid VMS specific MakeMaker generated files
\bDescrip.MMS$
\bDESCRIP.MMS$
\bdescrip.mms$

# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak
\bMakefile$
\bblib/
\bMakeMaker-\d
\bpm_to_blib\.ts$
\bpm_to_blib$
\bblibdirs\.ts$

# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$
\.tmp$
\.#
\.rej$

# macOS Crap
\B\.DS_Store
\B\._

# Avoid Devel::Cover and Devel::CoverX::Covered files.
\bcover_db\b
\bcovered\b

# Avoid MYMETA files
^MYMETA\.

# Avoid configuration metadata file
^MYMETA\.

# Avoid archives of this distribution
\bCrypt-Sodium-[\d\.\_]+
34 changes: 31 additions & 3 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use 5.008000;
use ExtUtils::MakeMaker;
use List::Util qw/uniq/;
use Cwd qw/abs_path/;
use File::Basename qw/dirname/;

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

Expand All @@ -24,6 +27,10 @@ my %config = (
INC => '', # e.g., '-I. -I/usr/include/other'
# Un-comment this if you add C files to link with later:
# OBJECT => '$(O_FILES)', # link all the C files too
clean => {
# this file is created before building, and should be installed.. but cleaned when 'make clean' is run.
FILES => 'lib/Crypt/Sodium/BuildVersion.pm',
},
);

my $i = 0;
Expand All @@ -33,6 +40,7 @@ if (scalar(keys %$c) > 0) {
$i = 4;
my ($major, $minor, $revision) = split(/\./, $c->{modversion});
$config{DEFINE} .= " -DP5CS_LIBMAJ=$major -DP5CS_LIBMIN=$minor -DP5CS_LIBREV=$revision -DP5CS_LIBVER=" . '\"' . $c->{modversion} . '\"';
write_ver_file($c->{modversion});
}

if ($c->{libdir}) {
Expand All @@ -49,13 +57,14 @@ if (scalar(keys %$c) > 0) {
if (-d "/usr/local/Cellar/libsodium") {
# just build against the newest homebrew libsodium this situation should work out to '3'.
$c->{modversion} = (sort {$b <=> $a} `ls /usr/local/Cellar/libsodium`)[0];
if (-f "/usr/local/Cellar/libsodium/$newest/include/sodium.h") {
if (-f "/usr/local/Cellar/libsodium/$c->{modversion}/include/sodium.h") {
$i += 3;
$c->{libdir} = "-lsodium -L/usr/local/Cellar/libsodium/$newest/lib";
$c->{includedir} = "/usr/local/Cellar/libsodium/$newest/include";
$c->{libdir} = "-lsodium -L/usr/local/Cellar/libsodium/$c->{modversion}t/lib";
$c->{includedir} = "/usr/local/Cellar/libsodium/$c->{modversion}/include";
my ($major, $minor, $revision) = split(/\./, $c->{modversion});
# far fetched but..
$config{DEFINE} .= " -DP5CS_LIBMAJ=$major -DP5CS_LIBMIN=$minor -DP5CS_LIBREV=$revision -DP5CS_LIBVER=" . '\"' . $c->{modversion} . '\"';
write_ver_file($c->{modversion});
}
} else {
# Alien::Sodium (as of Jun 11 2018) supplies 1.0.8 anyway, so if we find it, just make sure we have the
Expand All @@ -67,6 +76,7 @@ if (scalar(keys %$c) > 0) {
$c->{includedir} = join(' ', uniq(split/ /, Alien::Sodium->cflags));
}

write_ver_file();
$config{DEFINE} .= " -DP5CS_LIBMAJ=1 -DP5CS_LIBMIN=0 -DP5CS_LIBREV=8 -DP5CS_LIBVER=" . '\"1.0.8\"';
}
}
Expand Down Expand Up @@ -105,3 +115,21 @@ if ($i >= 3) {
print "If you're sure you have libsodium 1.0.8 or higher installed, please run 'make' and 'make test' to build Crypt::Sodium\n\n";
}
}

sub write_ver_file {
my ($lsv) = @_;
$lsv //= '1.0.8';
my ($major, $minor, $revision) = split(/\./, $lsv);
my $dist_path = dirname(abs_path(__FILE__));
if (-d "$dist_path/lib/Crypt/Sodium") {
# we're in the right place.
open my $fh, '>', "$dist_path/lib/Crypt/Sodium/BuildVersion.pm";
print $fh "package Crypt::Sodium::BuildVersion;\n";
print $fh 'our $VERSION = ' . "'v$lsv';\n";
print $fh 'our $MAJOR = ' . $major . ";\n";
print $fh 'our $MINOR = ' . $minor . ";\n";
print $fh 'our $REVISION = ' . $revision . ";\n";
print $fh "1;\n";
close $fh;
}
}
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This module requires these other modules and libraries:

COPYRIGHT AND LICENCE

Copyright (C) 2017 by Michael Gregorowicz
Copyright (C) 2018 by Michael Gregorowicz

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.0 or,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This module requires these other modules and libraries:

COPYRIGHT AND LICENCE

Copyright (C) 2017 by Michael Gregorowicz
Copyright (C) 2018 by Michael Gregorowicz

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.0 or,
Expand Down
1 change: 1 addition & 0 deletions lib/Crypt/Sodium.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Crypt::Sodium;

use Crypt::Sodium::BuildVersion;
use 5.008000;
use strict;
use warnings;
Expand Down

0 comments on commit bca1aae

Please sign in to comment.