Re: Solaris Package Addon
- From: "Cory C. Omand" <Cory Omand Sun COM>
- To: GARNOME List <garnome-list gnome org>
- Subject: Re: Solaris Package Addon
- Date: Fri, 15 Aug 2003 09:08:07 -0700
Attachment fell off...
On Fri, 2003-08-15 at 08:35, Cory C. Omand wrote:
> All,
>
> Attached is an addon makefile for creating Solaris packages from meta
> targets or individual packages. It does not yet do 100% of what I would
> like it to do, but it's a start. Eventually, I would like to be able to
> execute a 'make pkgbuild' in a meta target directory, and have each
> dependency built and packaged individually. At the moment, I am having
> problems with the 'deep-%' rule for targets with no dependencies (they
> cause a make error 2), so the only functional target in the package is
> 'pkgmk', which can be executed after doing a meta-make to package up
> everything in $(DESTDIR)$(prefix).
>
> To add this to GARNOME, just append gar.pkg.mk to EXTRA_LIBS in your
> gar.conf.mk.
>
> Regards,
> Cory.
>
>
> -----------------------
> C. Omand - CA, USA
#
# Build Solaris Packages
#
# Overridable Package Variables
SPKG_PKGNAME ?= $(GARNAME)
SPKG_DESC ?= $(DESCRIPTION)
SPKG_VERSION ?= $(GARVERSION),REV=$(shell date '+%Y.%m.%d')
SPKG_CATEGORY ?= application
SPKG_BASEDIR ?= $(DESTDIR)$(prefix)
SPKG_CLASSES ?= none
SPKG_VENDOR ?= $(VENDORNAME)
SPKG_EMAIL ?= $(VENDOREMAIL)
SPKG_SPOOLDIR ?= /var/spool/pkg
# Temporary files
SPKG_PROTOTYPE = $(WORKSRC)/prototype
SPKG_PKGINFO = $(WORKSRC)/pkginfo
SPKG_TMPFILE = /tmp/prototype.$(GARNAME).$(SPKG_VERSION)
SPKG_BITSTREAM = $(SPKG_PKGNAME)_$(SPKG_VERSION)
SPKG_TSTAMP = /tmp/GAR.$(shell date '+%s')
# Solaris Package Admin Files
SPKG_ADMFILES = checkinstall preinstall preremove postinstall postremove
SPKG_ADMFILES += space depend
# Do a pkgtrans to create a bitstream package?
SPKG_DO_PACKAGE_TRANS ?= 1
# If DOTRANS = 1, delete spooled package after transfer?
SPKG_CLEAN_AFTER_TRANSFER ?= 1
# Verify that the architecture is supported
ARCH_OK = 0
ifeq ($(GARCH),sparc)
ARCH_OK = 1
endif
ifeq ($(GARCH),x86)
ARCH_OK = 1
endif
# Build the package info file
pkginfo:
ifeq ($(ARCH_OK),1)
ifneq ($(SPKG_PKGNAME),)
@echo "==> Creating pkginfo for $(CATEGORY)/$(GARNAME) ($(GARCH))"
@rm -vf $(PKGINFO_FILE)
@echo "PKG=$(SPKG_PKGNAME)" >> $(SPKG_PKGINFO)
@echo "NAME=$(DESCRIPTION)" >> $(SPKG_PKGINFO)
@echo "ARCH=$(GARCH)" >> $(SPKG_PKGINFO)
@echo "VERSION=$(SPKG_VERSION)" >> $(SPKG_PKGINFO)
@echo "CATEGORY=$(SPKG_CATEGORY)" >> $(SPKG_PKGINFO)
@echo "VENDOR=$(SPKG_VENDOR)" >> $(SPKG_PKGINFO)
@echo "EMAIL=$(SPKG_EMAIL)" >> $(SPKG_PKGINFO)
@echo "PSTAMP=$(SPKG_PSTAMP)" >> $(SPKG_PKGINFO)
@echo "BASEDIR=$(SPKG_BASEDIR)" >> $(SPKG_PKGINFO)
@echo "CLASSES=$(SPKG_CLASSES)" >> $(SPKG_PKGINFO)
@$(MAKECOOKIE)
else
@echo "==> (!!!) SPKG_PKGNAME not set for $(CATEGORY)/$(GARNAME)"
@false
endif
else
@echo "==> (!!!) Cannot build Solaris packages for GARCH = $(GARCH)"
@false
endif
reg-prototype: pkginfo
ifeq ($(ARCH_OK),1)
@echo "==> Creating prototype for $(CATEGORY)/$(GARNAME)"
@rm -vf $(SPKG_PROTOTYPE) $(SPKG_TMPFILE)
@echo "i pkginfo=pkginfo" >> $(SPKG_TMPFILE)
@for file in $(SPKG_ADMFILES); do \
if test -f $(FILEDIR)/$$file; then \
echo "i $$file=$(FILEDIR)/$$file" >> $(SPKG_TMPFILE); \
fi; \
done
@( cd $(DESTDIR)$(prefix); pkgproto . >> $(SPKG_TMPFILE) )
@mv -vf $(SPKG_TMPFILE) $(SPKG_PROTOTYPE)
@$(MAKECOOKIE)
else
@echo "==> (!!!) Cannot build Solaris packages for GARCH = $(GARCH)"
@false
endif
# Build the package prototype containing files installed
# since the last time the timestamp file was touched.
stamp-prototype: pkginfo
ifeq ($(ARCH_OK),1)
@echo "==> Creating stamp prototype for $(CATEGORY)/$(GARNAME)"
@rm -vf $(SPKG_PROTOTYPE) $(SPKG_TMPFILE)
@for file in $(SPKG_ADMFILES); do \
if test -f $(FILEDIR)/$$file; then \
echo "i $$file=$(FILEDIR)/$$file" >> $(SPKG_TMPFILE); \
fi; \
done
@( cd $(DESTDIR)$(prefix);\
find . -cnewer $(SPKG_TSTAMP) |\
pkgproto |\
sed -e 's/\.\///' >> $(SPKG_TMPFILE) )
@mv -vf $(SPKG_TMPFILE) $(SPKG_PROTOTYPE)
@$(MAKECOOKIE)
else
@echo "==> (!!!) Cannot build Solaris packages for GARCH = $(GARCH)"
@false
endif
# Build a package containing all files in $(DESTDIR)$(prefix)
pkgmk: reg-prototype
ifeq ($(ARCH_OK),1)
ifneq ($(SPKG_PKGNAME),)
@echo "==> Building package for $(CATEGORY)/$(GARNAME)"
@echo "==> Removing existing package from spool directory"
@rm -rf $(SPKG_SPOOLDIR)/$(SPKG_PKGNAME)
pkgmk -r $(DESTDIR)$(prefix) -f $(SPKG_PROTOTYPE)
ifeq ($(SPKG_DO_PACKAGE_TRANS),1)
@echo "==> Transferring $(SPKG_PKGNAME) to $(WORKDIR)"
@rm -rf $(WORKDIR)/$(SPKG_BITSTREAM)
pkgtrans -s $(SPKG_SPOOLDIR) /tmp/$(SPKG_BITSTREAM) $(SPKG_PKGNAME)
@mv /tmp/$(SPKG_BITSTREAM) $(WORKDIR)
ifeq ($(SPKG_CLEAN_AFTER_TRANSFER),1)
@echo "==> Removing $(SPKG_PKGNAME) from $(SPKG_SPOOLDIR)"
@rm -rf $(SPKG_SPOOLDIR)/$(SPKG_PKGNAME)
@$(MAKECOOKIE)
endif
endif
else
@echo "==> (!!!) SPKG_PKGNAME not set for $(CATEGORY)/$(GARNAME)"
@false
endif
else
@echo "==> (!!!) Cannot build Solaris packages for GARCH = $(GARCH)"
@false
endif
# Build it and package it up
pkgbuild: timestamp install stamp-prototype
ifeq ($(ARCH_OK),1)
ifneq ($(SPKG_PKGNAME),)
@echo "==> Building package for $(CATEGORY)/$(GARNAME)"
@echo "==> Removing old package from spool directory"
@rm -rf $(SPKG_SPOOLDIR)/$(SPKG_PKGNAME)
pkgmk -r $(DESTDIR)$(prefix) -f $(SPKG_PROTOTYPE)
ifeq ($(SPKG_DO_PACKAGE_TRANS),1)
@echo "==> Transferring $(SPKG_PKGNAME) to $(WORKDIR)"
@rm -rf $(WORKDIR)/$(SPKG_PKGNAME)_$(SPKG_VERSION)
pkgtrans -s $(SPKG_SPOOLDIR) $(WORKDIR)/$(SPKG_PKGNAME)_$(SPKG_VERSION) $(SPKG_PKGNAME)
@rm -f $(SPKG_TSTAMP)
@$(MAKECOOKIE)
endif
else
@echo "==> (!!!) SPKG_PKGNAME not set for $(CATEGORY)/$(GARNAME)"
@false
endif
else
@echo "==> (!!!) Cannot build Solaris packages for GARCH = $(GARCH)"
@false
endif
# Create a pre-install timestamp
timestamp:
@echo "==> Recording build start time"
@touch $(SPKG_TSTAMP)
ifeq ($(CATEGORY),meta)
package: pkgmk
else
package: deep-pkgbuild
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]