# CPAM with TWW/Porting TWW HPMS to other OS
## Porting TWW HPMS to other OS

There are two tasks need to be done when porting TWW HPMS tools to other OS.
* Porting the TWW HPMS tool itself
* Porting the package sources.
* The makefile to automate the TWW tools porting.

### Linksys NSLU2

* A Makefile to build TWW tools for nslu2.
* compile sbtuils tool to generate sb
* use sb to compile and build pb and pkgutils
* Porting sbtools
* Porting pbtools
* Porting pkgutils

### Mac OS X

Doing our homework, following are some good documents about software packaging on Mac OS X.
* PackageMaker Howto
* Local PMS
The package management system is getting better but still fall short of a basic functionality that a PMS shoule have. Ex, you can't list out current installed package using command line tool. you can't remove a package using a command or handle package dependency automatically.
/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker is getting better in 10.3.8. we can now create a .pkg with command line. Be aware to supply absolute path after -p or -f options.
Following is an partial makefile to create TWW CPAM tools in Mac OSX's local PMS format.
* Porting sbtools
sbutils-1.2.4 compiled ok on Mac OS X 10.3.8. We also can use packagemaker to generate sbutils-1.2.4 into Mac OS X's native package format. Following quick notes need to be documented later.

### Microsoft Windows

The first problem of porting TWW HPMS tool to Win32 platformat is which package creation software and Unix foundation software to base upon.
* Unix foundation software
** cygwin notes for sbutils package source.
** mingw
** SFU
* Package Creation tools
** MakeMSI (see http://users.cyberone.com.au/dbareis/makemsi.htm) automatically builds (or updates) MSI files (or any other type of Windows Installer databases). It uses an XML like scripting language which can be invoked via explorer or the command line. It also builds MSI documentation which includes file (MD5 checks installed files against expected etc.) and product verification buttons. It includes a very powerful preprocessor.
* NSIS http://nsis.sourceforge.net/
* Inno
** Wix at http://sourceforge.net/projects/wix, it has XML,scripting and command line support to generate a MSI package.
* The challenge of using Wix tool set to generate a Unix package is the GUID. Fortunately mallow.exe come to the rescue. it can scan a src directory and generate GUID for each component(directory or file).
* We need to figure out how to make pb to generate wxs xml file and communicate with candle and light to gernate msi pacakge with the help of mallow.
* Following is an small batch file to illustrate creating a msi package, installing and remove this package.
candle and light are a pair of commandline package creation tool similar to rpmbuild in redhat, packagemaker in Max OS X or pkgmk in solaris.
* The wix package source is display in following text, following are todos.
** Converting pbuitils' .pb xml file to wix's wxs XML.
** Figuring out msiexec to delete a package using a package ID without the presence of actual .msi package.
* References of WiX and MS installer.
* Porting sbtools
* Porting pbtools
* Porting pkgutils

### FreeBSD

* Porting sbtools
* Porting pbtools
* Porting pkgutils

### Debian

* Porting sbtools
* Porting pbtools
* Porting pkgutils

## Package Management Process

Software engineering process include design and implement software via software developers to generate source codes. The source codes will then need to be built, packaged and be managed. We can divide this process into three general steps.
* Software build process(SB) and SB can be divided into following processes on a build machine
** source unpack
** source patch
** source configure
** source build to generate binary and documentation
** binary test
** binary install
** binary uninstall
* Package build (PB) process is much straight forward
** prepare the configuration script
** prepare init script to start/stop application service
** call up local PMS to pack the binary,documentation and scripts into local PMS format.
* Package Management (PKGUTIL) Process
** upload and administrate packages on package depot server.
** install
** remove
** upgrade/patch
** auto installation upon package dependence.

## TWW HPMS introduction

TWW Inc. has three tools to match the package management processes.
* Softeware build
** sbutils
* Package build
** pbutils
* Package Management
** pkgutils
* How to get TWW tools ?

## TWW Inc.

All the TWW tools and sources of their supported packages are GPL compliant. They are freely available at their ftp site ftp://support.thewrittenword.com. But their support labor and binary packages are not free of charge. We are glad TWW Inc. find a way to do open-source works and still can make a living out of it.
Please support TWW Inc. if your workplace need such kind of service ( http://shopping.netsuite.com/tww ).