Difference between revisions of "New Module"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Reverted edit of 1146830109, changed back to last version by Michael)
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
This process is somewhat complex, an example (adding cairo) is annotated here:
 
This process is somewhat complex, an example (adding cairo) is annotated here:
  
First create a your new module directory eg. <code>cairo</code>
+
First create a your new module directory eg. <code>libpixman</code>
  
 
<ul>
 
<ul>
 
<li>makefile.mk - in your module directory. see following example what it should contain, it is important that your
 
<li>makefile.mk - in your module directory. see following example what it should contain, it is important that your
tarball is added to the cairo/download/ directory.
+
tarball is added to the <code>libpixman/download/</code> directory.
 
<pre>
 
<pre>
 
PRJ=.
 
PRJ=.
Line 31: Line 31:
  
 
OUT2LIB= \
 
OUT2LIB= \
$/src/.libs$/libpixman.so.*
+
$/src$/.libs$/libpixman.so.*
  
 
OUT2INC= \
 
OUT2INC= \
Line 49: Line 49:
  
 
.ENDIF
 
.ENDIF
</pre>
+
</pre></li>
<li>prj/build.lst - see following example and [[Hacking#prj.2Fbuild.lst]] detailed description ]]
+
<li>prj/build.lst - see following example and [[Hacking#prj.2Fbuild.lst|detailed description]]
 
+
 
<pre>
 
<pre>
 
pm libpixman : solenv NULL
 
pm libpixman : solenv NULL
 
pm libpixman usr1 - u pm_mkout NULL
 
pm libpixman usr1 - u pm_mkout NULL
 
pm libpixman nmake - u pm_pixman NULL
 
pm libpixman nmake - u pm_pixman NULL
</pre>
+
</pre></li>
<li>prj/d.lst - see following example and [[http://ooo.ximian.com/wiki/index.php/Hacking#prj.2Fd.lst detailed description ]]
+
<li>prj/d.lst - see following example and [http://ooo.ximian.com/wiki/index.php/Hacking#prj.2Fd.lst detailed description ]
  
 
<pre>
 
<pre>
Line 66: Line 65:
 
linklib: libpixman.so.*.*.*
 
linklib: libpixman.so.*.*.*
 
linklib: libpixman.dylib.*.*.*
 
linklib: libpixman.dylib.*.*.*
</pre>
+
</pre></li>
 
</ul>
 
</ul>
 
  
 
== Extra bits for ooo-build ==
 
== Extra bits for ooo-build ==
Line 158: Line 156:
 
</pre>
 
</pre>
 
</ul>
 
</ul>
 +
 +
== Extra bits for Childworkspaces ==
 +
Some additional things should be considered when introducing a new module on a [[CWS|Childworkspace]]. Please see
 +
[[CWS#Create_a_new_module|here]].
 +
[[Category:Build_System]]

Latest revision as of 02:59, 29 December 2008

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