From: Jeremy T. Bouse Date: Sun, 23 Mar 2003 07:01:20 +0000 (+0000) Subject: Solaris package build system X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=739ea144d276ca475730d0c928ed9fd82f3cba03;p=nagiosplug.git Solaris package build system git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@449 f882894a-f735-0410-b71e-b25c423dba1c --- diff --git a/Makefile.am b/Makefile.am index 3318259..8cc1514 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) diff --git a/autogen.sh b/autogen.sh index 0357d93..b833a30 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 && { diff --git a/configure.in b/configure.in index 035ae36..646519f 100644 --- a/configure.in +++ b/configure.in @@ -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]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 6353d01..4c99944 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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 index 0000000..be4b97f --- /dev/null +++ b/pkg/solaris/pkginfo.in @@ -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 index 0000000..0b82bce --- /dev/null +++ b/pkg/solaris/solpkg @@ -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 /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 () { + # 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 () { + # 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";