summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-09-13 11:36:57 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2007-09-13 11:36:57 (GMT)
commit0708e6fa812387214ca1da00d8bad941a2ad5aff (patch)
tree6c544412e666c80a3600f8e33f6a466c714a3328
parent29d5acb7c821c8be23b32be9e01b242efad5b872 (diff)
downloadmonitoring-plugins-0708e6fa812387214ca1da00d8bad941a2ad5aff.tar.gz
Adding in optional Nagios::Plugin perl module (and
dependencies) compilation and installation git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1777 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--Makefile.am7
-rw-r--r--configure.in12
-rw-r--r--perlmods/Class-Accessor-0.31.tar.gzbin0 -> 10964 bytes
-rw-r--r--perlmods/Config-Tiny-2.10.tar.gzbin0 -> 23969 bytes
-rw-r--r--perlmods/Makefile.am13
-rw-r--r--perlmods/Math-Calc-Units-1.06.tar.gzbin0 -> 33916 bytes
-rw-r--r--perlmods/Nagios-Plugin-0.20.tar.gzbin0 -> 39231 bytes
-rw-r--r--perlmods/Params-Validate-0.88.tar.gzbin0 -> 79925 bytes
-rw-r--r--perlmods/Test-Simple-0.70.tar.gzbin0 -> 77621 bytes
-rw-r--r--perlmods/install_order7
-rwxr-xr-xtools/build_perl_modules86
11 files changed, 122 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index b76bf76..5c25f33 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
1## Process this file with automake to produce Makefile.in 1## Process this file with automake to produce Makefile.in
2 2
3SUBDIRS = gl lib plugins plugins-scripts plugins-root po 3SUBDIRS = gl lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@
4 4
5EXTRA_DIST = config.rpath \ 5EXTRA_DIST = config.rpath \
6 ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CODING FAQ LEGAL NEWS \ 6 ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CODING FAQ LEGAL NEWS \
@@ -23,8 +23,9 @@ install-root:
23 23
24test: 24test:
25 cd lib && $(MAKE) test 25 cd lib && $(MAKE) test
26 cd plugins; $(MAKE) test 26 if test "$(PERLMODS_DIR)" != ""; then cd perlmods && $(MAKE) test; fi
27 cd plugins-scripts; $(MAKE) test 27 cd plugins && $(MAKE) test
28 cd plugins-scripts && $(MAKE) test
28 29
29nagios-plugins.spec: nagios-plugins.spec.in 30nagios-plugins.spec: nagios-plugins.spec.in
30 sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@ 31 sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@
diff --git a/configure.in b/configure.in
index 86f3780..9067978 100644
--- a/configure.in
+++ b/configure.in
@@ -1503,6 +1503,16 @@ elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
1503 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen]) 1503 AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
1504fi 1504fi
1505 1505
1506dnl Perl modules
1507AC_ARG_ENABLE(perl-modules,
1508 AC_HELP_STRING([--enable-perl-modules],
1509 [Enables installation of Nagios::Plugin and its dependencies (default: no)]),
1510 [enable_perl_modules=$enableval],
1511 [enable_perl_modules=no])
1512if test "$enable_perl_modules" = "yes" ; then
1513 AC_SUBST(PERLMODS_DIR,perlmods)
1514fi
1515
1506dnl External libraries - see ACKNOWLEDGEMENTS 1516dnl External libraries - see ACKNOWLEDGEMENTS
1507gl_INIT 1517gl_INIT
1508 1518
@@ -1521,6 +1531,7 @@ AC_OUTPUT(
1521 plugins-scripts/subst 1531 plugins-scripts/subst
1522 plugins-scripts/utils.pm 1532 plugins-scripts/utils.pm
1523 plugins-scripts/utils.sh 1533 plugins-scripts/utils.sh
1534 perlmods/Makefile
1524 command.cfg 1535 command.cfg
1525 test.pl 1536 test.pl
1526 pkg/solaris/pkginfo 1537 pkg/solaris/pkginfo
@@ -1558,6 +1569,7 @@ ACX_FEATURE([with],[mysql])
1558ACX_FEATURE([with],[openssl]) 1569ACX_FEATURE([with],[openssl])
1559ACX_FEATURE([with],[gnutls]) 1570ACX_FEATURE([with],[gnutls])
1560ACX_FEATURE([with],[perl]) 1571ACX_FEATURE([with],[perl])
1572ACX_FEATURE([enable],[perl-modules])
1561ACX_FEATURE([with],[cgiurl]) 1573ACX_FEATURE([with],[cgiurl])
1562ACX_FEATURE([with],[trusted-path]) 1574ACX_FEATURE([with],[trusted-path])
1563 1575
diff --git a/perlmods/Class-Accessor-0.31.tar.gz b/perlmods/Class-Accessor-0.31.tar.gz
new file mode 100644
index 0000000..21ed674
--- /dev/null
+++ b/perlmods/Class-Accessor-0.31.tar.gz
Binary files differ
diff --git a/perlmods/Config-Tiny-2.10.tar.gz b/perlmods/Config-Tiny-2.10.tar.gz
new file mode 100644
index 0000000..389c406
--- /dev/null
+++ b/perlmods/Config-Tiny-2.10.tar.gz
Binary files differ
diff --git a/perlmods/Makefile.am b/perlmods/Makefile.am
new file mode 100644
index 0000000..ebed523
--- /dev/null
+++ b/perlmods/Makefile.am
@@ -0,0 +1,13 @@
1perlmoduledir = $(exec_prefix)/perl
2
3all-local:
4 $(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -m .
5
6install-exec-local:
7 $(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -i .
8
9test:
10 $(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -t .
11
12clean-local:
13 $(top_srcdir)/tools/build_perl_modules -d $(perlmoduledir) -c .
diff --git a/perlmods/Math-Calc-Units-1.06.tar.gz b/perlmods/Math-Calc-Units-1.06.tar.gz
new file mode 100644
index 0000000..a5d2360
--- /dev/null
+++ b/perlmods/Math-Calc-Units-1.06.tar.gz
Binary files differ
diff --git a/perlmods/Nagios-Plugin-0.20.tar.gz b/perlmods/Nagios-Plugin-0.20.tar.gz
new file mode 100644
index 0000000..a9c2d3c
--- /dev/null
+++ b/perlmods/Nagios-Plugin-0.20.tar.gz
Binary files differ
diff --git a/perlmods/Params-Validate-0.88.tar.gz b/perlmods/Params-Validate-0.88.tar.gz
new file mode 100644
index 0000000..05a0167
--- /dev/null
+++ b/perlmods/Params-Validate-0.88.tar.gz
Binary files differ
diff --git a/perlmods/Test-Simple-0.70.tar.gz b/perlmods/Test-Simple-0.70.tar.gz
new file mode 100644
index 0000000..44f1b54
--- /dev/null
+++ b/perlmods/Test-Simple-0.70.tar.gz
Binary files differ
diff --git a/perlmods/install_order b/perlmods/install_order
new file mode 100644
index 0000000..591a009
--- /dev/null
+++ b/perlmods/install_order
@@ -0,0 +1,7 @@
1# Modules installed in this order
2Test-Simple
3Params-Validate
4Math-Calc-Units
5Class-Accessor
6Config-Tiny
7Nagios-Plugin
diff --git a/tools/build_perl_modules b/tools/build_perl_modules
new file mode 100755
index 0000000..fb47145
--- /dev/null
+++ b/tools/build_perl_modules
@@ -0,0 +1,86 @@
1#!/usr/bin/perl
2# SYNTAX:
3# build_perl_modules -d dest_dir [-c] [-m] [-t] [-i] tarball_dir
4#
5# DESCRIPTION:
6# Installs perl modules found in tarball_dir
7# Expects a file called install_order, containing one line per distribution name
8# Will take action against each distribution in turn
9# -d is a necessary destination directory for the perl mods
10# If -c is set, will remove the module build directories and exit
11# If -m is set, will run perl Makefile.PL and make
12# If -t is set, will run make test
13# If -i is set, will run make install
14# Options are discrete. This is because an overall ./configure, make, make test, make install
15# are run in different invocations. Obviously, you can't run a -t without a -m, but there's no
16# checking here for that
17
18# Can only use base modules
19use warnings;
20use strict;
21use Config;
22use Getopt::Std;
23use Cwd;
24use File::Path;
25
26my $opts = {};
27getopts('d:cmti', $opts) || die "Invalid options";
28my $moddir = shift @ARGV or die "Must specify a directory where tarballs exist";
29
30my $destdir = $opts->{d};
31die "Must set a destination directory" unless $destdir;
32
33chdir $moddir or die "Cannot change to $moddir";
34open F, "install_order" or die "Cannot open install_order file";
35my @files = grep { ! /^#/ && chop } <F>;
36close F;
37
38my @tarballs;
39foreach my $f (@files) {
40 # Needs to be better. Also, what if there are two with same name?
41 my $tarball;
42 eval '$tarball = <'."$f".'*.tar.gz>';
43 die unless ($tarball);
44 print "Got $f, with file: $tarball",$/;
45 push @tarballs, $tarball;
46 (my $dir = $tarball) =~ s/\.tar.gz//;
47 # Need to do cleaning before doing each module in turn
48 if ($opts->{c}) {
49 print "Cleaning $dir",$/;
50 rmtree($dir);
51 }
52}
53
54if ($opts->{c}) {
55 print "Finished cleaning",$/;
56 exit;
57}
58
59my $topdir = cwd();
60foreach my $tarball (@tarballs) {
61 (my $dir = $tarball) =~ s/\.tar.gz//;
62 if ($opts->{m}) {
63 # Don't compile if already done - this is because of invocating this
64 # script at different stages
65 unless (-e $dir) {
66 system("gunzip -c $tarball | tar -xf -") == 0 or die "Cannot extract $tarball";
67 chdir $dir or die "Can't chdir into $dir";
68 system("perl Makefile.PL PREFIX=$destdir INSTALLDIRS=site LIB=$destdir/lib") == 0 or die "Can't run perl Makefile.PL";
69 system("make") == 0 or die "Can't run make";
70 chdir $topdir or die "Can't chdir to top";;
71 }
72 }
73
74 chdir $dir or die "Can't chdir into $dir";
75
76 # Need to add this so this module is found for subsequent ones
77 $ENV{PERL5LIB}="$topdir/$dir/blib/lib:$ENV{PERL5LIB}";
78
79 if ($opts->{t}) {
80 system("make test") == 0 or die "Can't run make test failed";
81 }
82 if ($opts->{i}) {
83 system("make install SITEPREFIX=$destdir") == 0 or die "Can't run make install";
84 }
85 chdir $topdir or die "Can't go back to $topdir";
86}