New Module

From Apache OpenOffice Wiki
Jump to: navigation, search

Adding a New module to the OO.o build

This process is somewhat complex, an example (adding cairo) is annotated here:

First create a your new module directory eg. libpixman

  • makefile.mk - in your module directory. see following example what it should contain, it is important that your tarball is added to the libpixman/download/ directory.
    PRJ=.
    
    PRJNAME=libpixman
    TARGET=libpixman
    
    # --- Settings -----------------------------------------------------
    
    .INCLUDE :	settings.mk
    
    # --- Files --------------------------------------------------------
    
    .IF "$(GUI)"=="UNX"
    TARFILE_NAME=libpixman-0.1.5
    
    CONFIGURE_DIR=
    
    CONFIGURE_ACTION=./configure
    CONFIGURE_FLAGS=
    BUILD_DIR=$(CONFIGURE_DIR)
    BUILD_ACTION=$(GNUMAKE)
    
    OUT2LIB= \
    	$/src$/.libs$/libpixman.so.*
    
    OUT2INC= \
    	$/src$/pixman.h
    
    
    # --- Targets ------------------------------------------------------
    
    
    .INCLUDE :	set_ext.mk
    .INCLUDE :	target.mk
    .INCLUDE :	tg_ext.mk
    .ELSE  
    
    dummy:
    	@echo "Nothing to build for your platform"
    
    .ENDIF
    
  • prj/build.lst - see following example and detailed description
    pm	libpixman		:	solenv NULL
    pm	libpixman			usr1	-	u	pm_mkout NULL
    pm	libpixman			nmake	-	u	pm_pixman NULL
    
  • prj/d.lst - see following example and detailed description
    mkdir: %_DEST%\inc%_EXT%\pixman
    ..\%__SRC%\inc\pixman.h %_DEST%\inc%_EXT%\pixman\pixman.h
    ..\%__SRC%\lib\libpixman.* %_DEST%\lib%_EXT%\libpixman.*
    
    linklib: libpixman.so.*.*.*
    linklib: libpixman.dylib.*.*.*
    

Extra bits for ooo-build

Of course, you'll need to turn all of the above into patch form for ooo-build; but ooo-build also has some infrastructure to help download the source you need easily; those need setting up:

  • configure.in - usualy you want your module to be build conditionaly. inspire yourself by looking how mdb or cairo are handled.
    AC_ARG_ENABLE(cairo,
    [
      --enable-cairo          Enables cairo canvas backend.],
    ,)
    
    ...
    
    if test "$enable_cairo" != "no"; then
       CAIRO_ENABLED=TRUE
       LIBPIXMAN_VER=0.1.5
       GLITZ_VER=0.4.3
       CAIRO_VER=0.5.2
    else
       CAIRO_ENABLED=
       LIBPIXMAN_VER=
       GLITZ_VER=
       CAIRO_VER=
    fi
    AC_SUBST(CAIRO_ENABLED)
    AC_SUBST(LIBPIXMAN_VER)
    AC_SUBST(GLITZ_VER)
    AC_SUBST(CAIRO_VER)
    
  • download.in - add your code to download package from network, best if you place the module tarball on ooo.ximian.com in /var/www/packages/SRC680/ directory.
    %SRC_URLS = (
        'binutils-.*'			 => 'http://go-ooo.org/packages/support',
    ...
        'libpixman-*'			 => 'http://go-ooo.org/packages/SRC680',
        'cairo-*'			         => 'http://go-ooo.org/packages/SRC680',
        'glitz-*'			         => 'http://go-ooo.org/packages/SRC680',
    
    ...
    
    if ('@CAIRO_ENABLED@' eq 'TRUE') {
        push @files, ( 'libpixman-@LIBPIXMAN_VER@.tar.gz' );
        push @files, ( 'cairo-@CAIRO_VER@.tar.gz' );
        push @files, ( 'glitz-@GLITZ_VER@.tar.gz' );
    }
    
    download_files (\@files, \%SRC_URLS, '@SRCDIR@');
    
  • bin/setup.in - you can set environment variable by autoconf variable values here. the setup is sourced (as in shell terminology) in unpack, so you can use info from configure that way
    ...
    CAIRO_VER=@CAIRO_VER@
    CAIRO_ENABLED=@CAIRO_ENABLED@
    GLITZ_VER=@GLITZ_VER@
    ...
    
  • bin/unpack - create a directory for your module in OOo tree, create another download directory for your tarball and copy it there
    ...
    if test "$CAIRO_ENABLED" == "TRUE"; then
        echo "Making symbolic links of libpixman, cairo and glitz at build location"
    
        mkdir -p $OOBUILDDIR/libpixman
        check_tarball $SRCDIR/libpixman-$LIBPIXMAN_VER.tar.gz
        mkdir -p $OOBUILDDIR/libpixman/download
        cp -a $SRCDIR/libpixman-${LIBPIXMAN_VER}.tar.gz $OOBUILDDIR/libpixman/download/
    
        mkdir -p $OOBUILDDIR/glitz
        check_tarball $SRCDIR/glitz-${GLITZ_VER}.tar.gz
        mkdir -p $OOBUILDDIR/glitz/download
        cp -a $SRCDIR/glitz-${GLITZ_VER}.tar.gz $OOBUILDDIR/glitz/download/
    
        mkdir -p $OOBUILDDIR/cairo
        check_tarball $SRCDIR/cairo-${CAIRO_VER}.tar.gz
        mkdir -p $OOBUILDDIR/cairo/download
        cp -a $SRCDIR/cairo-${CAIRO_VER}.tar.gz $OOBUILDDIR/cairo/download/
    fi
    
    

Extra bits for Childworkspaces

Some additional things should be considered when introducing a new module on a Childworkspace. Please see here.

Personal tools