Building a Mac OS X Package for Amanda: Difference between revisions
No edit summary |
m (remove spam) |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
This document discusses creating a MacOS X package (a .pkg file | This document discusses creating a MacOS X package (a .pkg file) from scratch. This process can be automated, although discussion of how that' done is beyond the scope of this document. Also helpful is [[Installing Amanda on Mac OS X]] | ||
= Prerequisites = | = Prerequisites = | ||
You will need | You will need Apple's XCode (download the latest version from Apple at http://developer.apple.com/tools/xcode/). If you want to compile from subversion, rather than a distribution tarball, you'll need autotools (use [http://www.finkproject.org/ Fink] or [http://darwinports.opendarwin.org/ DarwinPorts], or install them manually) | ||
= Overview = | = Overview = | ||
The basic plan here is to compile Amanda and install it into a temporary location (<tt>/tmp/amroot</tt>). The result is essentially an overlay containing the files that <tt>make install</tt> would create. We then use Package Maker to bundle that overlay with some additional scripts and utilities into a package. | The basic plan here is to compile Amanda and install it into a temporary location (<tt>/tmp/amroot</tt>). The result is essentially an overlay containing the files that <tt>make install</tt> would create. We then use Package Maker to bundle that overlay with some additional scripts and utilities into a package. | ||
= Compile = | = Compile = | ||
Amanda should be compiled as described in [[Installing Amanda on Mac OS X]]. You will need to create the | Amanda should be compiled as described in [[Installing Amanda on Mac OS X]]. You will need to create the amandabackup user, although creating the remaining directories is not required. | ||
The configuration is | The configuration is minimally | ||
./configure --prefix=/usr/local --with-user= | ./configure --prefix=/usr/local --with-user=amandabackup --with-group=wheel --sysconfdir=/private/etc --localstatedir=/private/var --with-tmpdir=/private/tmp/amanda | ||
However, instead of <tt>sudo make install</tt>, run | |||
DESTDIR=/tmp/amroot | sudo make DESTDIR=/tmp/amroot install | ||
You should now have a full amanda install located under <tt>/tmp/amroot/</tt>. | You should now have a full amanda install located under <tt>/tmp/amroot/</tt>. | ||
== Fat build == | |||
Amanda is quite easy to compile into "fat" binaries; simply add the following before your <tt>./configure</tt>: | |||
<pre> | |||
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \ | |||
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \ | |||
</pre> | |||
To be able to compile the 2.5.1p3 source as a Universal Binary, you have to add a <tt>--disable-dependency-tracking</tt> as one of the parameters when running <tt>./configure</tt>, otherwise the comppiler complains about using -M and -E switches when compiling for multiple architectures. | |||
= Build Package = | = Build Package = | ||
== Cleanup == | |||
First, you'll need to shift the amanda install around a little bit. You only want it to install the stuff under /usr/local; letting the Apple installer make changes in <tt>/private/var</tt> or <tt>/private/etc</tt> is asking for trouble. So remove those directories from <tt>/tmp/amroot</tt>. | |||
== Resources == | |||
You will probably want to run some scripts, for example, to create the 'amandabackup' user, as part of your package's installation. Create a <tt>Resources</tt> directory. In this example, it's at <tt>/tmp/Resources</tt>, but you may not consider your resources "temporary" once you've spent a few hours honing your scripts. Create scripts in this directory named e.g., <tt>InstallCheck</tt> or <tt>postinstall</tt>. See some of the [[#Links|links]] and XCode's included documentation for pointers. | |||
== Make Package Project == | |||
Create a new package with PackageMaker, with the following settings: | |||
; Root : <tt>/tmp/amroot/usr/local/</tt> | |||
; Default Location : <tt>/usr/local/</tt> | |||
; Authentication : <tt>root</tt> | |||
; Relocatable : unchecked | |||
; Extras : <tt>/tmp/Resources</tt> | |||
; Package Version : (as appropriate for the version you're packaging | |||
Then build the package. | |||
= Links = | |||
* http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html | |||
* Examples from [http://sf.net/projects/pgsqlformac| PostgreSQL Tools for MacOS X]: | |||
** http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/BuildScripts/ | |||
** http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/Installers/PostgreSQL8/Resources/postflight?revision=HEAD&view=markup | |||
** http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/Installers/PostgreSQL8/Resources/InstallationCheck.strings?revision=21&view=markup |
Latest revision as of 20:27, 18 July 2012
This document discusses creating a MacOS X package (a .pkg file) from scratch. This process can be automated, although discussion of how that' done is beyond the scope of this document. Also helpful is Installing Amanda on Mac OS X
Prerequisites
You will need Apple's XCode (download the latest version from Apple at http://developer.apple.com/tools/xcode/). If you want to compile from subversion, rather than a distribution tarball, you'll need autotools (use Fink or DarwinPorts, or install them manually)
Overview
The basic plan here is to compile Amanda and install it into a temporary location (/tmp/amroot). The result is essentially an overlay containing the files that make install would create. We then use Package Maker to bundle that overlay with some additional scripts and utilities into a package.
Compile
Amanda should be compiled as described in Installing Amanda on Mac OS X. You will need to create the amandabackup user, although creating the remaining directories is not required.
The configuration is minimally
./configure --prefix=/usr/local --with-user=amandabackup --with-group=wheel --sysconfdir=/private/etc --localstatedir=/private/var --with-tmpdir=/private/tmp/amanda
However, instead of sudo make install, run
sudo make DESTDIR=/tmp/amroot install
You should now have a full amanda install located under /tmp/amroot/.
Fat build
Amanda is quite easy to compile into "fat" binaries; simply add the following before your ./configure:
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \ LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \
To be able to compile the 2.5.1p3 source as a Universal Binary, you have to add a --disable-dependency-tracking as one of the parameters when running ./configure, otherwise the comppiler complains about using -M and -E switches when compiling for multiple architectures.
Build Package
Cleanup
First, you'll need to shift the amanda install around a little bit. You only want it to install the stuff under /usr/local; letting the Apple installer make changes in /private/var or /private/etc is asking for trouble. So remove those directories from /tmp/amroot.
Resources
You will probably want to run some scripts, for example, to create the 'amandabackup' user, as part of your package's installation. Create a Resources directory. In this example, it's at /tmp/Resources, but you may not consider your resources "temporary" once you've spent a few hours honing your scripts. Create scripts in this directory named e.g., InstallCheck or postinstall. See some of the links and XCode's included documentation for pointers.
Make Package Project
Create a new package with PackageMaker, with the following settings:
- Root
- /tmp/amroot/usr/local/
- Default Location
- /usr/local/
- Authentication
- root
- Relocatable
- unchecked
- Extras
- /tmp/Resources
- Package Version
- (as appropriate for the version you're packaging
Then build the package.
Links
- http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html
- Examples from PostgreSQL Tools for MacOS X:
- http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/BuildScripts/
- http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/Installers/PostgreSQL8/Resources/postflight?revision=HEAD&view=markup
- http://pgsqlformac.svn.sourceforge.net/viewvc/pgsqlformac/trunk/Installers/PostgreSQL8/Resources/InstallationCheck.strings?revision=21&view=markup