Code

Solaris package build system
authorJeremy T. Bouse <undrgrid@users.sourceforge.net>
Sun, 23 Mar 2003 07:01:20 +0000 (07:01 +0000)
committerJeremy T. Bouse <undrgrid@users.sourceforge.net>
Sun, 23 Mar 2003 07:01:20 +0000 (07:01 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@449 f882894a-f735-0410-b71e-b25c423dba1c

Makefile.am
autogen.sh
configure.in
lib/Makefile.am
pkg/solaris/pkginfo.in [new file with mode: 0644]
pkg/solaris/solpkg [new file with mode: 0755]

index 3318259388c621bdb776d3e7d488d783ad44216c..8cc151445d4dbc949d879a7fe06ee774631ecc7d 100644 (file)
@@ -3,7 +3,7 @@
 SUBDIRS = lib plugins plugins-scripts
 
 EXTRA_DIST = CODING FAQ LEGAL REQUIREMENTS SUPPORT \
-       Helper.pm       contrib nagios-plugins.spec.in
+       Helper.pm contrib pkg nagios-plugins.spec.in
 
 ACLOCAL_AMFLAGS = -I lib
 
@@ -18,31 +18,17 @@ nagios-plugins.spec: nagios-plugins.spec.in
        sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $? > $@
 
 # Solaris pkgmk
-PACKDIR=build-pkg
+BUILDDIR=`pwd`/build-solaris
+PACKDIR=`pwd`/build-pkg
 VERSION=@PACKAGE_VERSION@
 
-Prototype:
+solpkg:
+       if [ ! -d $(BUILDDIR) ] ; then mkdir $(BUILDDIR); fi
        if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
-       cd build-solaris
        $(MAKE) all
-       $(MAKE) DESTDIR=../$(PACKDIR) install
-       cd ..
-       echo i pkginfo> Prototype
-       if [ -f checkinstall ] ; then echo i checkinstall>> Prototype; fi
-       if [ -f preinstall ] ; then echo i preinstall>> Prototype; fi
-       if [ -f postinstall ] ; then echo i postinstall>> Prototype; fi
-       pkgproto $(PACKDIR)=/ | sed -e "s|$(LOGNAME) $(GROUP)$$|root root|" | egrep -v "(s|d) none (/|/etc|/var|/usr|/usr/local) " >> Prototype
-
-pkgmap: ../Prototype
-       mkdir -p $(PACKDIR)/nagiosp
-       cd $(PACKDIR)/nagiosp
-       pkgmk -o -r / -f ../Prototype -d $(PACKDIR) nagiosp
-       cd ..
-
-nagios.SPARC.pkg.tar.gz: pkgmap
-       cd $(PACKDIR) && tar -cf - nagiosp | gzip -9 -c > ../nagiosp.SPARC.pkg.tar.gz
-
-pkgset: nagiosp.SPARC.pkg.tar.gz
+       $(MAKE) DESTDIR=$(BUILDDIR) install
+       $(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
+       $(cd $(BUILDDIR) && `pwd`/pkg/solaris/solpkg $(PACKDIR))
 
 pkgclean:
-       rm -rf Prototype nagiosp.SPARC.pkg.tar.gz
+       rm -rf $(BUILDDIR) $(PACKDIR)
index 0357d93af9e2642944f9a3d9d76689951a915c3e..b833a3083e3463108240b7f81905e03e37745df5 100755 (executable)
@@ -19,18 +19,13 @@ else
 fi
 
 # Refresh GNU autotools toolchain.
-for i in config.guess config.sub missing install-sh mkinstalldirs ; do
+for i in config.guess config.sub missing install-sh mkinstalldirs depcomp; do
        test -r /usr/share/automake/${i} && {
                rm -f ${i}
-               cp /usr/share/automake/${i} .
        }
-       chmod 755 ${i}
 done
 
-aclocal -I lib
-autoheader
-automake -c -a
-autoconf
+tools/setup
 
 # For the Debian build
 test -d debian && {
index 035ae36ef253e143d8fd02b1b3ad791f2fe407f0..646519f89d3b86671e9cc329a5c3eac669ae4bc8 100644 (file)
@@ -99,6 +99,14 @@ ac_cv_uname_s=`uname -s`
 ac_cv_uname_r=`uname -r`
 ac_cv_uname_v=`uname -v`
 
+PKG_ARCH=`uname -p`
+REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
+REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
+
+AC_SUBST(PKG_ARCH)
+AC_SUBST(REV_DATESTAMP)
+AC_SUBST(REV_TIMESTAMP)
+
 dnl Checks for programs.
 AC_PATH_PROG(PYTHON,python)
 AC_PATH_PROG(PERL,perl)
@@ -1469,7 +1477,7 @@ AC_SUBST(DEPLIBS)
 
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
 
-AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,PATH=.:..:$PATH command.cfg)
+AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo)
 
 ACX_FEATURE([with],[cgiurl])
 ACX_FEATURE([with],[nagios-user])
index 6353d01c343726671741a5bb47b4aec7294366ec..4c99944dc107449b4fff16fd7583e054a552c887 100644 (file)
@@ -6,4 +6,6 @@ noinst_HEADERS = getopt.h fsusage.h mountlist.h
 
 libnagiosplug_a_SOURCES = getopt.c getopt1.c getloadavg.c snprintf.c fsusage.c mountlist.c
 
+EXTRA_DIST = afs.m4 fstypename.m4 fsusage.m4 ls-mntd-fs.m4
+
 INCLUDES = -I$(srcdir)
diff --git a/pkg/solaris/pkginfo.in b/pkg/solaris/pkginfo.in
new file mode 100644 (file)
index 0000000..be4b97f
--- /dev/null
@@ -0,0 +1,12 @@
+PKG="NPDTplugins"
+NAME="nagiosplugins"
+DESC="Nagios network monitoring plugins"
+ARCH="@PKG_ARCH@"
+VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@"
+CATEGORY="application"
+VENDOR="Nagios Plugin Development Team"
+EMAIL="nagiosplug-devel@lists.sourceforge.net"
+PSTAMP="sfw@REV_TIMESTAMP@"
+BASEDIR="/usr/local"
+CLASSES="none"
+
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg
new file mode 100755 (executable)
index 0000000..0b82bce
--- /dev/null
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+
+$pkgdevice = $ARGV[0] || die "Unable to determine device ($!)\n";
+
+$find = "/usr/bin/find";
+$pkgproto = "/usr/bin/pkgproto";
+$pkgmk = "/usr/bin/pkgmk";
+$pkgtrans = "/usr/bin/pkgtrans";
+$prototype = "prototype";
+$pkginfo = "pkginfo";
+
+# Sanity check
+
+$pwd = `pwd`;
+if ($pwd =~ '\/usr\/local') {
+        $pwd = $`;
+}            
+die  "Wrong location, please cd to <PKGBASE>/usr/local/ and run again.\n"
+        if ($pwd eq "");
+
+open (PREPROTO,"$find . -print |$pkgproto |") ||
+       die "Unable to read prototype information ($!)\n";
+open (PROTO,">$prototype") ||
+       die "Unable to write file prototype ($!)\n";
+print PROTO "i pkginfo=./$pkginfo\n";
+while (<PREPROTO>) {
+       # Read in the prototype information
+       chomp;
+       $thisline = $_;
+       if ($thisline =~ " prototype "
+         or $thisline =~ " pkginfo ") {
+           # Don't do anything as they aren't important
+       } elsif ($thisline =~ "^[fd] ") {
+         # Change the ownership of files and directories
+         ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
+         print PROTO "$dir $none $file $mode bin bin\n";
+       } else {
+         # Symlinks and other stuff should be printed also
+         print PROTO "$thisline\n";
+       }
+}
+close PROTO;
+close PREPROTO;
+
+# Now we can start building the package
+
+$os = `uname -r`;
+$os =~ '\.'; 
+$os = "sol$'";
+chomp $os;   
+
+open (PKGINFO,"<$pkginfo") ||
+       die "Unable to read package information ($!)\n";
+while (<PKGINFO>) {
+       # Read in the package information
+       chomp;
+       $thisline = $_;
+       ($var,$value) = split /=/,$thisline;
+       if ("$var" eq "NAME" 
+         or "$var" eq "VERSION"
+         or "$var" eq "ARCH") {
+               $tmp = lc($var);
+               $value =~ s/\"//g;
+               if ("$tmp" eq "version"
+                 and $value =~ ",REV") {
+                       ($value,$var) = split /\,/,$value;
+                       $$tmp = $value;
+               } else {
+                       $$tmp = $value;
+               }
+       }
+}      
+close PKGINFO;
+
+$packagename = "$name-$version-$os-$arch-local";
+
+print "Building package\n";
+system ("$pkgmk -o -r `pwd` -d $pkgdevice");
+system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)");
+print "Done. ($packagename)\n";