ARSperl
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
#!/usr/local/bin/perl
#
# $Header: /cvsroot/arsperl/ARSperl/Makefile.PL,v 1.88 2011/07/29 13:05:27 tstapff Exp $
#
# ARSperl Makefile
#
# INSTRUCTIONS:
# Set the following below:
# 1) path to API ($ARSAPI below)
# 2) libraries (uncomment/commentout appropriate $ARS_LIBS lines)
# 3) defines (see DEFINE OPTIONS)
#
# run with "perl Makefile.PL" then type "make"
#
require 5.005;
use ExtUtils::MakeMaker;
use Config;
use Cwd;
$debug = 0;
###### There are FOUR (4) steps to complete. Complete all of them. ######
# STEP 1 -> Set the path to your ARS API directory
$ARSAPI = "C:/Replication/Remedy/7.6.4";
# STEP 2 -> Choose architecture dependent suffix for library names, if necessary
$ARCHITECTURE = "";
#$ARCHITECTURE = "hpia32"; # HPUX Itanium 32-bit
#$ARCHITECTURE = "hpia64"; # HPUX Itanium 64-bit
#$ARCHITECTURE = "hppa64"; # HPUX PA-RISC 64-bit
#$ARCHITECTURE = "lx64"; # Linux 64-bit
#$ARCHITECTURE = "aixp64"; # AIX 64-bit
#$ARCHITECTURE = "solsp64"; # Solaris 64-bit
# STEP 3 -> Choose whether or not to enable encryption
#
# 0 -> No encryption library linking
# 1 -> Link against Remedy's encryption library
$ENCRYPT = 0;
# STEP 4 -> Some additional compilation options
#
# Change this only if you have good reason to do so.
#
%ADVANCED_CONFIG = (
# you might try this if you experience memory violations
UNDEF_PERL_MALLOC => 0,
# set to 1 if you need a backwards compatible version of ars_GetListGroup
# (see the manual page of ars_GetListGroup for a more specific description)
GETLISTGROUP_OLD_STYLE => 0,
);
##############################
# unless you run into problems, you shouldn't need to read any further.
# if you do run into problems, and don't really know what this file
# does, try subscribing to the mailing list and ask for help there.
# subscription information is available at http://www.arsperl.org/
if( $ENV{ARSPERLTEST_PARAM} ){
( $ARSVERSION, $ARSAPI, $ARSPERLTEST_SERVER, $ARSPERLTEST_USERNAME, $ARSPERLTEST_PASSWORD, $ARSPERLTEST_TCPPORT )
= split( /;/, $ENV{ARSPERLTEST_PARAM} );
}
my $ra_arlibs = findArLibs($ARSAPI);
# use Data::Dumper;
# print "found ar libraries: ", Dumper($ra_arlibs);
$ARAPIVERSION = findAPIVersion($ARSAPI);
$ARSVERSION = ARSVersionString($ARAPIVERSION);
$WINDOWS = $^O eq 'MSWin32';
$GNU_WIN = ($^O eq 'MSWin32' || $^O eq 'cygwin') && $Config{'cc'} eq "gcc";
$AUTODEFINES = " -g ";
$AUTODEFINES = " -D_WIN32 " if($WINDOWS);
$AUTODEFINES .= " -Wno-unused-variable -Wuninitialized " if $Config{'cc'} eq "gcc";
$AUTODEFINES .= " -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS " if $WINDOWS && $ENV{ARSPERLTEST_PARAM};
$AUTODEFINES .= " -DARSPERL_UNDEF_MALLOC " if $ADVANCED_CONFIG{UNDEF_PERL_MALLOC};
$AUTODEFINES .= " -DGETLISTGROUP_OLD_STYLE " if $ADVANCED_CONFIG{GETLISTGROUP_OLD_STYLE};
$AUTODEFINES .= " -DARSPERL_DEBUG " if $debug;
$ARS_STATIC_LIB = "";
$PM = { 'ARS.pm' => '$(INST_LIBDIR)/ARS.pm' };
foreach my $pm2install (qw{arerrno-h.pm ar-h.pm nparm.pm OOform.pm OOmsgs.pm OOsup.pm}) {
$PM->{'ARS/'.$pm2install} = '$(INST_LIBDIR)/ARS/'.$pm2install;
}
$LARCH = $ARCHITECTURE ? "_".$ARCHITECTURE : "";
if ($ARAPIVERSION >= ARS_VERSION_63) {
$ARS_STATIC_LIB = "$ARSAPI/lib/libar$LARCH.a";
$ARS_LIBS = "-larencrypt$LARCH -lcrypto_BMC_FIPS$LARCH " if $ENCRYPT;
$ARS_LIBS .= " -lnsl ";
}else{
$ARS_LIBS = " -lar$LARCH -lnsl ";
$ARS_LIBS = " -lar$LARCH -larencrypt$LARCH -lnsl " if $ENCRYPT;
}
if ($GNU_WIN) {
$ARS_LIBS = join(' ', map { "$ARSAPI/lib/" . $_ } @{$ra_arlibs});
} elsif ($WINDOWS) {
Makefile.PL view on Meta::CPAN
}
print "Configuring with options:\n";
print "\tARSAPI = $ARSAPI\n";
print "\tARSVERSION = $ARSVERSION\n";
print "\tARAPIVERSION = $ARAPIVERSION\n";
print "\tAUTODEFINES = $AUTODEFINES\n";
die "FATAL: couldn't detect a supported api version!" if ($ARAPIVERSION eq "");
#$PM->{'ARS/_h2ph_pre.ph'} = '$(INST_LIBDIR)/ARS/_h2ph_pre.ph';
WriteMakefile(
'NAME' => 'ARS',
'VERSION_FROM' => 'ARS.pm',
'DISTNAME' => 'ARSperl',
'LICENSE' => 'artistic_1',
'META_MERGE' => {
resources => {
repository => 'https://github.com/jeffmurphy/ARSperl',
bugtracker => 'https://github.com/jeffmurphy/ARSperl/issues',
},
},
'LIBS' => $GNU_WIN ? [""] : ["${ARS_LDPATH} ${ARS_LIBS}"],
'MYEXTLIB' => $WINDOWS ? ($GNU_WIN ? $ARS_LIBS : '') : $ARS_STATIC_LIB,
'OBJECT' => q[ARS$(OBJ_EXT) support$(OBJ_EXT) supportrev$(OBJ_EXT) supportrev_generated$(OBJ_EXT) ],
'INC' => "${INCLUDES}",
'PM' => $PM,
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT => 'ARSperl is an integration kit for Perl5 and the Remedy Action Request System.',
AUTHOR => 'ARSPerl Dev Group <arsperl-devel@arsperl.org>') : ()),
@extras,
# DEFINE OPTIONS:
# NOTE: these should automatically be detected and configured above.
# see the $AUTODEFINES variable above.
#
# -DPROFILE
#
# Enable query profiling code (very little overhead).
# See ars_GetProfileInfo() call for details.
# Don't use this if you are compiling on _WIN32
#
# -DARS20
#
# If you are running ARS2.0.2 or anything less than 2.1, you should
# add -DARS20 to the DEFINE line.
#
# -DARS32
# If you are compiling against ARS 3.2 API libraries defined this
# because AdminExtension API routines were removed in as of
# the 3.2 release.
#
# -D_WIN32
#
# If you are compiling ARSperl under windows, define this
# and /don't/ define PROFILE.
#
# -DSKIP_SV_ISA (not automatically set)
#
# If you get errors during compilation/runtime similar to
# "undefined symbol: sv_isa" then add this define.
'DEFINE' => ${AUTODEFINES},
# 'DEFINE' => '-D_WIN32 ', # note: win32 -> no -DPROFILE
# if you have trouble under solaris when linking (bfd assertion
# failures) try uncommenting the following:
#
# 'LD' => "/usr/ccs/bin/ld",
# don't fiddle with this
'realclean' => {
'FILES' => 'support.h ARS/ar-h.pm ARS/arerrno-h.pm ARS/_h2ph_pre.ph t/config.cache serverTypeInfoHints.h *~ .purify '
}
);
makeTestConfig();
print "
Type 'make' (windows: 'nmake') to build ARSperl.
Type 'make test' to test ARSperl before installing.
Type 'make install' to install ARSperl.
";
exit 0;
# ROUTINE
# GenerateSupportDotH(template-file, includes-dir)
#
# DESCRIPTION
# this routine extracts some information from the
# "ar.h" file and generates some "type maps" which help
# us translate from code numbers to readable text.
sub GenerateSupportDotH {
my ($tmpl, $incdir) = (shift, shift);
my (@arh);
$incdir =~ s/^-I//g;
$incdir =~ s/^"//;
$incdir =~ s/"$//;
print "Generating support.h file..\n";
die "not a directory ($incdir): $!" if(! -d $incdir);
open(ARH, $incdir."/ar.h") || die "can't open $incdir/ar.h : $!";
@arh = <ARH>;
close(ARH);
open(FD, "> support.h") || die "can't open temporary file: $!";
open(TMPL, $tmpl) || die "can't open template ($tmpl): $!";
print FD "/* THIS FILE WAS AUTOMATICALLY GENERATED BY Makefile.PL */\n";
print FD "/* DO NOT EDIT */\n";
print FD "\n\n";
Makefile.PL view on Meta::CPAN
# values are the api version that release produced.
# add more values to this table as needed.
my $rh_api_version_table =
{
4.5 => 7,
4.51 => 7,
4.52 => 7,
5.0 => 8,
5.01 => 8,
5.1 => 9,
5.11 => 9,
5.12 => 9,
6.0 => 10,
6.01 => 10,
6.3 => 11,
};
my @api_list = ();
# make a sorted list from the api version / server release values
# that match our api version.
while (($server_rel, $api) = each %{$rh_api_version_table}) {
if ($api_version == $api) {
push @api_list, $server_rel;
}
}
# make sure the values are treated as numbers during the sort
my @sorted = sort { ($a + 0) <=> ($b + 0) }@api_list;
return $sorted[0];
}
sub findArLibs {
my $path_to_api_dir = shift;
my $cwd = getcwd();
my $ar_lib_dir = join('/', $path_to_api_dir, 'lib');
chdir($ar_lib_dir);
# we want all of the files that end in .lib on win32
my @libs = <*.lib>;
chdir($cwd);
return \@libs;
}
sub ARS_VERSION_45 { 7; }
sub ARS_VERSION_50 { 8; }
sub ARS_VERSION_51 { 9; }
sub ARS_VERSION_60 { 10; }
sub ARS_VERSION_63 { 11; }
sub ARS_VERSION_70 { 12; }
sub ARS_VERSION_71 { 13; }
sub ARS_VERSION_75 { 14; }
sub ARS_VERSION_760 { 15; }
sub ARS_VERSION_762 { 16; }
sub ARS_VERSION_763 { 17; }
sub ARS_VERSION_764 { 18; }
sub ARS_VERSION_80 { 19; }
sub ARS_VERSION_81 { 20; }
## @Devs: set the following constant always to the latest version supported by ARSPerl
sub ARS_MAX_API { ARS_VERSION_81; }
sub ARSVersionString {
my $APIVersionID = shift;
my $api2Version = {
&ARS_VERSION_45 => '4.5',
&ARS_VERSION_50 => '5.0',
&ARS_VERSION_51 => '5.1',
&ARS_VERSION_60 => '6.0',
&ARS_VERSION_63 => '6.3',
&ARS_VERSION_70 => '7.0',
&ARS_VERSION_71 => '7.1',
&ARS_VERSION_75 => '7.5',
&ARS_VERSION_760 => '7.6',
&ARS_VERSION_762 => '7.6',
&ARS_VERSION_763 => '7.6.03',
&ARS_VERSION_764 => '7.6.04',
&ARS_VERSION_80 => '8.0',
&ARS_VERSION_81 => '8.1',
};
if ($APIVersionID > ARS_MAX_API) { return "Unsupported API-Version: (using " . $api2Version{ARS_MAX_API} . ")"; }
if (!$APIVersionID || $APIVersionID < ARS_VERSION_45) { return "Unsupported API version!"; }
return $api2Version->{$APIVersionID};
};
( run in 0.688 second using v1.01-cache-2.11-cpan-39bf76dae61 )