FGSDevNotes

From OSGeo
Jump to: navigation, search

The MapTools FGS Pages contain a variety of information for FGS users, and those wanting to develop packages for it. This page is mostly suplementary information as I learn my way around developing for FGS.

FAQs

Q: Some of the source distributions are no longer available at their original urls so my builds fail.

A: Download packages from http://dl.maptools.org/dl/fgs/fgs-dev/fgs-cache/ to your fgs-dev/cache directory. In some cases, downloads will *appear* to succeed, like libpng, but in fact all you get is an html file indicating the path is wrong. Caveat emptor.

Q: When I use "fgsdev custom_build_list create _module_name_1_ _module_name_2_" what do I use for module names?

A: Look in fgs-dev/pkg_def/build.list, and use names from that file, with "-base" appended. So the file has "tiff:3.7.2" but you would use "tiff-base" as the package name. I'm not sure why the -base.


notes on FGS-DEV layout

Basic Directory Structure of FGS-DEV

fgs-dev/-|
         |--bin/--|
         |        |--lib/
         |
         |--cache/
         |
         |src/
         |
         |
         |--pkg_def/--|
         |            |--_misc/
         |            |--<package_name>/--| 
         |                                |--base.skeleton/
         |--built/--|
         |          |--_lib/
         |          |--<package_name>/
         |
         |--modules/--|
                      |--base/
                      |--<module_name>/


definitions:

  • package - source code package
  • module - fgs-dev tar gzipped of compiled package


fgs-dev/

  • Root directory for fgs-dev environment.

Contains:

    • Setenv.sh
      • sets up the fgs-dev env vars
        • FGS_DEV_HOME (location fgs-dev)
        • PATH ($FGS_DEV_HOME/bin to beginning of PATH)
        • PYTHONPATH
        • LD_LIBRARY_PATH ($FGS_DEV_HOME/built/_lib)
        • FGS_SRC_CACHE_DIR ($FGS_DEV_HOME/cache)


fgs-dev/bin

  • Main directory for all fgsdev commands used to build fgs modules

Contains:

    • fgsdev
      • wrapper for fgsdev commands
        • fgsdev custom_build_list
        • fgsdev build_all
        • fgsdev build_pkg <package_name>
    • fgs_build_all.sh
      • builds all packages listed in fgs-dev/build.list by calling fgs_build_pkg.sh for each entry
    • fgs_build_pkg.sh
      • build a single package by calling:
        • fgs-dev/src/<package_name>/fgs_build.sh
        • fgs-dev/src/<package_name>/fgs_install.sh
    • fgs_installer.sh
      • script to install fgs

fgs-dev/bin/lib

  • Dirctory that contains all commands and functions used by scripts in fgs-dev/bin

Contains:

    • fgsdev_env.sh -
      • sets FGS-DEV env vars to configure and compile src packages
        • UNAME_MACHINE
        • UNAME_SYSTEM
        • FGS_PKGS_DEF_HOME ($FGS_DEV_HOME/pkg_def)
        • FGS_STANDARD_BUILD_FILE ($FGS_PKGS_DEF_HOME/build.list)
        • FGS_CUSTOM_BUILD_FILE ($FGS_DEV_HOME/build.list)
        • FGS_BUILD_HOME ($FGS_DEV_HOME/built)
        • FGS_LIB_DIR ($FGS_DEV_HOME/built/_lib)
        • FGS_MODULES_HOME ($FGS_DEV_HOME/modules)
        • FGS_CUSTOM_BUILD_FILE ($FGS_DEV_HOME/build.list)
        • FGSENV_MODULES_DIR
        • export PATH="$FGS_DEV_HOME:$PATH"
        • export LD_LIBRARY_PATH="$FGS_LIB_DIR:$LD_LIBRARY_PATH"
    • custom_build_list.sh
      • creates a custom $FGS_DEV_HOME/build.list file
    • build_base.sh
      • creates the fgs-base module
    • install_src.sh
      • Uses build.list files to determine what package and version to build
        • build.list is a list of source code packages with version number that fgs-dev will build
        • checks for FGS_CUSTOM_BUILD_FILE
        • compares FGS_CUSTOM_BUILD_FILE with FGS_STANDARD_BUILD_FILE
          • if CUSTOM_BUILD_FILE doesn't contain a version number then gets version number from STANDARD_BUILD_FILE
          • checks if package in the FGS_SRC_CACHE_DIR if not in source directory will download the source using information in fgs-dev/pkg_def/<package_name>/def.sh file
        • extract source archive to fgs-dev/src/
    • check_dep.sh
      • Checks that a packages dependencies are built before building a packages
      • references fgs-dev/pkg_defs/<package_name>/base.required (listing of dependencies)
    • list_module_dep.sh
      • get module dependicies of a specific module
    • module.sh
      • create module directory fgs-dev/modules/<module_name>
      • copy fgs-dev/pkg_def/<package_name>/base.skeleton to module directory
      • create module by tar gzipping module directory
    • self-installer.sh
      • create self extracing installer for fgs modules
    • self-extractor_header.sh
    • specific-freebsd.sh
      • fix for freebsd make install options

fgs-dev/cache

Contains all packages needed for building fgs-dev modules. FGS-DEV will download a specific package version if it does not already exist in this directory.

