The reSIProcate build system
The resip build system is based on a customized gmake build system. This is not the same as the experimental autotools-based build system that is also available in resiprocate. Here is the overall directory structure for resiprocate.
The resiprocate project and all of its third party dependencies are stored using the subversion source code control system. http://subversion.tigris.org.
Build System Capabilities
The resiprocate custom build system satisfies a number of requirements:
- easy to build a new package/library or executable
- supports the following operating systems: linux, solaris, QNX, Mac OSX, Cygwin, and VxWorks
- supports the following compilers: g++, Intel compiler, ARM cross compiler, Sunpro C++
- can be easily extended to support additional compilers and operating systems that support gmake
- builds and maintains dependencies automatically
- support for shared libraries
- support for distcc - for distributed compilation
- keeps object and binaries in separate directories
- can store object and binaries on a local filesystem
- keeps optimized, profiled and debug binaries and object files in separate directories
- support for toggling support of features such as IPV6, SSL, DTLS, etc.
Build System Example
The following example has additional annotations to explain in detail what each line means. It provides a fictional new library example that you could use in your organization.
# provide a pointer to the location of your build directory as a relative # path. BUILD = ../build # this line is required before any other declarations include $(BUILD)/Makefile.pre # specify all package/library dependencies. PACKAGES += RESIPROCATE PTHREAD ARES OPENSSL # this defines the name of the target library. the library suffix depends on # whether static or dynamic libraries are selected in sip/build/Makefile.conf TARGET_LIBRARY := libexample # list all C and C++ source files which will be included in the library. if a # separate line is used for each input file, a backslash '\' is required at the # end of each line SRC = \ file1.cxx \ file2.cxx # this line is required after all other declarations include $(BUILD)/Makefile.post
The following example is taken from the repro project (a 3261 compliant sip proxy) with additional annotations to explain in detail what each line means:
# Specifies the relative location of the resiprocate build directory BUILD = ../build # Some definitions that need to be included before anything else include $(BUILD)/Makefile.pre # 3rd parth package dependencies. Note that these are declared in a particular # order. For example, DUM is dependent on RESIPROCATE which is dependent on # OPENSSL. By declaring packages here, this will result in particular compile line # definitions, include paths and library search paths being defined. PACKAGES += DUM RESIPROCATE OPENSSL ARES DB4CXX PTHREAD POPT # Specify any subdirectories where code will be defined (any .cxx or .c files) CODE_SUBDIRS = monkeys stateAgents # The resulting library name will be librepro.so or librepro.a TARGET_LIBRARY = librepro # One or more target executables. Each entry in TESTPROGRAMS will be compiled # against the above set of packages as well as the files specified in the SRC # declaration below. TESTPROGRAMS = repro.cxx SRC += \ RouteStore.cxx \ UserStore.cxx \ ConfigStore.cxx \ AclStore.cxx \ Store.cxx \ AbstractDb.cxx \ BerkeleyDb.cxx \ \ CommandLineParser.cxx \ HttpBase.cxx \ HttpConnection.cxx \ WebAdmin.cxx \ WebAdminThread.cxx \ \ Proxy.cxx \ Registrar.cxx \ ReproServerAuthManager.cxx \ RequestContext.cxx \ ResponseContext.cxx \ RequestProcessor.cxx \ RequestProcessorChain.cxx \ \ monkeys/DigestAuthenticator.cxx \ monkeys/StrictRouteFixup.cxx \ monkeys/AmIResponsible.cxx \ monkeys/IsTrustedNode.cxx \ monkeys/ConstantLocationMonkey.cxx \ monkeys/LocationServer.cxx \ monkeys/StaticRoute.cxx \ monkeys/StrictRouteFixup.cxx \ \ # A conditional compilation to avoid building certain files if SSL is not being used ifeq ($(USE_SSL), true) SRC += stateAgents/CertServer.cxx \ stateAgents/CertPublicationHandler.cxx \ stateAgents/CertSubscriptionHandler.cxx \ stateAgents/PrivateKeyPublicationHandler.cxx \ stateAgents/PrivateKeySubscriptionHandler.cxx endif # A set of definitions that must be included after everything else. include $(BUILD)/Makefile.post
Build System Internals
All of the package definitions for resiprocate are defined in sip/build/Makefile.pkg. For each package the following variables can be defined (optionally):
PACKAGE_LIBNAME # base of the library name without lib prefix or library suffix PACKAGE_LDFLAGS # any parameters that should be passed to linker when this library is included PACKAGE_LIBDIRS # a space separated list of directories where related libraries are searched for PACKAGE_LDLIBS_LAST # a space separated list of libraries that should be included at the end of the lib list PACKAGE_INCLUDEDIRS # a space separated list of directories where related include files are searched for PACKAGE_DEFINES # a space separated list of definitions (e.g. -D foo) passed to compiler for this package PACKAGE_DEPENDS
For example, the ARES package definition only specifies the following variables:
ARES_INCLUDEDIRS := $(ROOT)/contrib/ares ARES_LIBDIRS := $(ROOT)/contrib/ares ARES_LIBNAME := ares
The following is a current list of all packages in the resiprocate opensource project:
- PTHREAD - pthread library
- OPENSSL - openssl library for TLS and SSL development
- ARES - asyncrhonous dns library
- DUM - dialog usage manager library
- RESIPROCATE - the basic transaction layer library of resiprocate