Build Environment Effort/Module Migration Tips

From Apache OpenOffice Wiki
Jump to: navigation, search


Build Environment Effort

Quick Navigation

About this template

The overview steps for migrating a module are tracked here

Here are some useful tips for converting an OOo module to the new Build Environment

Tips 1: Deliver to the solver

Usually there are some header files to be delivered to the solver and the header files, which located at $(SRCDIR)/module/inc. So you can use the Step 3 in Module Migration.

When you need to deliver some headers in source, you can create a file in the module root called

$(eval $(call gb_Package_Package,toolkit_source,$(SRCDIR)/toolkit/source))
#deliver $(SRCDIR)/toolkit/source/ layout/core/bin.hxx to $SOLARVER/$INPATH/inc/layout/core/bin.hxx
$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/bin.hxx,layout/core/bin.hxx))

When you need to deliver some utility files, such as *.xml, *cfg ..., you can create a file in the module root called

$(eval $(call gb_Package_Package,toolkit_util,$(SRCDIR)/toolkit/util))
#deliver $(SRCDIR)/toolkit/util/tookit.xml to $SOLARVER/$INPATH/xml/toolkit.xml
$(eval $(call gb_Package_add_file,toolkit_util,xml/toolkit.xml,toolkit.xml))

Then don't forget to add this files in (in our case, for other modules, use the name of that module)

$(eval $(call gb_Module_add_targets,tools,\
    Package_source \
    Package_util \

Tips 2: Useful Variations

When you writing the makefile, you may need some pre-defined vars for your function. Here is some useful vars.

Vars\OS Windows Linux MacOSX
GUIBASE WIN unx aqua
gb_Library_OOOEXT .dll .so .dylib
Documentation note.png Use gb_Library_OOOEXT instead of $(DLLPOSTFIX)$(DLLPOST)

Tips 3: Linked Library

For the libraries to be linked while build a library, you can refer Step 4 in Module Migration.

For example, if you want to link with sysshell.lib in, you can edit the the file and add the library as below:

$(eval $(call gb_Library_add_linked_libs,sfx,\
 comphelper \
 cppu \
 $(gb_STDLIBS) \

Then, you can use make -sr to build, unfortunate there will be an error message:

Cannot link against library/libraries sysshell. Libraries must be registered in

As the hint, we can edit the, which located at SRCROOT, and add the below line:

$(eval $(call gb_Helper_register_libraries,OOOLIBS, \
 AppleRemote \
 avmedia \
 basegfx \
 basebmp \
 $(gb_STDLIBS) \

Usually, the thing will be over, however, some libs such as the example, another error will be there

 Try `/bin/cp --help' for more information.
 make: *** [/home/int/....../] Error 1

It is caused that the build system assume the library will begin with "lib"("i" in Windows), but some library without the pre "lib", such as this one. so we need to change it in

 ifeq ($(OS),LINUX)
  gb_Library_FILENAMES := $(patsubst comphelper:libcomphelper%,comphelper:libcomphelp%,$(gb_Library_FILENAMES))
  gb_Library_FILENAMES := $(patsubst cppuhelper:libcppuhelper%,cppuhelper:libuno_cppuhelper%,$(gb_Library_FILENAMES))
  gb_Library_FILENAMES := $(patsubst,,$(gb_Library_FILENAMES))

I hope this tutorial gives you some useful tips with the new build system. If you find some other good tips, please to contribute here. Let's hack with the new build system!

Personal tools