fgs-dev/src

Used for extracting and compiling source code packages

fgs-dev/pkg_def

Contains the standard build.list file

Contains a directory for each fgs package

fgs-dev/pkg_def/<package_name>

Instructions for building package and creating modules

Contains:

    • def.sh
      • contains information for downloading source code
    • base.required
      • list of required modules
    • fgs_build.sh
      • calls fgs-dev/bin/lib/fgsdev_env.sh to create build env
      • configures and makes package
      • minimally sets --prefix=$FGS_BUILD_HOME/<package_name>
    • fgs_install.sh
      • calls fgs-dev/bin/lib/fgsdev_env.sh to create build env
      • calls fgs-dev/bin/lib/module.sh
      • creates module in fgs-dev/modules/<module_name>
    • base.skeleton/
      • skeleton directory used to create the modules base strucuture
    • base.skeleton/etc/fgs/pkgs/<module_name>/
      • contains install.sh - a post install script used when installing the module in fgs

fgs-dev/built

All packages intalled to this directory with "make install"

fgs-dev/built/_lib

FGS_DEV's library directory (LD_LIBRARY_PATH). Each packages fgs_install.sh script copies *.so files to this directory

fgs-dev/modules

Contains all fgs-dev modules that can then by installed via the fgs installer script.


Basic usage of fgs-dev

   Get fgs-dev environment
   $ cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot login
   $ cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot co fgs-dev
   $ cd fgs-dev
   ** set fgs-dev's environment 
   $ . setenv.sh
   ** create custom build.list
   $ fgsdev custom_build_list create mapserver-base
      - creates fgs-dev/build.list
      - this file can be edited (I.E. require specific versions)
         - to require a specific version add it to the 2nd column
   ---------- build.list --------------
   jpeg:::
   tiff:::
   pdflib_lite:::
   libpng:::
   freetype:::
   libiconv:::
   gd:::
   openssl:::
   netcdf:::
   curl:::
   proj:::
   libgeotiff:::
   postgresql:::
   unixODBC:::
   xerces_c:::
   libungif:::
   gdal:::
   expat:::
   apache:::
   libxml2:::
   sablotron:::
   php:::
   mapserver:::


   ** build all mapserver-base modules and all of it's dependencies
   $ fgsdev build_all


To Add a package to fgs-dev

Add the package and any dependencies not provided by fgs to fgs-dev/pkg_def/build.list

  • For every package added do:

Add directory to with the package name to fgs-dev/pkg_def

To the fgs-dev/pkg_def/<package_name> add:

def.sh

   -------------------def.sh-----------
   PKG_NAME='<package_name'
   ARCHIVE_SITE=http://<package_archive_url>
   ARCHIVE_PREFIX='<packages_archive_prefix>'
   SRC_FILE="${ARCHIVE_PREFIX}${SRC_VERSION}.tar.gz" # change to archives postfix
   ARCHIVE_DOWNLOAD=$ARCHIVE_SITE/${SRC_FILE}
   ARCHIVE_DIR=${ARCHIVE_PREFIX}${SRC_VERSION}


base.required

      • list of required modules

fgs_build.sh

    • example file to edit for package's specific needs
  -----------fgs_build.sh-------------
  #!/bin/bash
  ####
  ## fgs_build
  ## $Id: fgs_build,v 1.9 2006/01/17 16:26:15 gdallaire Exp $
  ## Called by the build_pkg routine. Can be run manually.
  ## Custom version of this file should live in $FGS_HOME_DEV directory with
  ## this file name pattern : package_name-fgs_build
  ####
  if [ -z "$FGS_DEV_HOME" ] ; then
      echo "FGS_DEV_HOME not set, please load setenv.sh first..."
      exit 1
  fi
  . $FGS_DEV_HOME/bin/lib/fgsdev_env.sh
  rm -rf $FGS_BUILD_HOME/<package_name>
  ./configure --prefix=$FGS_BUILD_HOME/<package_name \
  in_error_abort
  make clean
  in_error_abort
  make $FGS_MAKE_OPT all
  in_error_abort

fgs_install.sh

    • example file to edit for package's specific needs
  #!/bin/bash
  ####
  ## fgs_install
  ## $Id: fgs_install,v 1.7 2005/04/19 03:29:01 gdallaire Exp $
  ## Called by the build_pkg routine. Can be run manually.
  ## Custom version of this file should live in $FGS_HOME_DEV directory with
  ## this file name pattern : package_name-fgs_install
  ####
  if [ -z "$FGS_DEV_HOME" ] ; then
      echo "FGS_DEV_HOME not set, please load setenv.sh first..."
      exit 1
  fi
  . $FGS_DEV_HOME/bin/lib/fgsdev_env.sh
  . $FGS_DEV_HOME/bin/lib/module.sh
  ## Installs all in $FGS_BUILD_HOME
  make install
  ####
  ## MODULE_NAME : <module_name>
  ####
  create_module_home <module_name> base # or lib if creating a library
  # copy all needed files from FGS_BUILD_HOME/<package_name> to 
  # FGS_MODULE_HOME/<module_name>
  create_module


Once the new package and all it's required dependencies are added to fgs-dev you can now use the normal fgsdev commands to build the new module(s)