# # csbs.m4 - template for creating solaris/Makefile which enable solaris # package building from within patched upstream tarball. see csbs(7). # # This file is maintained using GNU Arch on http://mdcc.cx/csbs/2005-csbs/ # Copyright (C) 2003, 2004 Tilburg University http://www.uvt.nl/ # Copyright (C) 2005 Joost van Baal # # This file is free software; you can redistribute it and/or modify # it under the terms as stated in the file LICENSE. # # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This file based upon the Makefile shipped with # http://non-gnu.uvt.nl/pub/nagios-plugins/solaris/src/nagios-plugins-1.3.1_3.diff.gz define([CSBS_BANNER], [# solaris/Makefile - enable Solaris package building from within patched # upstream tarball # # Generated from Makefile.m4 and csbs.m4 # on ]CSBS_HOSTNAME[ by ]CSBS_ID[ at ]CSBS_DATE[. # # Copyright (C) 2003, 2004 Tilburg University http://www.uvt.nl/ # Copyright (C) 2005 Joost van Baal # # This file is free software; you have unlimited permission to copy, # distribute and modify this Makefile. # # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See the file LICENSE as distributed with CSBS ( http://mdcc.cx/csbs/ ) # for more details. # ]) define([VARIABLES], [ [VENDORTAG] = CSBS_VENDORTAG [TARNAME] = CSBS_TARNAME [UPVERSION] = CSBS_UPVERSION [PKGVERSION] = CSBS_PKGVERSION # max 6 chars: some old solaris-en break otherwise [SHORTTARNAME] = CSBS_SHORTTARNAME # call make as e.g. # # make -e -f solaris/Makefile OSVERSION=sol7 # # to overrule this default OSVERSION = sol10 # # sparc, i386, all [ARCH] = CSBS_ARCH # # sunfreeware uses ``local'' EXT = pkg INSTALLROOT = `pwd`/install # should be absolute path PKGROOT = /var/tmp PREFIX = /usr/local VERSION = $(UPVERSION)_$(PKGVERSION) SRCPKGFILENAME = $(TARNAME)-$(VERSION) PKGFILENAME = $(SRCPKGFILENAME)-$(OSVERSION)-$(ARCH)-$(EXT) PKGNAME = $(VENDORTAG)$(SHORTTARNAME) DOCDIR = $(PREFIX)/share/doc/$(TARNAME)]) ############ # the rules ############ # binary rules define([ALL_RULE], [ all: binary-stamp]) define([BINARY_STAMP_RULE], [ binary-stamp: zip-stamp @ls -l $(PKGROOT)/$(PKGFILENAME) @ls -l $(PKGROOT)/$(PKGFILENAME).gz touch binary-stamp]) define([ZIP_STAMP_RULE], [ zip-stamp: pkgtrans-stamp cd $(PKGROOT); gzip -c $(PKGFILENAME) > $(PKGFILENAME).gz touch zip-stamp]) define([PKGTRANS_STAMP_RULE], [ pkgtrans-stamp: pkgmk-stamp cd $(PKGROOT); pkgtrans -s `pwd` $(PKGFILENAME) $(PKGNAME) touch pkgtrans-stamp]) ## define([PKGMK_STAMP_RULE], [ ## pkgmk-stamp: install-stamp]) define([PKGMK_STAMP_RULE], [ pkgmk-stamp: pkgproto-stamp cd $(INSTALLROOT); pkgmk -o -d $(PKGROOT) -r `pwd` touch pkgmk-stamp]) define([PKGPROTO_STAMP_RULE], [ pkgproto-stamp: install-stamp touch pkgproto-stamp]) ## # if we dynamically generate the prototype file, use something like: ## pkgproto-stamp: install-stamp ## (cd $(INSTALLROOT); find usr/local/lib/nagios/plugins -type f | while read f; do echo f none $$f; done) > prototype.inc ## mv prototype.inc $(INSTALLROOT) ## cp solaris/prototype solaris/pkginfo $(INSTALLROOT) ## touch pkgproto-stamp ## # See http://non-gnu.uvt.nl/pub/nrpe/solaris/src/ for an alternative ## # way to deal with this. define([INSTALL_STAMP_RULE], [ install-stamp: build-stamp native-install-stamp solaris-install-stamp touch install-stamp]) define([BUILD_STAMP_RULE], [ build-stamp: configure-stamp make touch build-stamp]) define([CONFIGURE_STAMP_RULE], [ configure-stamp: ./configure touch configure-stamp]) define([NATIVE_INSTALL_STAMP_RULE], [ native-install-stamp: build-stamp # solaris make needs -e for overwriting macros make -e install DESTDIR=$(INSTALLROOT) touch native-install-stamp]) ## just before touch-insta native-install-stamp, and if ``make install'' ## does not install documentation, one could do stuff like: ## ## mkdir -p $(INSTALLROOT)$(DOCDIR)/examples ## cp AUTHORS COPYING ChangeLog FAQ LEGAL NEWS README SUPPORT $(INSTALLROOT)/usr/local/share/doc/$(TARNAME) define([SOLARIS_INSTALL_STAMP_RULE], [ solaris-install-stamp: build-stamp pkginfo-stamp mkdir -p $(INSTALLROOT)$(DOCDIR) cp solaris/README.Solaris $(INSTALLROOT)$(DOCDIR) for f in pkginfo prototype preinstall postinstall; do \ if test -f solaris/$$f; then cp solaris/$$f $(INSTALLROOT); fi; done touch solaris-install-stamp]) define([PKGINFO_STAMP_RULE], [ pkginfo-stamp: sed "s/@VERSION@/$(VERSION)/; s/@PKGNAME@/$(PKGNAME)/; s/@TARNAME@/$(TARNAME)/; s/@ARCH@/$(ARCH)/" \ < solaris/pkginfo.in > solaris/pkginfo touch pkginfo-stamp]) # clean rules define([CLEAN_STAMP_RULE], [ clean-stamp: solaris-clean-stamp touch clean-stamp]) define([CLEAN_RULE], [ clean: clean-stamp]) define([SOLARIS_CLEAN_STAMP_RULE], [ solaris-clean-stamp: rm -r $(INSTALLROOT) touch solaris-clean-stamp]) # source rules define([SOURCE_STAMP_RULE], [ source-stamp: @echo make sure ../$(TARNAME)-$(UPVERSION).orig and ../$(TARNAME)-$(UPVERSION) are clean! # clean up csbs.m4 symlink: not needed in source package rm -f solaris/csbs.m4 cd ..; diff -Pdur $(TARNAME)-$(UPVERSION).orig $(TARNAME)-$(UPVERSION) | gzip -c > $(SRCPKGFILENAME).diff.gz @ls -l ../$(SRCPKGFILENAME).diff.gz touch source-stamp]) define([SOURCE_RULE], [ source: source-stamp]) # internal rules define([MAKEFILE_RULE], [ Makefile: Makefile.m4 sh ./makeMakefile]) ################## # groups of rules ################## define([ALL_RULES], [ALL_RULE]) define([BINARY_RULES], [BINARY_STAMP_RULE ZIP_STAMP_RULE PKGTRANS_STAMP_RULE PKGMK_STAMP_RULE PKGPROTO_STAMP_RULE INSTALL_STAMP_RULE BUILD_STAMP_RULE CONFIGURE_STAMP_RULE NATIVE_INSTALL_STAMP_RULE SOLARIS_INSTALL_STAMP_RULE PKGINFO_STAMP_RULE]) define([CLEAN_RULES], [CLEAN_STAMP_RULE CLEAN_RULE SOLARIS_CLEAN_STAMP_RULE]) define([SOURCE_RULES], [SOURCE_STAMP_RULE SOURCE_RULE]) define([INTERNAL_RULES], [MAKEFILE_RULE]) define([CSBS_ALL], [CSBS_BANNER VARIABLES ALL_RULES BINARY_RULES CLEAN_RULES SOURCE_RULES INTERNAL_RULES ])