Well, I completely reworked it.  The new version:

* Incorporates any special files created in a "src/" directory (such
as src/var/lib/lprkg/pkg.help or root/.myconf or
src/var/lib/lrpkg/pkg.conf).

* Makes the current source tree, not just the LRP file - this permits
recording the options used to compile.

* Much cleaner dependencies between source binary files and
destination files.  This, however, depends on the person editing the
Makefile knows how to create makefiles.... probably a good assumption,
yes?

Here is an example, including tar file (it's pretty small - 27k).

eject-2.0.4.tar.gz

diff -uNr eject-2.0.4/lrp/Makefile eject-2.0.4-lrp/lrp/Makefile
--- eject-2.0.4/lrp/Makefile    Wed Dec 31 18:00:00 1969
+++ eject-2.0.4-lrp/lrp/Makefile        Wed May  9 10:35:47 2001
@@ -0,0 +1,14 @@
+# Quick Make; real code is in pkg/Makefile
+
+all:
+       cd pkg ; make all
+
+clean:
+       cd pkg ; make clean
+
+distclean:
+       cd pkg ; make distclean
+
+spotless:
+       cd pkg ; make spotless
+
diff -uNr eject-2.0.4/lrp/Makefile.inc eject-2.0.4-lrp/lrp/Makefile.inc
--- eject-2.0.4/lrp/Makefile.inc        Wed Dec 31 18:00:00 1969
+++ eject-2.0.4-lrp/lrp/Makefile.inc    Wed May  9 10:39:16 2001
@@ -0,0 +1,45 @@
+#----------------------------------------
+#  PACKAGE SPECIFICS
+#----------------------------------------
+# Modify the following for the package being created.
+
+# Package name
+PKG = eject
+
+# Location to output the package...
+OUTPUTDIR = ..
+
+# Location of source directory.
+# In most cases, you should NOT change this...
+SRC = ../..
+
+# Location of special file tree to include in package.
+# In most cases, you should NOT change this...
+SRCTREE = $(SRC)/lrp/src
+
+# Source tar file dependencies
+# ...these are *NOT* resolved, but must be redone
+# one level up
+DEPS = bin/eject
+
+# Source filename and destination directory pairs
+bin/eject: $(SRC)/eject
+       mkdir -p $$(dirname $@)
+       cp -af $< $@
+
+# Source file: how to make it...
+$(SRC)/eject:
+       cd $(SRC) ; gcc-2.0 make -e
+
+# Version numbers of this binary and package
+VERSION = 2.0.4
+RELEASE = 1
+
+# Man page source
+MANPAGE = $(SRC)/eject.1
+
+# These are the destination help and conf files;
+# if these files will not exist comment the line out
+HELPF = $(LRPKG)/$(PKG).help
+# CONFF = $(LRPKG)/$(PKG).conf
+
diff -uNr eject-2.0.4/lrp/README eject-2.0.4-lrp/lrp/README
--- eject-2.0.4/lrp/README      Wed Dec 31 18:00:00 1969
+++ eject-2.0.4-lrp/lrp/README  Wed May  9 10:42:20 2001
@@ -0,0 +1,20 @@
+MAKING AN LRP PACKAGE
+
+To create the package, change to this directory and run:
+
+   make
+
+The package will be located in this directory when done if all is well.
+If the package is not yet built, this will build it.
+
+It is also possible to do:
+
+   make clean
+   make distclean
+   make spotless
+
+Any of these will clean out this directory of any previous makes.
+These will NOT clean the binary's source tree.
+
+To change any of the defaults, edit the file Makefile.inc.
+
diff -uNr eject-2.0.4/lrp/pkg/Makefile eject-2.0.4-lrp/lrp/pkg/Makefile
--- eject-2.0.4/lrp/pkg/Makefile        Wed Dec 31 18:00:00 1969
+++ eject-2.0.4-lrp/lrp/pkg/Makefile    Wed May  9 10:40:54 2001
@@ -0,0 +1,85 @@
+#----------------------------------------
+#  PACKAGE SPECIFICS
+#----------------------------------------
+
+# Location of source directory.
+# In most cases, you should NOT change this...
+SRC = ../..
+
+include $(SRC)/lrp/Makefile.inc
+
+all: $(OUTPUTDIR)/$(PKG).lrp
+
+#----------------------------------------
+#  GENERAL
+#----------------------------------------
+
+SHELL = /bin/ksh
+DIRS = bin sbin usr etc lib
+LRPKG = var/lib/lrpkg
+DOCS = usr/share/doc
+PKGDOCS = $(DOCS)/$(PKG)-$(VERSION)
+LISTF = $(LRPKG)/$(PKG).list
+VRSNF = $(LRPKG)/$(PKG).version
+PKGFILES = $(LISTF) $(HELPF) $(CONFF) $(VRSNF)
+
+$(SRCTREE):
+       - cp -af $(SRC)/lrp/src/* .
+
+# pkg.conf: contains a list of configuration files with
+#           optional description (separated by tab)
+
+$(CONFF):
+       [ -d $(LRPKG) ] || mkdir -p $(LRPKG)
+       if [ -n "$(CONFFILE)" -a -f "$(CONFFILE)" ] ; then \
+       cp -a $(CONFFILE) $(CONFF) ; \
+       fi
+
+# pkg.list: contains a list of ambiguous filenames and
+#           paths - files to be included in the package
+
+$(LISTF):
+       [ -d $(LRPKG) ] || mkdir -p $(LRPKG)
+       echo $(DEPS) >> $(LISTF)
+       echo "var/lib/lrpkg/$(PKG).*" >> $(LISTF)
+
+# pkg.version: contains the version of this package
+
+$(VRSNF):
+       [ -d $(LRPKG) ] || mkdir -p $(LRPKG)
+       echo $(VERSION)-$(RELEASE) > $(VRSNF)
+
+# pkg.help: a help file for the package
+
+$(HELPF):
+       [ -d $(LRPKG) ] || mkdir -p $(LRPKG)
+       if [ -n "$(HELPFILE)" -a -f "$(HELPFILE)" ] ; then \
+               cp -a $(HELPFILE) $(HELPF) ; \
+       else \
+               if [ -n "$(MANPAGE)" ] ; then \
+                       nroff -man $(MANPAGE) > $(HELPF) ; \
+               fi ; \
+       fi
+
+# create the actual package here
+
+$(OUTPUTDIR)/$(PKG).lrp: $(SRCTREE) $(PKGFILES) $(DEPS)
+       @ echo "Stripping files..."
+       - find . \( -path './lib' -prune -o -path './usr/lib' -prune \) -o -type f 
+-print | xargs strip 2> /dev/null
+       @ echo "Making package $(PKG).lrp"
+       tar cvf - $$(cat $(LISTF)) | gzip -9 -c - > $(OUTPUTDIR)/$(PKG).lrp
+       @ tar tzvf $@
+
+# cleanup:
+#
+#     clean - general cleanup
+#  spotless - clean out ALL nondistributed stuff
+# distclean - another (more common) name for spotless
+
+clean: distclean
+
+spotless: distclean
+
+distclean:
+       rm -rf $(OUTPUTDIR)/$(PKG).lrp ./[a-z]*
+

Reply via email to