OSGeo4W Packaging

This page describes techniques used for preparing OSGeo4W packages.

= General =

OSGeo4W packages are each bzip2 compressed .tar files intended to be unpacked in the OSGeo4W root directory. They come with setup.hint files designed to describe dependencies and a package description.

= Installed Directory Layout =


 * /bin: most .exe and .dll files intended to be in the user path.
 * /lib: static and stub libraries required for building additional packages and executables.
 * /include: include files required for building additional packages and executables.
 * /etc/postinstall: per package post-install scripts
 * /etc/ini: .bat files to be called from OSGEO4W_ROOT/osgeo4w.bat - usually these contain SET statements for required environment variables.
 * /etc/setup: used by cygwin setup to keep track of installed packages.
 * /share: static support data files.
 * /apache: the Apache web server
 * /apache/cgi-bin: The cgi directory for apache.
 * /apache/htdocs: The web document directory.
 * /http.d: apache configuration files, one per package.
 * /var: currently used by Cygwin setup.exe

= Package Directory Layout =

OSGeo4W packages are generally structured like packages for Cygwin as described at http://cygwin.com/setup.html.

Packages prepared for OSGeo4W are currently uploaded to:

download.osgeo.org:/osgeo/download/osgeo4w/release/

This tree can be reviewed at: http://download.osgeo.org/osgeo4w/release

Each package directory should have a single setup.hint file, and one or more versions of that package as a .tar.bz2 file. These should normally have names like gdal-1.5.0-1.tar.bz2 where "1.5.0" is the version of GDAL that was packaged, and "-1" indicates the version of the packaging attempt. The directory can also contain corresponding source snapshots named like gdal-1.5.0-1-src.tar.bz2. Note that the basename should exactly match the directory in which the package is found. So the "gdal" directory has gdal- - .tar.bz2 package files.

Sometimes a single project is packaged as several packages. In this case component packages are normally created as subdirectories of the primary directory. So, for instance the Oracle 10g driver for GDAL is kept in the release/gdal/gdal-oracle10g directory and packaged as gdal-oracle10g-1.5.0-1.tar.bz2.

= setup.hint =

Each package directory has a setup.hint file which normally contains the short and long description for the package, and the list of other packages on which it depends. Note that there is normally only one setup.hint file for a package even if several versions of the package exist. A normal setup.hint file might look like::

sdesc: "The Libgeotiff library, commandline tools and supporting tables." ldesc: "The Libgeotiff library, commandline tools and supporting tables. Used for manipulating GeoTIFF files." category: Libs Commands requires: msvcrt libtiff

This indicates the short and long description for the package, the list of categories it will appear in for the installer user interface, and the package it requires.

= Post-Install Actions =

Packages may take post-install actions by including a .bat file in the /etc/postinstall directory as part of the package. The filename should be named etc/postinstall/ .bat. The bat file will be run with the environment variables OSGEO4W_HOME and OSGEO4W_HOME_MSYS defined, and with OSGEO4W_HOME/bin already in the path. One very common thing to do in postinstall actions is to insert/update configuration files to include the installed path to the OSGeo4W tree. This is normally done with a postinstall file that looks like::

textreplace -sf bin/gdal-config.tmpl -df bin/gdal-config \ -map @osgeo4w@ "%OSGEO4W_ROOT%" \ -map @osgeo4w_msys@ "%OSGEO4W_ROOT_MSYS%"

This runs the bin/textreplace program (part of the msvcrt package) with source file bin/gdal-config.tmpl and destination file bin/gdal-config and replaces occurances of @osgeo4w@ with the value of the OSGEO4W_ROOT environment variable, and @osgeo4w_msys@ with the value of the OSGEO4W_ROOT_MSYS environment variable. The pattern of processing a file from a .tmpl version is sufficiently common that textreplace supports this short form for the same action:

textreplace -std -t bin/gdal-config

This applies the "standard" conversions to file bin/gdal-config.tmpl and puts the results in bin/gdal-config

The postinstall scripts can run any DOS command or installed binary with desired arguments.

= Shell Initialization =

Some packages need to set particular environment variables. For the OSGeo4W command shell this can be accomplished by adding an initialization file in etc/ini. A typical example looks like::

SET GDAL_DATA=%OSGEO4W_ROOT%\share\gdal

These scripts are run in random order by %OSGEO4W_ROOT%\OSGeo4W.bat when establishing the environment for the OSGeo4W shell. The OSGEO4W_ROOt environment variable will always be set on the way in.

= Setup.ini =

The Cygwin Setup.exe actually downloads the setup.ini file with a list of all packages each time it is run. This file should be recreated on the server by running the script /osgeo/download/osgeo4w/regen.sh (normally as user frankw) each time packages are uploaded.