Alien-NSS

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use strict;
use warnings;

use HTTP::Tiny;
use IPC::Cmd qw/can_run/;
use Carp;

use Sort::Versions; # This is a requirement of Alien::Base, hence we can also use it

use lib 'inc';
use Alien::NSS::ModuleBuild;

my $make;

`gmake --version 2>&1`;
if ( $? == 0 ) {
	$make = 'gmake';
} elsif ( `make --version 2>&1` =~ m#GNU# ) {
	$make = 'make';
} else {
	print STDERR "No suitable make could be found\n";
	my $makeversion = `make --version 2>&1`;
	print STDERR "Result of trying make --version:\n$makeversion\n";
	exit(0);
}

my $arch = `uname -m`;
my $add64 = "";
if ( $arch =~ m#64# ) {
	$add64 = "USE_64=1";
}

my $addcc = "";
$addcc = "CC=cc" if ( (!can_run('gcc')) && can_run('cc') );

my @build_commands = (
	# patch out @execute_path...
	'perl -pi -e \'s/\@executable_path/\$\(INSTALL_DIR\)/g\' nss/lib/freebl/config.mk',
	'perl -pi -e \'s/\@executable_path/\$\(INSTALL_DIR\)/g\' nss/coreconf/Darwin.mk',
	'perl -pi -e \'s/\@executable_path/\$\(INSTALL_DIR\)/g\' nspr/configure',
	'perl -pi -e \'s/\@executable_path/\$\(INSTALL_DIR\)/g\' nspr/configure.in',
	"echo 'Option add64: $add64'",
	'uname',
	'uname -m',
	'uname -a',
	'bash -c \''.$make." -C nss nss_build_all INSTALL_DIR=%s/lib BUILD_OPT=1 $addcc ".$add64.'\'',
	'mkdir stage',
	'mkdir stage/include',
	'mkdir stage/lib',
	'cp -L dist/public/nss/* stage/include',
	'cp -L -R dist/*.OBJ/include/* stage/include',
	'cp -L -R dist/*.OBJ/lib/* stage/lib',
	'rm -f stage/lib/*.a',
	'rm -r dist nss nspr'
);

my $builder = Alien::NSS::ModuleBuild->new (
	(sign => 1),
	module_name => 'Alien::NSS',
	license => 'mozilla',
	configure_requires => {
		'Alien::Base' => '0.018', # staged installation to blib
		'Module::Build' => '0.38',
		'Sort::Versions' => 0,
		'Test::More' => 0,
		'HTTP::Tiny' => 0,
	},
	requires => {
		'perl' => '5.8.1',
		'Alien::Base' => '0.018',



( run in 0.892 second using v1.01-cache-2.11-cpan-796a6f069b2 )