csbs - Common Solaris Build System
CSBS is a system for creating things which could be regarded as Solaris Source Packages. It is inspired by cdbs, the Common Debian Build System ( http://packages.debian.org/unstable/devel/cdbs ).
Differences with cdbs: csbs-generated source packages are usable on systems which don't have csbs installed.
Likely, you want one of these 3 things
Fetch the prebuild binary package for your Solaris version - likely it is called something like foobar-n.m_k-sol8-sparc-local.gz - and install that one, using pkgadd(1). If there is no prebuild package supplied which suits your needs, read on.
pkgadd -d foobar-n.m_k-sol8-sparc-local
If there is a Solaris source package supplied - likely it is called something like foobar-n.m_k.diff.gz - and you'd like to use a Solaris binary package, read on.
If you'd like to create Solaris binary packages from not-yet-packaged source tarballs, you could supply Solaris source packages too. This makes it easier for people to adapt your package to their specific needs. From this source package, you can create a binary package. Read on.
We'll explain the last 2 things in detail.
Download tar.gz and solaris-ized diff.gz. The tar.gz is the vanilla upstreams source, you might as well get it from upstream.
Unpack the source
gunzip -c foobar-n.m.tar.gz | tar -xf -
(foobar is the name of the source package, n.m is upstream version, k is Solaris package version.)
Now, using a sane patch(1), apply the patch, running
gunzip -c foobar-n.m_k.diff.gz | patch -p0
. Beware: Solaris patch, as shipped with Solaris 8, does not do this trick. A patch which works is e.g. Larry Wall's GNU patch available from ftp://ftp.gnu.org/pub/gnu/patch/ , and, in Solaris pkg format, from http://www.sunfreeware.com/ .
You could also perform this step on a nearby GNU/Linux or *BSD system, which likely has a right patch(1) installed.
If you need to build the package on a different platform as where you've patched it, pack the patched tarball together doing
tar zcf foobar-n.m.solaris.tar.gz foobar-n.m
. Copy this file around, and unpack it again on the build platform
tar zxf foobar-n.m.solaris.tar.gz
.
In the
foobar-n.m/
directory, run
make -f solaris/Makefile
. (Both Solaris make (tested with SunOS 5.7 /usr/ccs/bin/make) and GNU make do fine.) This creates binary packages
/var/tmp/foobar-n.m_k-sol8-sparc-local
and, for your convenience
/var/tmp/foobar-n.m_k-sol8-sparc-local.gz
. If you're building on a SunOS 5.7 box, do
make -f solaris/Makefile OSVERSION=sol7
to get a nice OS string in the package name.
In a directory /some/where, create files Makefile.m4, README.Solaris, pkginfo.in, prototype, and, optionally, postinstall, preinstall and bootstrap.
Typically, Makefile.m4 looks like:
divert(-1)
changequote([, ])
define([CSBS_VENDORTAG], [BOZO])
define([CSBS_TARNAME], [foobarble])
define([CSBS_UPVERSION], [n.m])
define([CSBS_PKGVERSION], [1])
# max 6 chars: some old solaris-en break otherwise
define([CSBS_SHORTTARNAME], [foobar])
define([CSBS_ARCH], [sparc])
include([csbs.m4])
divert(0)dnl
CSBS_ALL
Typically, pkginfo.in features:
PKG="@PKGNAME@"
NAME="@TARNAME@"
VERSION="@VERSION@"
ARCH="@ARCH@"
next to the common variables found in pkginfo. Run
tar zxf foobar-n.m.tar.gz
mv foobar-n.m foobar-n.m.orig
tar zxf foobar-n.m.tar.gz
cd foobar-n.m
mkdir solaris
cp /some/where/{Makefile.m4,README.Solaris,pkginfo.in,postinstall,preinstall,prototype} solaris
Now, make sure you've installed CSBS: be sure the CSBS files bootstrap
, csbs.m4
, and makeMakefile
are installed in ~/.csbs/ . Then, continue with:
cd solaris
sh ~/.csbs/bootstrap
cd ..
make -f solaris/Makefile source
The last command runs something like
diff -Pdur foobar-n.m.orig foobar-n.m | gzip -c > foobar-n.m_k.diff.gz
. Your diff(1) needs to understand the -P
flag. Solaris diff(1) does not. GNU diff, from the GNU diffutils package version 2.7, ftp://ftp.gnu.org/pub/gnu/diffutils/ , does. The option's effect is:
When comparing directories, if a file appears only
in the second directory of the two, treat it as
present but empty in the other.
(Solaris diff can only state something like:
``Only in foodir: bar''
which is really too little for our needs.)
In 2.8, the -P option should be invoked as --unidirectional-new-file.
See http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/~checkout~/caspar/solaris/pkg/Makefile.m4?content-type=text/plain&cvsroot=caspar for an example of usage.
The idea for Solaris source packages is based upon the Debian .deb source package format, see appendix C. ``Source packages'' from ``Debian Policy Manual'', http://packages.debian.org/debian-policy ; http://www.debian.org/doc/debian-policy/ap-pkg-sourcepkg.html
You can fetch a copy of the current state of csbs by running:
joostvb@banach:~/arch% tla register-archive joostvb-arch@mdcc.cx--2005-csbs http://mdcc.cx/arch/\{archives\}/2005-csbs
joostvb@banach:~/arch% tla get joostvb-arch@mdcc.cx--2005-csbs/csbs--mainline--0.1 csbs
.
solpkg ( http://solpkg.berlios.de/ ) is a framework and repository of Makefile "recipes" that can be used to build Solaris packages, by Matt Behrens ( http://www.zigg.com/matt/ ). Very likely, it does about the same job as CSBS. See also http://lists.berlios.de/pipermail/solpkg-devel/ .
Guenther Schreiner has written about his spb (Solaris Package Builder) on http://lists.gnu.org/archive/html/savannah-hackers/2002-06/msg00298.html . No publication of this software is known to the author.
Joerg Schilling has created SPS ( http://sps.berlios.de/pkg/ ). As of 2005-08, it does not create Solaris packages, but just tarballs holding the binaries. This might change once Sun has released its packaging tools under an Open Source license.
Philip Brown's instructions on http://www.bolthole.com/solaris/makeapackage.html .
Dennis Clarke's instructions on http://www.blastwave.org/standards/pkgcreation.php .
Mark Ashley's instructions on http://ibiblio.org/pub/packages/solaris/sparc/html/creating.solaris.packages.html .
Steven M. Christensen's instructions on http://sunfreeware.com/pkgadd.html .
Troy Johnson's instructions on http://troy.jdmz.net/sun/ .
Copyright (C) 2003 Tilburg University
Copyright (C) 2005 Joost van Baal
This document is free software; you can redistribute it and/or modify it under the terms of the GNU GPL, available online at http://www.gnu.org/copyleft/gpl.html . There is NO WARRANTY.
Joost van Baal <joostvb-csbs.mdcc.cx>