Convert to "split build" cmake system
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Tue, 12 Jun 2012 07:11:40 +0000 (09:11 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Tue, 12 Jun 2012 07:11:40 +0000 (09:11 +0200)
71 files changed:
.gitignore
CMake.config [deleted file]
CMake.os [deleted file]
CMakeLists.txt
Makefile [deleted file]
README-compilation.txt [deleted file]
cmake/OONFBuildLibrary.cmake [new file with mode: 0644]
cmake/cc_flags.cmake [moved from CMake.flags with 62% similarity]
cmake/cross/README-crosscompile.txt [moved from files/README-crosscompile.txt with 79% similarity]
cmake/cross/android_on_linux.cmake [moved from files/android_on_linux.cmake with 100% similarity]
cmake/cross/llvm-clang.cmake [moved from files/llvm-clang.cmake with 100% similarity]
cmake/cross/win32_on_linux.cmake [moved from files/win32_on_linux.cmake with 100% similarity]
cmake/files/OONFBuildTreeSettings.cmake.in [new file with mode: 0644]
cmake/files/OONFConfig.cmake.in [new file with mode: 0644]
cmake/files/OONFConfigVersion.cmake.in [new file with mode: 0644]
cmake/files/framework.doxyfile.in [moved from framework.doxyfile.in with 100% similarity]
cmake/generate_builddata.cmake [new file with mode: 0755]
external/CMakeLists.txt [new file with mode: 0644]
external/regex/CMakeLists.txt [new file with mode: 0644]
external/regex/COPYRIGHT [moved from src-api/regex/COPYRIGHT with 100% similarity]
external/regex/WHATSNEW [moved from src-api/regex/WHATSNEW with 100% similarity]
external/regex/cclass.h [moved from src-api/regex/cclass.h with 100% similarity]
external/regex/cname.h [moved from src-api/regex/cname.h with 100% similarity]
external/regex/engine.c [moved from src-api/regex/engine.c with 100% similarity]
external/regex/re_format.7 [moved from src-api/regex/re_format.7 with 100% similarity]
external/regex/regcomp.c [moved from src-api/regex/regcomp.c with 100% similarity]
external/regex/regerror.c [moved from src-api/regex/regerror.c with 100% similarity]
external/regex/regex.3 [moved from src-api/regex/regex.3 with 100% similarity]
external/regex/regex.h [moved from src-api/regex/regex.h with 100% similarity]
external/regex/regex2.h [moved from src-api/regex/regex2.h with 100% similarity]
external/regex/regexec.c [moved from src-api/regex/regexec.c with 100% similarity]
external/regex/regfree.c [moved from src-api/regex/regfree.c with 100% similarity]
external/regex/utils.h [moved from src-api/regex/utils.h with 100% similarity]
files/check_licences.sh
lib_config.cmake [new file with mode: 0644]
src-api/CMakeLists.txt
src-api/android/README [deleted file]
src-api/builddata/CMakeLists.txt [deleted file]
src-api/builddata/app_config.h.in [deleted file]
src-api/builddata/data.c.in [deleted file]
src-api/builddata/generate_builddata.cmake [deleted file]
src-api/builddata/generate_static_loader.cmake [deleted file]
src-api/common/CMakeLists.txt
src-api/common/common_types.h
src-api/config/CMakeLists.txt
src-api/core/CMakeLists.txt
src-api/core/olsr_cfg.c
src-api/core/olsr_cfg.h
src-api/core/olsr_http.c
src-api/core/olsr_libdata.c.in [moved from src-api/builddata/plugin_static.h with 80% similarity]
src-api/core/olsr_libdata.h [moved from src-api/builddata/data.h with 89% similarity]
src-api/core/olsr_logging.c
src-api/core/olsr_logging.h
src-api/core/olsr_plugins.c
src-api/core/os_generic/os_syslog_generic.c
src-api/packetbb/CMakeLists.txt
src-api/regex/CMakeLists.txt [deleted file]
src-plugins/CMake.plugin [deleted file]
src-plugins/cfgio_file/CMakeLists.txt
src-plugins/cfgparser_compact/CMakeLists.txt
src-plugins/httptelnet/CMakeLists.txt
src-plugins/remotecontrol/CMakeLists.txt
src/CMake.link_dynamic [deleted file]
src/CMake.link_static [deleted file]
src/CMakeLists.txt [deleted file]
src/olsr_main.c [deleted file]
src/olsr_setup.c [deleted file]
src/olsr_setup.h [deleted file]
tests/common/CMakeLists.txt
tests/config/CMakeLists.txt
tests/packetbb/CMakeLists.txt

index 5fc4887..b8ce6a0 100644 (file)
@@ -1,19 +1,3 @@
-# git-ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
-
-# build directories
-build
-build-win32/
-build-clang/
-html/
-
-# eclipse development files/directory
 .cproject
 .project
-.settings/
-
-upload.sh
+build
diff --git a/CMake.config b/CMake.config
deleted file mode 100644 (file)
index 877c89d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-###############################
-#### Generic configuration ####
-###############################
-
-# set CMAKE build type for application, api and plugins
-# (Debug, Release, MinSizeRel)
-set (CMAKE_BUILD_TYPE Debug)
-
-# remove logging level from application, core-api and plugins
-set (OONF_REMOVE_DEBUG_LOGGING false)
-set (OONF_REMOVE_INFO_LOGGING  false)
-set (OONF_REMOVE_WARN_LOGGING  false)
-
-# remove help texts from application, core-api and plugins
-set (OONF_REMOVE_HELPTEXT false)
-
-###########################################
-#### Default Application configuration ####
-###########################################
-
-# set name of program the executable and library prefix
-set (OONF_APP Olsrd)
-set (OONF_EXE olsrd)
-set (OONF_LIBPREFIX olsrd)
-
-# set default configuration file, if not set it will be '/etc/<OONF_APP>.conf'
-# on linux/bsd/osx and '<OONF_EXE>.conf' (replaced .exe with .conf)
-
-# set (OONF_DEFAULT_CONF "/etc/olsrd.conf")
-
-# setup custom text before and after default help message
-set (OONF_HELP_PREFIX "Activates OLSR.org routing daemon\\\\n")
-set (OONF_HELP_SUFFIX "")
-
-# setup custom text after version string
-set (OONF_VERSION_TRAILER "Visit http://www.olsr.org\\\\n")
-
-# set application version (e.g. 0.7.0)
-set (OONF_VERSION 0.7.0)
-
-# set static plugins (list of plugin names, separated by space/newline)
-set (OONF_STATIC_PLUGINS cfgparser_compact cfgio_file remotecontrol httptelnet)
-
-# choose if framework should be linked static or dynamic
-set (OONF_FRAMEWORD_DYNAMIC false)
-
-# set to true to stop application running without root privileges (true/false)
-set (OONF_NEED_ROOT false)
-
-# set to true if the application needs to set ip routes for traffic forwarding
-set (OONF_NEED_ROUTING false)
-
-# set to true to link packetbb API to application
-set (OONF_NEED_PACKETBB true)
-
-# name of the libnl library
-set (OONF_LIBNL nl)
-
-####################################
-#### PacketBB API configuration ####
-####################################
-
-# disallow the consumer to drop a tlv context
-set (PBB_DISALLOW_CONSUMER_CONTEXT_DROP false)
-
-# activate assets() to check state of the pbb write
-# and prevent calling functions at the wrong time
-set (PBB_WRITER_STATE_MACHINE true)
-
-# activate several unnecessary cleanup operations
-# that make debugging the API easier
-set (PBB_DEBUG_CLEANUP true)
-
-# activate rfc5444 address-block compression
-set (PBB_DO_ADDR_COMPRESSION true)
-
-# set to 1 to clear all bits in an address which are not included
-# in the subnet mask
-# set this to false to make interop tests!
-set (PBB_CLEAR_ADDRESS_POSTFIX false)
diff --git a/CMake.os b/CMake.os
deleted file mode 100644 (file)
index 783259f..0000000
--- a/CMake.os
+++ /dev/null
@@ -1,32 +0,0 @@
-# detect operation system and add missing variables for easy CMAKE OS detection
-STRING(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
-
-IF (UNIX)
-    ADD_DEFINITIONS(-DOS_UNIX)
-ENDIF (UNIX)
-
-IF (${SYSTEM_NAME} MATCHES "linux")
-    message("Linux detected")
-    SET(LINUX true)
-ENDIF (${SYSTEM_NAME} MATCHES "linux")
-
-IF (${SYSTEM_NAME} MATCHES "android" OR ANDROID)
-    message("Android detected")
-    SET(LINUX true)
-    SET(ANDROID true)
-    SET(UNIX true)
-ENDIF (${SYSTEM_NAME} MATCHES "android" OR ANDROID)
-
-IF (${SYSTEM_NAME} MATCHES "bsd")
-    message("BSD detected")
-    SET(BSD true)
-ENDIF (${SYSTEM_NAME} MATCHES "bsd")
-
-IF (APPLE)
-    message("Mac OS detected")
-    set(BSD true)
-ENDIF (APPLE)
-
-IF (WIN32)
-    message("Win32 detected")
-ENDIF (WIN32)
index 0607c9e..ab98a29 100644 (file)
@@ -1,31 +1,54 @@
-project(OONF_APP C)
+project (OONF C)
 cmake_minimum_required(VERSION 2.8)
 
-if(NOT OONF_CONFIG)
-    set(OONF_CONFIG ./CMake.config)
-endif(NOT OONF_CONFIG)
+###########################
+#### API configuration ####
+###########################
 
-include(${OONF_CONFIG})
-include(./CMake.os)
+set(OONF_MAJOR_VERSION 0)
+set(OONF_MINOR_VERSION 7)
+set(OONF_PATCH_VERSION 0)
 
-# create all data inside the build directory
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+# set library version
+set (OONF_VERSION ${OONF_MAJOR_VERSION}.${OONF_MINOR_VERSION}.${OONF_PATCH_VERSION})
 
-# set release specific compiler options
-set(CMAKE_C_FLAGS_DEBUG "-g")
-set(CMAKE_C_FLAGS_RELEASE "-O4 -g0 -DNDEBUG")
-set(CMAKE_C_FLAGS_MINSIZEREL "-Os -g0 -DNDEBUG")
+# enable cached variables
+include (./lib_config.cmake)
 
-# add generic compiler options
-ADD_DEFINITIONS(-Werror)
-include(./CMake.flags)
+# include flags
+include (./cmake/cc_flags.cmake)
+
+SET(OONF_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+######################################
+#### Install target configuration ####
+######################################
+
+set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
+set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
+set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
+if(WIN32 AND NOT CYGWIN)
+  set(DEF_INSTALL_CMAKE_DIR CMake)
+else()
+  set(DEF_INSTALL_CMAKE_DIR lib/CMake)
+endif()
+set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
+
+# Make relative paths absolute (needed later on)
+foreach(p LIB BIN INCLUDE CMAKE)
+  set(var INSTALL_${p}_DIR)
+  if(NOT IS_ABSOLUTE "${${var}}")
+    set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
+  endif()
+endforeach()
+
+########################
+#### Doxygen target ####
+########################
 
-# add a target to generate API documentation with Doxygen
 find_package(Doxygen)
 if(DOXYGEN_FOUND)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/framework.doxyfile.in
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/framework.doxyfile.in
         ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile @ONLY)
     add_custom_target(doc
         ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/framework.doxyfile
@@ -34,16 +57,57 @@ if(DOXYGEN_FOUND)
     )
 endif(DOXYGEN_FOUND)
 
-# set include directories
-include_directories(src)
+#########################
+#### Compile targets ####
+#########################
+
+# remove export set file
+FILE(REMOVE "${PROJECT_BINARY_DIR}/OONFLibraryDepends.cmake")
+
+# include build helper
+include (cmake/OONFBuildLibrary.cmake)
+
+# include files
+include_directories(${PROJECT_BINARY_DIR})
+include_directories(external)
 include_directories(src-api)
 include_directories(src-api/core)
-include_directories(${CMAKE_BINARY_DIR})
 
 ENABLE_TESTING()
 
 # start compiling core and plugins
-add_subdirectory(src)
 add_subdirectory(src-api)
 add_subdirectory(src-plugins)
+add_subdirectory(external)
 add_subdirectory(tests)
+
+###############################
+#### Installation handling ####
+###############################
+
+# get list of include directories
+get_property(INCLUDE_LIST DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
+
+# Export the package for use from the build-tree
+# (this registers the build-tree with a global CMake-registry)
+export(PACKAGE OONF)
+
+# Create a OONFBuildTreeSettings.cmake file for the use from the build tree
+configure_file(./cmake/files/OONFBuildTreeSettings.cmake.in
+    "${PROJECT_BINARY_DIR}/OONFBuildTreeSettings.cmake" @ONLY)
+
+# Create the OONFConfig.cmake and OONFConfigVersion files
+file(RELATIVE_PATH CONF_REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
+   "${INSTALL_INCLUDE_DIR}")
+configure_file(./cmake/files/OONFConfig.cmake.in
+    "${PROJECT_BINARY_DIR}/OONFConfig.cmake" @ONLY)
+configure_file(./cmake/files/OONFConfigVersion.cmake.in
+    "${PROJECT_BINARY_DIR}/OONFConfigVersion.cmake" @ONLY)
+
+# Copy OONFBuildLibrary to build directory
+file(COPY ./cmake/OONFBuildLibrary.cmake
+     DESTINATION ${PROJECT_BINARY_DIR})
+
+# Install the export set for use with the install-tree
+install(EXPORT OONFLibraryDepends DESTINATION
+    "${INSTALL_CMAKE_DIR}" COMPONENT dev)
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 51562cd..0000000
--- a/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-BUILD_DIR=build
-
-.ONESHELL:
-.PHONY: cmake
-
-all: cmake FORCE
-       @${MAKE} -s -C ${BUILD_DIR} all
-clean:
-       @rm -rf build
-
-cmake:
-       @test -e ${BUILD_DIR}/Makefile || sh -c "rm -rf ${BUILD_DIR}; mkdir $(BUILD_DIR) ; cd $(BUILD_DIR) ;  cmake .."
-
-FORCE:
-
-.DEFAULT: cmake FORCE
-       @test -e ${BUILD_DIR}/Makefile || sh -c "rm -rf ${BUILD_DIR}; mkdir $(BUILD_DIR) ; cd $(BUILD_DIR) ;  cmake .."
-       @${MAKE} -s -C ${BUILD_DIR} $@
diff --git a/README-compilation.txt b/README-compilation.txt
deleted file mode 100644 (file)
index a32428e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Prerequisites
-==============
-
-Install:
-
-cmake
-gcc
-gnu-make
-
-
-Building (quick way)
-====================
-
-make
-
-
-Building (the cmake way)
-========================
-
-mkdir build
-cd build
-cmake ..
-make
diff --git a/cmake/OONFBuildLibrary.cmake b/cmake/OONFBuildLibrary.cmake
new file mode 100644 (file)
index 0000000..7fdd32c
--- /dev/null
@@ -0,0 +1,59 @@
+# generic oonf library creation
+
+function (oonf_internal_create_plugin prefix libname source linkto)
+    ADD_LIBRARY(${prefix}_${libname} SHARED ${source})
+    ADD_LIBRARY(${prefix}_static_${libname} STATIC ${source})
+
+    IF(WIN32)
+        TARGET_LINK_LIBRARIES(${prefix}_${libname} ws2_32 iphlpapi)
+    ENDIF(WIN32)
+
+    SET_TARGET_PROPERTIES(${prefix}_${libname} PROPERTIES SOVERSION ${OONF_VERSION})
+
+    IF (linkto)
+        TARGET_LINK_LIBRARIES(${prefix}_${libname} ${linkto})
+        TARGET_LINK_LIBRARIES(${prefix}_static_${libname} ${linkto})
+    ENDIF (linkto)
+endfunction (oonf_internal_create_plugin)
+
+function (oonf_create_library libname source include linkto)
+    oonf_internal_create_plugin(oonf "${libname}" "${source}" "${linkto}")
+    
+    # Add all target to the build-tree export set
+    export(TARGETS oonf_${libname} oonf_static_${libname}
+        APPEND FILE "${PROJECT_BINARY_DIR}/OONFLibraryDepends.cmake")
+    
+    IF (include)
+        set_target_properties(oonf_${libname} PROPERTIES
+            PUBLIC_HEADER "${OONF_COMMON_INCLUDES}")
+  
+        set_target_properties(oonf_static_common PROPERTIES
+            PUBLIC_HEADER "${OONF_COMMON_INCLUDES}")
+    ENDIF (include)
+
+    install(TARGETS oonf_${libname}
+        # IMPORTANT: Add the library to the "export-set"
+        EXPORT OONFLibraryDepends
+        LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
+        PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/oonf/${libname}"
+            COMPONENT dev)
+
+    install(TARGETS oonf_static_${libname}
+        # IMPORTANT: Add the static library to the "export-set"
+        EXPORT OONFLibraryDepends
+        ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT stlib
+        PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/oonf/${libname}"
+            COMPONENT dev)
+endfunction (oonf_create_library)
+
+function (oonf_create_plugin libname source include linkto)
+    oonf_create_library("${libname}" "${source}" "${include}" "${linkto}")
+    
+    SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES COMPILE_FLAGS "-DPLUGIN_FULLNAME=${libname}")
+endfunction (oonf_create_plugin)
+
+function (oonf_create_app_plugin libname source include linkto)
+    oonf_internal_create_plugin("${OONF_APP_LIBPREFIX}" "${libname}" "${source}" "${include}" "${linkto}")
+    
+    SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES COMPILE_FLAGS "-DPLUGIN_FULLNAME=${libname}")
+endfunction (oonf_create_app_plugin)
similarity index 62%
rename from CMake.flags
rename to cmake/cc_flags.cmake
index 069f030..764b5d3 100644 (file)
@@ -9,16 +9,54 @@ function(add_compiler_flag flag)
     endif()
 endfunction(add_compiler_flag)
 
+# Make sure this file is not run again
+SET(OONF_FLAGS_SET true)
+
+# detect operation system and add missing variables for easy CMAKE OS detection
+STRING(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
+
+IF (${SYSTEM_NAME} MATCHES "android" OR ANDROID)
+    message("Android detected")
+    SET(LINUX true)
+    SET(ANDROID true)
+    SET(UNIX true)
+ELSEIF (${SYSTEM_NAME} MATCHES "linux")
+    message("Linux detected")
+    SET(LINUX true)
+ENDIF (${SYSTEM_NAME} MATCHES "android" OR ANDROID)
+
+IF (APPLE)
+    message("Mac OS detected")
+    set(BSD true)
+ELSEIF (${SYSTEM_NAME} MATCHES "bsd")
+    message("BSD detected")
+    SET(BSD true)
+ENDIF (APPLE)
+
+IF (WIN32)
+    message("Win32 detected")
+ENDIF (WIN32)
+
+# add build directory to include path for autogenerated files
+include_directories(${CMAKE_BINARY_DIR})
+
+# Add a compiler flag for unix systems
+IF (UNIX)
+    ADD_DEFINITIONS(-D__unix__)
+ENDIF (UNIX)
+
 # compiler flags that needs to be there both for API and application
-IF (OONF_REMOVE_DEBUG_LOGGING)
-    ADD_DEFINITIONS(-DREMOVE_LOG_DEBUG)
-ENDIF (OONF_REMOVE_DEBUG_LOGGING)
-IF (OONF_REMOVE_INFO_LOGGING)
-    ADD_DEFINITIONS(-DREMOVE_LOG_INFO)
-ENDIF (OONF_REMOVE_INFO_LOGGING)
-IF (OONF_REMOVE_WARN_LOGGING)
-    ADD_DEFINITIONS(-DREMOVE_LOG_WARN)
-ENDIF (OONF_REMOVE_WARN_LOGGING)
+IF (OONF_MAX_LOGGING_LEVEL STREQUAL "none")
+  ADD_DEFINITIONS(-DMAX_LOGGING_LEVEL=0)
+ELSEIF (OONF_MAX_LOGGING_LEVEL STREQUAL "warn")
+  ADD_DEFINITIONS(-DMAX_LOGGING_LEVEL=1)
+ELSEIF (OONF_MAX_LOGGING_LEVEL STREQUAL "info")
+  ADD_DEFINITIONS(-DMAX_LOGGING_LEVEL=2)
+ELSEIF (OONF_MAX_LOGGING_LEVEL STREQUAL "debug")
+  ADD_DEFINITIONS(-DMAX_LOGGING_LEVEL=3)
+ELSE (OONF_MAX_LOGGING_LEVEL STREQUAL "none")
+  message(FATAL_ERROR "Unknown maximum debug level'${OONF_MAX_LOGGING_LEVEL}'")
+ENDIF (OONF_MAX_LOGGING_LEVEL STREQUAL "none")
 
 IF (OONF_REMOVE_HELPTEXT)
     ADD_DEFINITIONS(-DREMOVE_HELPTEXT)
@@ -33,20 +71,6 @@ ELSE(ANDROID OR WIN32)
     ADD_DEFINITIONS(-std=c99 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D__BSD_VISIBLE -D_DARWIN_C_SOURCE -D__KERNEL_STRICT_NAMES)
 ENDIF (ANDROID OR WIN32)
 
-# default configuration file
-IF (NOT EXISTS ${OONF_DEFAULT_CONF})
-  # generate OLSRd default config file
-  IF(WIN32)
-    # windows default config file is in the same directory,
-    # it has the same name as the executable, just replaced the .exe
-    # with .conf 
-    string(REPLACE ".exe" ".conf" OONF_DEFAULT_CONF "${OONF_EXE}")
-  ELSE(WIN32)
-    # unix default config file is /etc/<executable-name>.conf
-    set (OONF_DEFAULT_CONF "/etc/${OONF_EXE}.conf")
-  ENDIF(WIN32)
-ENDIF()
-
 # add some necessary additions for win32
 IF (WIN32)
     ADD_DEFINITIONS(-D_WIN32_WINNT=0x0502)
@@ -54,6 +78,19 @@ IF (WIN32)
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
 ENDIF(WIN32)
 
+# create all data inside the build directory
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+
+# set release specific compiler options
+set(CMAKE_C_FLAGS_DEBUG "-g")
+set(CMAKE_C_FLAGS_RELEASE "-O4 -g0 -DNDEBUG")
+set(CMAKE_C_FLAGS_MINSIZEREL "-Os -g0 -DNDEBUG")
+
+# always add -Werror compiler options
+ADD_DEFINITIONS(-Werror)
+
 # set compiler flags that are supported
 add_compiler_flag(-finline-functions-called-once)
 add_compiler_flag(-funit-at-a-time)
similarity index 79%
rename from files/README-crosscompile.txt
rename to cmake/cross/README-crosscompile.txt
index e33ec66..ad79c6b 100644 (file)
@@ -7,7 +7,7 @@ cd build-android
 
 2) then run cmake with the right crosscompile template (see /files for examples)
 
-cmake -D CMAKE_TOOLCHAIN_FILE=../files/android_on_linux.cmake ..
+cmake -D CMAKE_TOOLCHAIN_FILE=../cmake/files/android_on_linux.cmake ..
 
 3) start building
 
diff --git a/cmake/files/OONFBuildTreeSettings.cmake.in b/cmake/files/OONFBuildTreeSettings.cmake.in
new file mode 100644 (file)
index 0000000..58e8afd
--- /dev/null
@@ -0,0 +1,3 @@
+set(OONF_INCLUDE_DIRS
+  "@INCLUDE_LIST@"
+  "@PROJECT_BINARY_DIR@")
diff --git a/cmake/files/OONFConfig.cmake.in b/cmake/files/OONFConfig.cmake.in
new file mode 100644 (file)
index 0000000..20866ba
--- /dev/null
@@ -0,0 +1,21 @@
+# - Config file for the OONF package
+# It defines the following variables
+#  OONF_INCLUDE_DIRS - include directories for OONF
+#  OONF_CMAKE_FILE - file with OONF cmake functions
+
+# get this files directory
+get_filename_component(OONF_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if(EXISTS "${OONF_CMAKE_DIR}/CMakeCache.txt")
+   # In build tree
+   include("${OONF_CMAKE_DIR}/OONFBuildTreeSettings.cmake")
+else()
+   set(OONF_INCLUDE_DIRS "${OONF_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@")
+endif()
+# Our library dependencies (contains definitions for IMPORTED targets)
+include("${OONF_CMAKE_DIR}/OONFLibraryDepends.cmake")
+
+# import build functions for app plugins
+SET (OONF_BUILD_LIBRARY "${OONF_CMAKE_DIR}/OONFBuildLibrary.cmake")
+message("build library: ${OONF_BUILD_LIBRARY}")
diff --git a/cmake/files/OONFConfigVersion.cmake.in b/cmake/files/OONFConfigVersion.cmake.in
new file mode 100644 (file)
index 0000000..29f7e07
--- /dev/null
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION "@OONF_VERSION@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()
diff --git a/cmake/generate_builddata.cmake b/cmake/generate_builddata.cmake
new file mode 100755 (executable)
index 0000000..f9c3c6f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/cmake
+
+# look for git executable 
+find_program(found_git git)
+
+message ("GIT api: ${GIT}")
+
+SET(OONF_LIB_GIT "cannot read git repository")
+SET(OONF_LIB_CHANGE "")
+
+IF(NOT ${found_git} STREQUAL "found_git-NOTFOUND" AND EXISTS ${GIT})
+    # everything is fine, read commit and diff stat
+    execute_process(COMMAND git describe --long --tags 
+        OUTPUT_VARIABLE OONF_LIB_GIT OUTPUT_STRIP_TRAILING_WHITESPACE)
+    execute_process(COMMAND git diff --shortstat HEAD ./src-api/ ./src-plugins/ ./cmake ./external ./CMakeLists.txt
+        OUTPUT_VARIABLE OONF_LIB_CHANGE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF()
+
+# create builddata file
+configure_file (${SRC} ${DST})
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5f9d48d
--- /dev/null
@@ -0,0 +1,3 @@
+if (WIN32)
+    add_subdirectory(regex)
+endif (WIN32)
diff --git a/external/regex/CMakeLists.txt b/external/regex/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7a3815b
--- /dev/null
@@ -0,0 +1,15 @@
+SET(OONF_REGEX_SRCS regcomp.c
+                    regerror.c
+                    regexec.c
+                    regfree.c)
+
+ADD_LIBRARY(oonf_static_regex ${OONF_REGEX_SRCS})
+ADD_LIBRARY(oonf_regex SHARED ${OONF_REGEX_SRCS})
+
+IF(WIN32)
+    TARGET_LINK_LIBRARIES(oonf_static_regex oonf_static_common)
+    TARGET_LINK_LIBRARIES(oonf_regex oonf_common)
+
+    TARGET_LINK_LIBRARIES(oonf_static_regex ws2_32 iphlpapi)
+    TARGET_LINK_LIBRARIES(oonf_regex ws2_32 iphlpapi)
+ENDIF(WIN32)
similarity index 100%
rename from src-api/regex/cname.h
rename to external/regex/cname.h
similarity index 100%
rename from src-api/regex/regex.3
rename to external/regex/regex.3
similarity index 100%
rename from src-api/regex/regex.h
rename to external/regex/regex.h
similarity index 100%
rename from src-api/regex/utils.h
rename to external/regex/utils.h
index 54b68f7..50f2312 100755 (executable)
@@ -6,9 +6,6 @@ EXCEPT="$EXCEPT -not -path '../src-api/regex/*'"
 # ../src-api/android/linux/* is Linux Kernel
 EXCEPT="$EXCEPT -not -path '../src-api/android/linux/*'"
 
-# ../src-plugins/nl80211_listener/src/nl80211.h is Linux nl80211
-EXCEPT="$EXCEPT -not -path '../src-plugins/nl80211_listener/src/nl80211.h'"
-
 LEN=`cat default_licence.txt |wc -c`
 
 for file in $(eval find ../src*  -type f -name *[.][ch] $EXCEPT)
diff --git a/lib_config.cmake b/lib_config.cmake
new file mode 100644 (file)
index 0000000..1a6ed04
--- /dev/null
@@ -0,0 +1,32 @@
+###########################
+#### API configuration ####
+###########################
+
+# maximum logging level
+set(OONF_MAX_LOGGING_LEVEL debug CACHE STRING "Maximum logging level compiled into OONF API (none, warn, info, debug)")
+
+# name of the libnl library
+set (OONF_LIBNL nl CACHE STRING "Library used for netlink operations")
+
+####################################
+#### PacketBB API configuration ####
+####################################
+
+# disallow the consumer to drop a tlv context
+set (PBB_DISALLOW_CONSUMER_CONTEXT_DROP false CACHE BOOL "disallow the consumer to drop a tlv context")
+
+# activate assets() to check state of the pbb writer
+# and prevent calling functions at the wrong time
+set (PBB_WRITER_STATE_MACHINE true CACHE BOOL "activate writer-statemachine")
+
+# activate several unnecessary cleanup operations
+# that make debugging the API easier
+set (PBB_DEBUG_CLEANUP true CACHE BOOL "additional cleanup operations to simplify debugging")
+
+# activate rfc5444 address-block compression
+set (PBB_DO_ADDR_COMPRESSION true CACHE BOOL "use rfc5444 address compression")
+
+# set to true to clear all bits in an address which are not included
+# in the subnet mask
+# set this to false to make interop tests!
+set (PBB_CLEAR_ADDRESS_POSTFIX false CACHE BOOL "clear host bits of subnet addresses")
index b58dec7..e0e597a 100644 (file)
@@ -1,9 +1,8 @@
 # build framework
-add_subdirectory(builddata)
 add_subdirectory(common)
-IF (WIN32 OR ANDROID)
+IF (WIN32)
     add_subdirectory(regex)
-ENDIF(WIN32 OR ANDROID)
+ENDIF(WIN32)
 add_subdirectory(config)
 add_subdirectory(packetbb)
 add_subdirectory(core)
diff --git a/src-api/android/README b/src-api/android/README
deleted file mode 100644 (file)
index c5fc04c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-This directory contains some Android specific code. (Mostly dealing with providing missing files from Android NDK.)
diff --git a/src-api/builddata/CMakeLists.txt b/src-api/builddata/CMakeLists.txt
deleted file mode 100644 (file)
index 286391b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# generate full version string and initialization for static plugins
-SET(GEN_DATA_C           ${PROJECT_BINARY_DIR}/data.c)
-SET(GEN_PLUGIN_STATIC_C  ${PROJECT_BINARY_DIR}/plugin_static.c)
-
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/app_config.h.in ${CMAKE_BINARY_DIR}/builddata/app_config.h)
-
-ADD_CUSTOM_TARGET(AppCleanData ALL
-    COMMAND ${CMAKE_COMMAND} -E remove ${GEN_BUILDDATA_H} ${GEN_PLUGIN_STATIC_C}
-    COMMENT "Remove old builddata"
-)
-
-ADD_CUSTOM_COMMAND (
-    OUTPUT ${GEN_DATA_C} ${GEN_PLUGIN_STATIC_C}
-    COMMAND ${CMAKE_COMMAND}
-        -DSRC=${CMAKE_CURRENT_SOURCE_DIR}/data.c.in
-        -DDST=${GEN_DATA_C}
-        -DGIT=${PROJECT_SOURCE_DIR}/.git
-        -DOONF_APP=${OONF_APP}
-        -DOONF_VERSION=${OONF_VERSION}
-        -DOONF_VERSION_TRAILER=${OONF_VERSION_TRAILER}
-        -DOONF_HELP_PREFIX=${OONF_HELP_PREFIX}
-        -DOONF_HELP_SUFFIX=${OONF_HELP_SUFFIX}
-        -DOONF_DEFAULT_CONF=${OONF_DEFAULT_CONF}
-        -DOONF_LIBPREFIX=${OONF_LIBPREFIX}
-        -DCMAKE_SYSTEM=${CMAKE_SYSTEM}
-        -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
-        -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}
-        -P ${CMAKE_CURRENT_SOURCE_DIR}/generate_builddata.cmake
-    COMMAND ${CMAKE_COMMAND}
-        -DDST=${GEN_PLUGIN_STATIC_C}
-        -DPLUGINS="${OONF_STATIC_PLUGINS}"
-        -P ${CMAKE_CURRENT_SOURCE_DIR}/generate_static_loader.cmake
-    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-    COMMENT "Create new builddata"
-)
-
-# create static library with the generated data
-ADD_LIBRARY(static_builddata STATIC ${GEN_DATA_C})
-ADD_LIBRARY(static_pluginloader STATIC ${GEN_PLUGIN_STATIC_C})
-ADD_DEPENDENCIES(static_builddata AppCleanData)
-ADD_DEPENDENCIES(static_pluginloader AppCleanData)
diff --git a/src-api/builddata/app_config.h.in b/src-api/builddata/app_config.h.in
deleted file mode 100644 (file)
index a169fe3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#ifndef OLSR_APP_CONFIG_H_
-#define OLSR_APP_CONFIG_H_
-
-#define OONF_NEED_ROOT ${OONF_NEED_ROOT}
-#define OONF_NEED_ROUTING ${OONF_NEED_ROUTING}
-#define OONF_NEED_PACKETBB ${OONF_NEED_PACKETBB}
-
-#endif /* OLSR_APP_CONFIG_H_ */
diff --git a/src-api/builddata/data.c.in b/src-api/builddata/data.c.in
deleted file mode 100644 (file)
index b3623a6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#include "builddata/data.h"
-
-static struct olsr_builddata _builddata = {
-  .app_name = "${OONF_APP}",
-  .version = "${OONF_VERSION}",
-  .versionstring_trailer = "${OONF_VERSION_TRAILER}",
-  .help_prefix = "${OONF_HELP_PREFIX}",
-  .help_suffix = "${OONF_HELP_SUFFIX}",
-  
-  .default_config = "${OONF_DEFAULT_CONF}",
-  
-  .git_commit = "${OONF_SRC_GIT}",
-  .git_change = "${OONF_SRC_CHANGE}",
-  
-  .builddate = __DATE__" "__TIME__,
-  .buildsystem = "${CMAKE_SYSTEM}",
-  
-  .sharedlibrary_prefix = "${CMAKE_SHARED_LIBRARY_PREFIX}${OONF_LIBPREFIX}_",
-  .sharedlibrary_postfix = "${CMAKE_SHARED_LIBRARY_SUFFIX}",
-};
-
-const struct olsr_builddata *
-olsr_builddata_get(void) {
-  return &_builddata;
-}
diff --git a/src-api/builddata/generate_builddata.cmake b/src-api/builddata/generate_builddata.cmake
deleted file mode 100755 (executable)
index ded4bba..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/cmake
-
-# look for git executable 
-find_program(found_git git)
-
-IF(${found_git} STREQUAL "found_git-NOTFOUND" OR NOT EXISTS ${GIT})
-    # git executable or repository (.git) is not available
-    SET(OONF_SRC_GIT "cannot read git repository")
-    SET(OONF_SRC_CHANGE "")
-ELSE()
-    # everything is fine, read commit and diff stat
-    execute_process(COMMAND git describe --tags 
-        OUTPUT_VARIABLE OONF_SRC_GIT OUTPUT_STRIP_TRAILING_WHITESPACE)
-    execute_process(COMMAND git diff --shortstat HEAD ./src-api/ ./src-plugins/ 
-        OUTPUT_VARIABLE OONF_SRC_CHANGE OUTPUT_STRIP_TRAILING_WHITESPACE)
-ENDIF()
-
-# create builddata file
-configure_file (${SRC} ${DST})
diff --git a/src-api/builddata/generate_static_loader.cmake b/src-api/builddata/generate_static_loader.cmake
deleted file mode 100755 (executable)
index dc87341..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/cmake
-
-# replace spaces with string to convert into list
-message ("Generate static plugin loader for '${PLUGINS}'")
-
-string(REPLACE " " ";" PLUGIN_LIST "${PLUGINS}")
-
-# create C file which would call the static plugin constructors 
-file(WRITE  ${DST} "#include \"builddata/plugin_static.h\"\n")
-file(APPEND ${DST} "#include \"common/common_types.h\"\n")
-file(APPEND ${DST} "\n")
-
-FOREACH(plugin ${PLUGIN_LIST})
-    file(APPEND ${DST} "extern void hookup_plugin_${plugin}(void);\n")
-ENDFOREACH(plugin)
-
-file(APPEND ${DST} "\n")
-file(APPEND ${DST} "void\n")
-file(APPEND ${DST} "olsr_plugins_load_static(void) {\n")
-
-FOREACH(plugin ${PLUGIN_LIST})
-    file(APPEND ${DST} "  hookup_plugin_${plugin}();\n")
-ENDFOREACH(plugin)
-
-file(APPEND ${DST} "}\n")
index 1ca5d26..ef5ad08 100644 (file)
@@ -1,4 +1,4 @@
-SET(OONF_COMMON_SRCS autobuf.c
+SET(OONF_COMMON_SRCS  autobuf.c
                       avl_comp.c
                       avl.c
                       daemonize.c
@@ -6,10 +6,15 @@ SET(OONF_COMMON_SRCS autobuf.c
                       string.c
                       template.c)
 
-ADD_LIBRARY(static_common ${OONF_COMMON_SRCS})
-ADD_LIBRARY(${OONF_LIBPREFIX}_common SHARED ${OONF_COMMON_SRCS})
+SET(OONF_COMMON_INCLUDES autobuf.h
+                         avl_comp.h
+                         avl.h
+                         common_types.h
+                         container_of.h
+                         daemonize.h
+                         list.h
+                         netaddr.h
+                         string.h
+                         template.h)
 
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(static_common ws2_32 iphlpapi)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_common ws2_32 iphlpapi)
-ENDIF(WIN32)
\ No newline at end of file
+oonf_create_library("common" "${OONF_COMMON_SRCS}" "${OONF_COMMON_INCLUDES}" false)
index 9220447..a8fa029 100644 (file)
  * This force gcc to always inline, which prevents errors
  * with option -Os
  */
-#ifndef INLINE
-#ifdef __GNUC__
-#define INLINE inline __attribute__((always_inline))
-#else
+//#ifndef INLINE
+//#ifdef __GNUC__
+//#define INLINE inline __attribute__((always_inline))
+//#else
 #define INLINE inline
-#endif
-#endif
+//#endif
+//#endif
 
 /* printf size_t modifiers*/
 
index e360e99..51c6ab6 100644 (file)
@@ -1,20 +1,16 @@
-SET(OLSRD_CONFIG_SRCS cfg_cmd.c
+SET(OONF_CONFIG_SRCS cfg_cmd.c
                       cfg_db.c
                       cfg_io.c
                       cfg_parser.c
                       cfg_schema.c
                       cfg.c)
 
-ADD_LIBRARY(static_config STATIC ${OLSRD_CONFIG_SRCS})
-ADD_LIBRARY(${OONF_LIBPREFIX}_config SHARED ${OLSRD_CONFIG_SRCS})
+SET(OONF_CONFIG_INCLUDES cfg_cmd.h
+                          cfg_db.h
+                          cfg_io.h
+                          cfg_parser.h
+                          cfg_schema.h
+                          cfg.h)
 
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(static_config static_common)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_config ${OONF_LIBPREFIX}_common)
-
-    TARGET_LINK_LIBRARIES(static_config static_regex)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_config ${OONF_LIBPREFIX}_regex)
-
-    TARGET_LINK_LIBRARIES(static_config ws2_32 iphlpapi)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_config ws2_32 iphlpapi)
-ENDIF(WIN32)
+oonf_create_library("config" "${OONF_CONFIG_SRCS}" "${OONF_CONFIG_INCLUDES}" false)
+    
\ No newline at end of file
index 5291dff..fcdef84 100644 (file)
@@ -1,3 +1,27 @@
+# make sure that olsr_libdata is rebuild everytimes 
+SET(GEN_DATA_C ${PROJECT_BINARY_DIR}/olsr_libdata.c)
+
+ADD_CUSTOM_TARGET(LibCleanData ALL
+    COMMAND ${CMAKE_COMMAND} -E remove ${GEN_DATA_C}
+    COMMENT "Remove old library builddata"
+)
+
+ADD_CUSTOM_COMMAND (
+    OUTPUT ${GEN_DATA_C}
+    COMMAND ${CMAKE_COMMAND}
+        -DSRC=${CMAKE_CURRENT_SOURCE_DIR}/olsr_libdata.c.in
+        -DDST=${GEN_DATA_C}
+        -DGIT=${OONF_SOURCE_DIRECTORY}/.git
+        -DOONF_LIB_VERSION=${OONF_LIB_VERSION}
+        -DCMAKE_SYSTEM=${CMAKE_SYSTEM}
+        -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
+        -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}
+        -P ${CMAKE_SOURCE_DIR}/cmake/generate_builddata.cmake
+    DEPENDS LibCleanData
+    WORKING_DIRECTORY ${OONF_SOURCE_DIRECTORY}
+    COMMENT "Create new library builddata"
+)
+
 SET(OONF_CORE_SRCS olsr_callbacks.c
                    olsr_cfg.c
                    olsr_clock.c
@@ -13,9 +37,28 @@ SET(OONF_CORE_SRCS olsr_callbacks.c
                    olsr_stream_socket.c
                    olsr_telnet.c
                    olsr_timer.c
-                   olsr.c)
+                   olsr.c
+                   ${GEN_DATA_C})
 
-# add os_specific source files
+SET(OONF_CORE_INCLUDES olsr_callbacks.h
+                       olsr_cfg.h
+                       olsr_clock.h
+                       olsr_http.h
+                       olsr_interface.h
+                       olsr_logging_cfg.h
+                       olsr_logging.h
+                       olsr_memcookie.h
+                       olsr_netaddr_acl.h
+                       olsr_packet_socket.h
+                       olsr_plugins.h
+                       olsr_socket.h
+                       olsr_stream_socket.h
+                       olsr_telnet.h
+                       olsr_timer.h
+                       olsr.h
+                       olsr_libdata.h)
+
+# add os_specific source(include files
 # TODO: add BSD and WIN32
 IF(LINUX)
     SET(OONF_CORE_SRCS ${OONF_CORE_SRCS}
@@ -29,28 +72,11 @@ IF(LINUX)
                        os_linux/os_system_linux.c
                        os_linux/os_routing_linux.c
                        os_linux/os_clock_linux.c)
+    SET(OONF_CORE_INCLUDES ${OONF_CORE_INCLUDES}
+                           os_linux/os_net_linux.h
+                           os_linux/os_system_linux.h
+                           os_linux/os_routing_linux.h
+                           os_linux/os_clock_linux.h)
 ENDIF(LINUX)
 
-IF(ANDROID)
-    include_directories(src/android)
-ENDIF(ANDROID)
-
-ADD_LIBRARY(static_core STATIC ${OONF_CORE_SRCS})
-ADD_LIBRARY(${OONF_LIBPREFIX}_core SHARED ${OONF_CORE_SRCS})
-
-TARGET_LINK_LIBRARIES(static_core rt)
-TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_core rt)
-
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(static_core static_common)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_core ${OONF_LIBPREFIX}_common)
-
-    TARGET_LINK_LIBRARIES(static_core static_regex)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_core ${OONF_LIBPREFIX}_regex)
-
-    TARGET_LINK_LIBRARIES(static_core static_config)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_core ${OONF_LIBPREFIX}_config)
-
-    TARGET_LINK_LIBRARIES(static_core ws2_32 iphlpapi)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_core ws2_32 iphlpapi)
-ENDIF(WIN32)
+oonf_create_library("core" "${OONF_CORE_SRCS}" "${OONF_CORE_INCLUDES}" "rt")
index 19cf0d8..9f08f3d 100644 (file)
@@ -87,7 +87,7 @@ static struct cfg_schema_entry global_entries[] = {
   CFG_MAP_BOOL(olsr_config_global, ipv6, "ipv6", "yes",
       "Set to true to enable ipv6 support in program."),
 
-  CFG_MAP_STRINGLIST(olsr_config_global, plugin, "plugin", "",
+  CFG_MAP_STRINGLIST(olsr_config_global, plugin, CFG_GLOBAL_PLUGIN, "",
       "Set list of plugins to be loaded by daemon. Some might need configuration options."),
 };
 
index 64cd914..b5f8486 100644 (file)
@@ -59,6 +59,7 @@ struct olsr_config_global {
 
 /* section types for configuration */
 #define CFG_SECTION_GLOBAL   "global"
+#define CFG_GLOBAL_PLUGIN    "plugin"
 
 EXPORT extern struct olsr_config_global config_global;
 
index d33d2fe..31c6c33 100644 (file)
@@ -45,9 +45,9 @@
 
 #include "config/cfg_schema.h"
 
-#include "builddata/data.h"
 #include "olsr.h"
 #include "olsr_cfg.h"
+#include "olsr_libdata.h"
 #include "olsr_logging.h"
 #include "olsr_netaddr_acl.h"
 #include "olsr_stream_socket.h"
@@ -416,7 +416,7 @@ _create_http_error(struct olsr_stream_session *session,
     enum olsr_http_result error) {
   abuf_appendf(&session->out, "<html><head><title>%s %s http server</title></head>"
       "<body><h1>HTTP error %d: %s</h1></body></html>",
-      olsr_log_get_builddata()->app_name, olsr_log_get_builddata()->version,
+      olsr_log_get_appdata()->app_name, olsr_log_get_appdata()->app_version,
       error, _get_headertype_string(error));
   _create_http_header(session, error, NULL);
 }
@@ -513,9 +513,9 @@ _create_http_header(struct olsr_stream_session *session,
 
   /* Server version */
   abuf_appendf(&buf, "Server: %s %s %s\r\n",
-      olsr_log_get_builddata()->version,
-      olsr_log_get_builddata()->builddate,
-      olsr_log_get_builddata()->buildsystem);
+      olsr_log_get_appdata()->app_version,
+      olsr_log_get_appdata()->builddate,
+      olsr_log_get_appdata()->buildsystem);
 
   /* connection-type */
   abuf_puts(&buf, "Connection: closed\r\n");
similarity index 80%
rename from src-api/builddata/plugin_static.h
rename to src-api/core/olsr_libdata.c.in
index 6844135..900027b 100644 (file)
  *
  */
 
-#ifndef PLUGIN_STATIC_H_
-#define PLUGIN_STATIC_H_
+#include "olsr_libdata.h"
 
-#include "common/common_types.h"
+static struct olsr_libdata _libdata = {
+  .lib_version = "${OONF_VERSION}",
+  
+  .git_commit = "${OONF_LIB_GIT}",
+  .git_change = "${OONF_LIB_CHANGE}",
+  
+  .builddate = __DATE__" "__TIME__,
+  .buildsystem = "${CMAKE_SYSTEM}",
+  
+  .sharedlibrary_prefix = "${CMAKE_SHARED_LIBRARY_PREFIX}oonf_",
+  .sharedlibrary_postfix = "${CMAKE_SHARED_LIBRARY_SUFFIX}",
+};
 
-/* Prototype for automatically generated function */
-EXPORT void olsr_plugins_load_static(void);
-
-#endif /* PLUGIN_STATIC_H_ */
+const struct olsr_libdata *
+olsr_libdata_get(void) {
+  return &_libdata;
+}
similarity index 89%
rename from src-api/builddata/data.h
rename to src-api/core/olsr_libdata.h
index 1341384..cad7a42 100644 (file)
 
 #include "common/common_types.h"
 
-struct olsr_builddata {
-  const char *app_name;
-  const char *version;
-  const char *versionstring_trailer;
-  const char *help_prefix;
-  const char *help_suffix;
-
-  const char *default_config;
+struct olsr_libdata {
+  const char *lib_version;
 
   const char *git_commit;
   const char *git_change;
@@ -63,6 +57,6 @@ struct olsr_builddata {
   const char *sharedlibrary_postfix;
 };
 
-EXPORT extern const struct olsr_builddata *olsr_builddata_get(void);
+EXPORT extern const struct olsr_libdata *olsr_libdata_get(void);
 
 #endif /* BUILDDATA_H_ */
index 7ce3f18..a041a17 100644 (file)
 #include "common/autobuf.h"
 #include "common/list.h"
 #include "common/string.h"
-#include "builddata/data.h"
-#include "os_system.h"
-#include "os_syslog.h"
+#include "olsr_libdata.h"
 #include "olsr_logging.h"
 #include "olsr.h"
+#include "os_system.h"
+#include "os_syslog.h"
 
 #define FOR_ALL_LOGHANDLERS(handler, iterator) list_for_each_element_safe(&_handler_list, handler, node, iterator)
 
@@ -61,7 +61,8 @@ uint8_t log_global_mask[LOG_MAXIMUM_SOURCES];
 
 static struct list_entity _handler_list;
 static struct autobuf _logbuffer;
-static const struct olsr_builddata *_builddata;
+static const struct olsr_appdata *_appdata;
+static const struct olsr_libdata *_libdata;
 static uint8_t _default_mask;
 static size_t _max_sourcetext_len, _max_severitytext_len, _source_count;
 
@@ -102,7 +103,7 @@ OLSR_SUBSYSTEM_STATE(_logging_state);
  * @return -1 if an error happened, 0 otherwise
  */
 int
-olsr_log_init(const struct olsr_builddata *data, enum log_severity def_severity)
+olsr_log_init(const struct olsr_appdata *data, enum log_severity def_severity)
 {
   enum log_severity sev;
   enum log_source src;
@@ -111,7 +112,8 @@ olsr_log_init(const struct olsr_builddata *data, enum log_severity def_severity)
   if (olsr_subsystem_is_initialized(&_logging_state))
     return 0;
 
-  _builddata = data;
+  _appdata = data;
+  _libdata = olsr_libdata_get();
   _source_count = LOG_CORESOURCE_COUNT;
 
   list_init_head(&_handler_list);
@@ -262,11 +264,19 @@ olsr_log_get_sourcecount(void) {
 }
 
 /**
- * @return pointer to application builddata
+ * @return pointer to application data
+ */
+const struct olsr_appdata *
+olsr_log_get_appdata(void) {
+  return _appdata;
+}
+
+/**
+ * @return pointer to library data
  */
-const struct olsr_builddata *
-olsr_log_get_builddata(void) {
-  return _builddata;
+const struct olsr_libdata *
+olsr_log_get_libdata(void) {
+  return _libdata;
 }
 
 /**
@@ -277,13 +287,19 @@ void
 olsr_log_printversion(struct autobuf *abuf) {
   abuf_appendf(abuf," %s version %s (%s)\n"
             " Built on %s\n"
-            " Git: %s\n"
-            "      %s\n"
-            "%s",
-            _builddata->app_name, _builddata->version,
-            _builddata->builddate, _builddata->buildsystem,
-            _builddata->git_commit, _builddata->git_change,
-            _builddata->versionstring_trailer);
+            " Application commit: %s\n",
+            _appdata->app_name,
+            _appdata->app_version,
+            _appdata->builddate, _appdata->buildsystem,
+            _appdata->git_commit);
+  if (_appdata->git_change[0]) {
+    abuf_appendf(abuf, "      %s\n", _appdata->git_change);
+  }
+  abuf_appendf(abuf, " Library commit: %s\n", _libdata->git_commit);
+  if (_libdata->git_change[0]) {
+    abuf_appendf(abuf, "      %s\n", _libdata->git_change);
+  }
+  abuf_puts(abuf, _appdata->versionstring_trailer);
 }
 
 /**
index 7f8d99c..d92f1d7 100644 (file)
@@ -49,7 +49,7 @@ struct log_handler_entry;
 #include "common/common_types.h"
 #include "common/autobuf.h"
 #include "common/list.h"
-#include "builddata/data.h"
+#include "olsr_libdata.h"
 
 /**
  * defines the severity of a logging event
@@ -100,6 +100,25 @@ struct log_parameters {
   int prefixLength;
 };
 
+struct olsr_appdata {
+  const char *app_name;
+  const char *app_version;
+  const char *versionstring_trailer;
+  const char *help_prefix;
+  const char *help_suffix;
+
+  const char *default_config;
+
+  const char *git_commit;
+  const char *git_change;
+
+  const char *builddate;
+  const char *buildsystem;
+
+  const char *sharedlibrary_prefix;
+  const char *sharedlibrary_postfix;
+};
+
 /**
  * these macros should be used to generate OLSR logging output
  * the OLSR_severity_NH() variants don't print the timestamp/file/line header,
@@ -118,7 +137,7 @@ struct log_parameters {
 
 #define _OLSR_LOG(severity, source, no_header, format, args...) do { if (olsr_log_mask_test(log_global_mask, source, severity)) olsr_log(severity, source, no_header, __FILE__, __LINE__, format, ##args); } while(0)
 
-#ifdef REMOVE_LOG_DEBUG
+#if MAX_LOGGING_LEVEL < 1
 #define OLSR_DEBUG(source, format, args...) do { } while(0)
 #define OLSR_DEBUG_NH(source, format, args...) do { } while(0)
 #else
@@ -126,7 +145,7 @@ struct log_parameters {
 #define OLSR_DEBUG_NH(source, format, args...) _OLSR_LOG(LOG_SEVERITY_DEBUG, source, true, format, ##args)
 #endif
 
-#ifdef REMOVE_LOG_INFO
+#if MAX_LOGGING_LEVEL < 2
 #define OLSR_INFO(source, format, args...) do { } while(0)
 #define OLSR_INFO_NH(source, format, args...) do { } while(0)
 #else
@@ -134,7 +153,7 @@ struct log_parameters {
 #define OLSR_INFO_NH(source, format, args...) _OLSR_LOG(LOG_SEVERITY_INFO, source, true, format, ##args)
 #endif
 
-#ifdef REMOVE_LOG_WARN
+#if MAX_LOGGING_LEVEL < 3
 #define OLSR_WARN(source, format, args...) do { } while(0)
 #define OLSR_WARN_NH(source, format, args...) do { } while(0)
 #else
@@ -164,7 +183,7 @@ EXPORT extern uint8_t log_global_mask[LOG_MAXIMUM_SOURCES];
 EXPORT extern const char *LOG_SOURCE_NAMES[LOG_MAXIMUM_SOURCES];
 EXPORT extern const char *LOG_SEVERITY_NAMES[LOG_SEVERITY_MAX+1];
 
-EXPORT int olsr_log_init(const struct olsr_builddata *, enum log_severity)
+EXPORT int olsr_log_init(const struct olsr_appdata *, enum log_severity)
   __attribute__((warn_unused_result));
 EXPORT void olsr_log_cleanup(void);
 
@@ -179,7 +198,8 @@ EXPORT void olsr_log_unregister_source(int index);
 
 EXPORT void olsr_log_updatemask(void);
 
-EXPORT const struct olsr_builddata *olsr_log_get_builddata(void);
+EXPORT const struct olsr_appdata *olsr_log_get_appdata(void);
+EXPORT const struct olsr_libdata *olsr_log_get_libdata(void);
 EXPORT void olsr_log_printversion(struct autobuf *abuf);
 
 EXPORT const char *olsr_log_get_walltime(void);
index e240532..d585cb0 100644 (file)
@@ -51,9 +51,7 @@
 #include "common/avl_comp.h"
 #include "common/template.h"
 
-#include "builddata/data.h"
-#include "builddata/plugin_static.h"
-
+#include "olsr_libdata.h"
 #include "olsr_logging.h"
 #include "olsr_plugins.h"
 #include "olsr.h"
@@ -63,15 +61,22 @@ enum {
   IDX_DLOPEN_LIB,
   IDX_DLOPEN_PATH,
   IDX_DLOPEN_PRE,
+  IDX_DLOPEN_PRELIB,
   IDX_DLOPEN_POST,
+  IDX_DLOPEN_POSTLIB,
   IDX_DLOPEN_VER,
+  IDX_DLOPEN_VERLIB,
 };
 
 static const char *dlopen_patterns[] = {
   "%PATH%/%PRE%%LIB%%POST%.%VER%",
+  "%PATH%/%PRELIB%%LIB%%POSTLIB%.%VERLIB%",
   "%PATH%/%PRE%%LIB%%POST%",
+  "%PATH%/%PRELIB%%LIB%%POSTLIB%",
   "%PRE%%LIB%%POST%.%VER%",
+  "%PRELIB%%LIB%%POSTLIB%.%VERLIB%",
   "%PRE%%LIB%%POST%",
+  "%PRELIB%%LIB%%POSTLIB%",
 };
 
 /* Local functions */
@@ -80,11 +85,14 @@ static bool plugin_tree_initialized = false;
 
 /* library loading patterns */
 static struct abuf_template_data _dlopen_data[] = {
-  [IDX_DLOPEN_LIB]  =  { .key = "LIB" },
-  [IDX_DLOPEN_PATH] =  { .key = "PATH", .value = "." },
-  [IDX_DLOPEN_PRE]  =  { .key = "PRE" },
-  [IDX_DLOPEN_POST] =  { .key = "POST" },
-  [IDX_DLOPEN_VER]  =  { .key = "VER" },
+  [IDX_DLOPEN_LIB]     =  { .key = "LIB" },
+  [IDX_DLOPEN_PATH]    =  { .key = "PATH", .value = "." },
+  [IDX_DLOPEN_PRE]     =  { .key = "PRE" },
+  [IDX_DLOPEN_PRELIB]  =  { .key = "PRELIB" },
+  [IDX_DLOPEN_POST]    =  { .key = "POST" },
+  [IDX_DLOPEN_POSTLIB] =  { .key = "POSTLIB" },
+  [IDX_DLOPEN_VER]     =  { .key = "VER" },
+  [IDX_DLOPEN_VERLIB]  =  { .key = "VERLIB" },
 };
 
 static void _init_plugin_tree(void);
@@ -106,11 +114,13 @@ olsr_plugins_init(void) {
 
   /* load predefined values for dlopen templates */
   _dlopen_data[IDX_DLOPEN_PRE].value =
-      olsr_log_get_builddata()->sharedlibrary_prefix;
+      olsr_log_get_appdata()->sharedlibrary_prefix;
   _dlopen_data[IDX_DLOPEN_POST].value =
-      olsr_log_get_builddata()->sharedlibrary_postfix;
+      olsr_log_get_appdata()->sharedlibrary_postfix;
   _dlopen_data[IDX_DLOPEN_VER].value =
-      olsr_log_get_builddata()->version;
+      olsr_log_get_appdata()->app_version;
+
+  // TODO: add library data
 }
 
 /**
@@ -161,8 +171,6 @@ olsr_plugins_init_static(void) {
   struct olsr_plugin *p, *it;
   int error = 0;
 
-  assert(!avl_is_empty(&plugin_tree));
-
   OLSR_FOR_ALL_PLUGIN_ENTRIES(p, it) {
     if (olsr_plugins_load(p->name) == NULL) {
       OLSR_WARN(LOG_PLUGINLOADER, "Cannot load plugin '%s'", p->name);
index 93487f8..ae32f13 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <syslog.h>
 
-#include "builddata/data.h"
+#include "olsr_libdata.h"
 #include "olsr_logging.h"
 #include "os_syslog.h"
 #include "olsr.h"
@@ -57,7 +57,7 @@ os_syslog_init(void) {
     return;
   }
 
-  openlog(olsr_log_get_builddata()->app_name, LOG_PID | LOG_ODELAY, LOG_DAEMON);
+  openlog(olsr_log_get_appdata()->app_name, LOG_PID | LOG_ODELAY, LOG_DAEMON);
   setlogmask(LOG_UPTO(LOG_DEBUG));
 
   return;
index d4600a9..1a18276 100644 (file)
@@ -1,23 +1,22 @@
 # prepare packetbb API configuration
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/pbb_api_config.h.in ${CMAKE_BINARY_DIR}/packetbb/pbb_api_config.h)
 
-SET(OLSRD_PACKETBB_SRCS pbb_context.c
-                        pbb_msg_generator.c
-                        pbb_pkt_generator.c
-                        pbb_reader.c
-                        pbb_tlv_writer.c
-                        pbb_writer.c
-                        pbb_conversion.c
-                        pbb_iana.c
-                        pbb_print.c)
+SET(OONF_PACKETBB_SRCS pbb_context.c
+                       pbb_msg_generator.c
+                       pbb_pkt_generator.c
+                       pbb_reader.c
+                       pbb_tlv_writer.c
+                       pbb_writer.c
+                       pbb_conversion.c
+                       pbb_iana.c
+                       pbb_print.c)
 
-ADD_LIBRARY(static_packetbb STATIC ${OLSRD_PACKETBB_SRCS})
-ADD_LIBRARY(${OONF_LIBPREFIX}_packetbb SHARED ${OLSRD_PACKETBB_SRCS})
+SET(OONF_PACKETBB_INCLUDES pbb_context.h
+                           pbb_reader.h
+                           pbb_tlv_writer.h
+                           pbb_writer.h
+                           pbb_conversion.h
+                           pbb_iana.h
+                           pbb_print.h)
 
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(static_packetbb static_common)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_packetbb ${OONF_LIBPREFIX}_common)
-
-    TARGET_LINK_LIBRARIES(static_packetbb ws2_32 iphlpapi)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_packetbb ws2_32 iphlpapi)
-ENDIF(WIN32)
+oonf_create_library("packetbb" "${OONF_PACKETBB_SRCS}" "${OONF_PACKETBB_INCLUDES}" false)
diff --git a/src-api/regex/CMakeLists.txt b/src-api/regex/CMakeLists.txt
deleted file mode 100644 (file)
index ca3a129..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-SET(OONF_REGEX_SRCS regcomp.c
-                    regerror.c
-                    regexec.c
-                    regfree.c)
-
-ADD_LIBRARY(static_regex ${OONF_REGEX_SRCS})
-ADD_LIBRARY(${OONF_LIBPREFIX}_regex SHARED ${OONF_REGEX_SRCS})
-
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(static_regex static_common)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_regex ${OONF_LIBPREFIX}_common)
-
-    TARGET_LINK_LIBRARIES(static_regex ws2_32 iphlpapi)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_regex ws2_32 iphlpapi)
-ENDIF(WIN32)
diff --git a/src-plugins/CMake.plugin b/src-plugins/CMake.plugin
deleted file mode 100644 (file)
index 81698c8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# generic plugin cmake-file
-ADD_DEFINITIONS(-DPLUGIN_FULLNAME=${libname})
-
-ADD_LIBRARY(static_${libname} STATIC ${source})
-ADD_LIBRARY(${OONF_LIBPREFIX}_${libname} SHARED ${source})
-
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_${libname} ws2_32 iphlpapi)
-ENDIF(WIN32)
-
-SET_TARGET_PROPERTIES(${OONF_LIBPREFIX}_${libname} PROPERTIES SOVERSION ${OONF_VERSION})
-
-IF (linkto)
-  TARGET_LINK_LIBRARIES(${OONF_LIBPREFIX}_${libname} ${linkto})
-  TARGET_LINK_LIBRARIES(static_${libname} ${linkto})
-ENDIF (linkto)
-
-UNSET(source)
-UNSET(libname)
-UNSET(linkto)
index 090f01c..98ea385 100644 (file)
@@ -1,6 +1,5 @@
-# set library name
-SET (libname "cfgio_file")
-SET (source "${CMAKE_CURRENT_SOURCE_DIR}/src/cfgio_file.c")
+# set library parameters
+SET (source "src/cfgio_file.c")
 
-# use generic plugin cmake file
-include (../CMake.plugin)
+# use generic plugin maker
+oonf_create_plugin("cfgio_file" ${source} false false)
index d089ce4..022c0ad 100644 (file)
@@ -1,6 +1,7 @@
-# set library name
-SET (libname "cfgparser_compact")
-SET (source "${CMAKE_CURRENT_SOURCE_DIR}/src/cfgparser_compact.c")
+# set library parameters
+SET (source "src/cfgparser_compact.c")
+SET (include false)
+SET (linkto false)
 
-# use generic plugin cmake file
-include (../CMake.plugin)
+# use generic plugin maker
+oonf_create_plugin("cfgparser_compact" ${source} false false)
index 660878b..3d63a27 100644 (file)
@@ -1,6 +1,5 @@
-# set library name
-SET (libname "httptelnet")
-SET (source "${CMAKE_CURRENT_SOURCE_DIR}/src/httptelnet.c")
+# set library parameters
+SET (source "src/httptelnet.c")
 
-# use generic plugin cmake file
-include (../CMake.plugin)
+# use generic plugin maker
+oonf_create_plugin("httptelnet" ${source} false false)
index 3078462..7711507 100644 (file)
@@ -1,6 +1,5 @@
-# set library name
-SET (libname "remotecontrol")
-SET (source "${CMAKE_CURRENT_SOURCE_DIR}/src/remotecontrol.c")
+# set library parameters
+SET (source "src/remotecontrol.c")
 
-# use generic plugin cmake file
-include (../CMake.plugin)
+# use generic plugin maker
+oonf_create_plugin("remotecontrol" ${source} false false)
diff --git a/src/CMake.link_dynamic b/src/CMake.link_dynamic
deleted file mode 100644 (file)
index 31fe00e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# link plugin loader
-TARGET_LINK_LIBRARIES(${OONF_EXE} static_pluginloader)
-
-# link static plugins
-FOREACH(plugin ${OONF_STATIC_PLUGINS})
-    TARGET_LINK_LIBRARIES(${OONF_EXE} static_${plugin})
-ENDFOREACH(plugin)
-
-# link core
-TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_core)
-
-# link packetbb if necessary
-IF(OONF_NEED_PACKETBB)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_packetbb)
-ENDIF(OONF_NEED_PACKETBB)
-
-# link config and common API
-TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_config)
-TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_common)
-
-# link builddata
-TARGET_LINK_LIBRARIES(${OONF_EXE} static_builddata)
-
-# link dlopen() library
-TARGET_LINK_LIBRARIES(${OONF_EXE} ${CMAKE_DL_LIBS})
-
-# link extra win32 libs
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_regex)
-
-    SET_TARGET_PROPERTIES(${OONF_EXE} PROPERTIES ENABLE_EXPORTS true)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} ws2_32 iphlpapi)
-ENDIF(WIN32)
diff --git a/src/CMake.link_static b/src/CMake.link_static
deleted file mode 100644 (file)
index 7e9f14f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# the order of static libraries is important
-# earlier libraries can use the functions of later, not the
-# other way around
-
-# link plugin loader
-TARGET_LINK_LIBRARIES(${OONF_EXE} static_pluginloader)
-
-# link static plugins
-FOREACH(plugin ${OONF_STATIC_PLUGINS})
-    TARGET_LINK_LIBRARIES(${OONF_EXE} static_${plugin})
-ENDFOREACH(plugin)
-
-
-
-# link core
-TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_core -Wl,-no-whole-archive)
-
-# link packetbb if necessary
-IF(OONF_NEED_PACKETBB)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_packetbb -Wl,-no-whole-archive)
-ENDIF(OONF_NEED_PACKETBB)
-
-# link config and common API
-TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_config -Wl,-no-whole-archive)
-TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_common -Wl,-no-whole-archive)
-
-# link builddata
-TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_builddata -Wl,-no-whole-archive)
-
-# link dlopen() library
-TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive ${CMAKE_DL_LIBS} -Wl,-no-whole-archive)
-
-# link extra win32 libs
-IF(WIN32)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,-whole-archive static_regex -Wl,-no-whole-archive)
-
-    SET_TARGET_PROPERTIES(${OONF_EXE} PROPERTIES ENABLE_EXPORTS true)
-    TARGET_LINK_LIBRARIES(${OONF_EXE} ws2_32 iphlpapi)
-ENDIF(WIN32)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
deleted file mode 100644 (file)
index 596615e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# add main program
-set(OONF_SRCS olsr_main.c 
-              olsr_setup.c
-              )
-
-# create executable
-ADD_EXECUTABLE(${OONF_EXE} ${OONF_SRCS})
-
-# add path to install target
-INSTALL (TARGETS ${OONF_EXE} DESTINATION bin)
-
-# link framework libraries (choose one)
-IF (OONF_FRAMEWORD_DYNAMIC)
-    include(CMake.link_dynamic)
-ELSE (OONF_FRAMEWORD_DYNAMIC)
-    include(CMake.link_static)
-endif(OONF_FRAMEWORD_DYNAMIC)
diff --git a/src/olsr_main.c b/src/olsr_main.c
deleted file mode 100644 (file)
index 182b06b..0000000
+++ /dev/null
@@ -1,626 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#include <sys/types.h>
-#include <sys/times.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/socket.h>
-#include <net/if.h>
-
-#include "common/daemonize.h"
-#include "common/list.h"
-#include "config/cfg_cmd.h"
-#include "config/cfg_db.h"
-#include "config/cfg_schema.h"
-#include "builddata/plugin_static.h"
-#include "builddata/data.h"
-#include "builddata/app_config.h"
-#include "os_clock.h"
-#include "os_net.h"
-#include "os_system.h"
-#include "os_syslog.h"
-#include "olsr_callbacks.h"
-#include "olsr_cfg.h"
-#include "olsr_clock.h"
-#include "olsr_http.h"
-#include "olsr_interface.h"
-#include "olsr_logging.h"
-#include "olsr_logging_cfg.h"
-#include "olsr_memcookie.h"
-#include "olsr_packet_socket.h"
-#include "olsr_plugins.h"
-#include "olsr_socket.h"
-#include "olsr_stream_socket.h"
-#include "olsr_telnet.h"
-#include "olsr_timer.h"
-#include "olsr_setup.h"
-#include "olsr.h"
-
-#if OONF_NEED_ROUTING == true
-#include "os_routing.h"
-#endif
-
-static bool _end_olsr_signal, _display_schema;
-static char *_schema_name;
-
-enum argv_short_options {
-  argv_option_schema = 256,
-};
-
-static struct option olsr_options[] = {
-#if !defined(REMOVE_HELPTEXT)
-  { "help",         no_argument,       0, 'h' },
-#endif
-  { "version",      no_argument,       0, 'v' },
-  { "plugin",       required_argument, 0, 'p' },
-  { "load",         required_argument, 0, 'l' },
-  { "save",         required_argument, 0, 'S' },
-  { "set",          required_argument, 0, 's' },
-  { "remove",       required_argument, 0, 'r' },
-  { "get",          optional_argument, 0, 'g' },
-  { "format",       required_argument, 0, 'f' },
-  { "quit",         no_argument,       0, 'q' },
-  { "schema",       optional_argument, 0, argv_option_schema },
-  { NULL, 0,0,0 }
-};
-
-#if !defined(REMOVE_HELPTEXT)
-static const char *help_text =
-    "Mandatory arguments to long options are mandatory for short options too.\n"
-    "  -h, --help                             Display this help file\n"
-    "  -v, --version                          Display the version string and the included static plugins\n"
-    "  -p, --plugin=shared-library            Load a shared library as a plugin\n"
-    "      --quit                             Load plugins and validate configuration, then end\n"
-    "      --schema                           Display all allowed section types of configuration\n"
-    "              =section_type              Display all allowed entries of one configuration section\n"
-    "              =section_type.key          Display help text for configuration entry\n"
-    "  -l, --load=SOURCE                      Load configuration from a SOURCE\n"
-    "  -S, --save=TARGET                      Save configuration to a TARGET\n"
-    "  -s, --set=section_type.                Add an unnamed section to the configuration\n"
-    "           =section_type.key=value       Add a key/value pair to an unnamed section\n"
-    "           =section_type[name].          Add a named section to the configuration\n"
-    "           =section_type[name].key=value Add a key/value pair to a named section\n"
-    "  -r, --remove=section_type.             Remove all sections of a certain type\n"
-    "              =section_type.key          Remove a key in an unnamed section\n"
-    "              =section_type[name].       Remove a named section\n"
-    "              =section_type[name].key    Remove a key in a named section\n"
-    "  -g, --get                              Show all section types in database\n"
-    "           =section_type.                Show all named sections of a certain type\n"
-    "           =section_type.key             Show the value(s) of a key in an unnamed section\n"
-    "           =section_type[name].key       Show the value(s) of a key in a named section\n"
-    "  -f, --format=FORMAT                    Set the format for loading/saving data\n"
-    "                                         (use 'AUTO' for automatic detection of format)\n"
-;
-#endif
-
-/* prototype for local statics */
-static void quit_signal_handler(int);
-static void hup_signal_handler(int);
-static void setup_signalhandler(void);
-static int mainloop(int argc, char **argv);
-static int parse_commandline(int argc, char **argv, bool reload_only);
-static int display_schema(void);
-
-/**
- * Main program
- */
-int
-main(int argc, char **argv) {
-  int return_code;
-  int fork_pipe;
-
-  /* early initialization */
-  return_code = 1;
-  fork_pipe = -1;
-  _schema_name = NULL;
-  _display_schema = false;
-
-  srand(times(NULL));
-
-  /* setup signal handler */
-  _end_olsr_signal = false;
-  setup_signalhandler();
-
-  /* initialize logger */
-  if (olsr_log_init(olsr_builddata_get(), LOG_SEVERITY_WARN)) {
-    goto olsrd_cleanup;
-  }
-
-  /* add configuration definition */
-  if (olsr_cfg_init()) {
-    goto olsrd_cleanup;
-  }
-
-  /* add custom configuration definitions */
-  olsr_logcfg_init(olsr_setup_get_level1_logs(), olsr_setup_get_level1count());
-
-  /* prepare plugin initialization */
-  olsr_plugins_init();
-
-  /* load static plugins */
-  olsr_plugins_load_static();
-  if (olsr_plugins_init_static()) {
-    goto olsrd_cleanup;
-  }
-
-  /* parse command line and read configuration files */
-  return_code = parse_commandline(argc, argv, false);
-  if (return_code != -1) {
-    /* end OLSRd now */
-    goto olsrd_cleanup;
-  }
-
-  /* preload plugins to show their schemas */
-  if (olsr_cfg_loadplugins()) {
-    goto olsrd_cleanup;
-  }
-
-  /* prepare for an error during initialization */
-  return_code = 1;
-
-  /* read global section early */
-  if (olsr_cfg_update_globalcfg(true)) {
-    OLSR_WARN(LOG_MAIN, "Cannot read global configuration section");
-    goto olsrd_cleanup;
-  }
-
-  /* check if we are root, otherwise stop */
-#if OONF_NEED_ROOT == true
-  if (geteuid() != 0) {
-    OLSR_WARN(LOG_MAIN, "You must be root(uid = 0) to run %s!\n",
-        olsr_builddata_get()->app_name);
-    goto olsrd_cleanup;
-  }
-#endif
-
-  /* see if we need to fork */
-  if (config_global.fork) {
-    /* fork into background */
-    fork_pipe = daemonize_prepare();
-    if (fork_pipe == -1) {
-      OLSR_WARN(LOG_MAIN, "Cannot fork into background");
-      goto olsrd_cleanup;
-    }
-  }
-
-  /* configure logger */
-  if (olsr_logcfg_apply(olsr_cfg_get_rawdb())) {
-    goto olsrd_cleanup;
-  }
-
-  /* initialize basic framework */
-  os_syslog_init();
-  olsr_memcookie_init();
-  if (os_clock_init()) {
-    goto olsrd_cleanup;
-  }
-  if (olsr_clock_init()) {
-    goto olsrd_cleanup;
-  }
-  olsr_callback_init();
-  olsr_timer_init();
-  olsr_socket_init();
-  olsr_packet_init();
-  olsr_stream_init();
-
-  /* activate os-specific code */
-  if (os_system_init()) {
-    goto olsrd_cleanup;
-  }
-
-#if OONF_NEED_ROUTING == true
-  if (os_routing_init()) {
-    goto olsrd_cleanup;
-  }
-#endif
-
-  if (os_net_init()) {
-    goto olsrd_cleanup;
-  }
-
-  /* activate interface listening system */
-  if (olsr_interface_init()) {
-    goto olsrd_cleanup;
-  }
-
-  /* activate telnet and http */
-  olsr_telnet_init();
-  olsr_http_init();
-
-  /* activate custom additions to framework */
-  if (olsr_setup_init()) {
-    goto olsrd_cleanup;
-  }
-
-  /* show schema if necessary */
-  if (_display_schema) {
-    return_code = display_schema();
-    goto olsrd_cleanup;
-  }
-
-  /* apply configuration */
-  if (olsr_cfg_apply()) {
-    goto olsrd_cleanup;
-  }
-
-  if (!olsr_is_running()) {
-    /*
-     * mayor error during late initialization
-     * or maybe the user decided otherwise and pressed CTRL-C
-     */
-    return_code = _end_olsr_signal ? 0 : 1;
-    goto olsrd_cleanup;
-  }
-
-  if (fork_pipe != -1) {
-    /* tell main process that we are finished with initialization */
-    daemonize_finish(fork_pipe, 0);
-    fork_pipe = -1;
-  }
-
-  /* activate mainloop */
-  return_code = mainloop(argc, argv);
-
-olsrd_cleanup:
-  /* free plugins */
-  olsr_plugins_cleanup();
-
-  /* free custom framework additions */
-  olsr_setup_cleanup();
-
-  /* free framework resources */
-  olsr_http_cleanup();
-  olsr_telnet_cleanup();
-  olsr_interface_cleanup();
-  os_net_cleanup();
-#if OONF_NEED_ROUTING
-  os_routing_cleanup();
-#endif
-  os_system_cleanup();
-  olsr_stream_cleanup();
-  olsr_packet_cleanup();
-  olsr_socket_cleanup();
-  olsr_timer_cleanup();
-  olsr_callback_cleanup();
-  olsr_clock_cleanup();
-  os_clock_cleanup();
-  olsr_memcookie_cleanup();
-  os_syslog_cleanup();
-  olsr_logcfg_cleanup();
-
-  /* free configuration resources */
-  olsr_cfg_cleanup();
-
-  /* free logger resources */
-  olsr_log_cleanup();
-
-  if (fork_pipe != -1) {
-    /* tell main process that we had a problem */
-    daemonize_finish(fork_pipe, return_code);
-  }
-
-  return return_code;
-}
-
-/**
- * Handle incoming SIGINT signal
- * @param signo
- */
-static void
-quit_signal_handler(int signo __attribute__ ((unused))) {
-  olsr_exit();
-}
-
-/**
- * Handle incoming SIGHUP signal
- * @param signo
- */
-static void
-hup_signal_handler(int signo __attribute__ ((unused))) {
-  olsr_cfg_trigger_reload();
-}
-
-/**
- * Mainloop of olsrd
- * @return exit code for olsrd
- */
-static int
-mainloop(int argc, char **argv) {
-  uint64_t next_interval;
-  int exit_code = 0;
-
-  OLSR_INFO(LOG_MAIN, "Starting %s.", olsr_log_get_builddata()->app_name);
-
-  /* enter main loop */
-  while (olsr_is_running()) {
-    /*
-     * Update the global timestamp. We are using a non-wallclock timer here
-     * to avoid any undesired side effects if the system clock changes.
-     */
-    if (olsr_clock_update()) {
-      exit_code = 1;
-      break;
-    }
-
-    /* Read incoming data and handle it immediately */
-    if (olsr_socket_handle(0)) {
-      exit_code = 1;
-      break;
-    }
-
-    /* reload configuration if triggered */
-    if (olsr_cfg_is_reload_set()) {
-      OLSR_INFO(LOG_MAIN, "Reloading configuration");
-      if (olsr_cfg_clear_rawdb()) {
-        break;
-      }
-      if (parse_commandline(argc, argv, true) == -1) {
-        if (olsr_cfg_apply()) {
-          break;
-        }
-      }
-    }
-
-    /* commit config if triggered */
-    if (olsr_cfg_is_commit_set()) {
-      OLSR_INFO(LOG_MAIN, "Commiting configuration");
-      if (olsr_cfg_apply()) {
-        break;
-      }
-    }
-  }
-
-  /* wait for 500 milliseconds and process socket events */
-  next_interval = olsr_clock_get_absolute(500);
-  if (olsr_socket_handle(next_interval)) {
-    exit_code = 1;
-  }
-
-  OLSR_INFO(LOG_MAIN, "Ending %s.", olsr_log_get_builddata()->app_name);
-  return exit_code;
-}
-
-/**
- * Setup signal handling for olsrd
- */
-static void
-setup_signalhandler(void) {
-  static struct sigaction act;
-
-  memset(&act, 0, sizeof(act));
-
-  /* setup signal handler first */
-  sigemptyset(&act.sa_mask);
-  act.sa_flags = 0;
-
-  act.sa_handler = quit_signal_handler;
-  sigaction(SIGINT, &act, NULL);
-  sigaction(SIGQUIT, &act, NULL);
-  sigaction(SIGILL, &act, NULL);
-  sigaction(SIGABRT, &act, NULL);
-  sigaction(SIGTERM, &act, NULL);
-
-  act.sa_handler = SIG_IGN;
-  sigaction(SIGPIPE, &act, NULL);
-  sigaction(SIGUSR1, &act, NULL);
-  sigaction(SIGUSR2, &act, NULL);
-
-  act.sa_handler = hup_signal_handler;
-  sigaction(SIGHUP, &act, NULL);
-}
-
-/**
- * Parse command line of olsrd
- * @param argc number of arguments
- * @param argv argument vector
- * @param def_config default configuration file, NULL if
- *   no default config file should be loaded
- * @param reload_only true if only the command line arguments should
- *   be parsed that load a configuration (--set, --remove, --load,
- *   and --format), false for normal full parsing.
- * @return -1 if olsrd should start normally, otherwise olsrd should
- *   exit with the returned number
- */
-static int
-parse_commandline(int argc, char **argv, bool reload_only) {
-  const char *parameters;
-  struct olsr_plugin *plugin, *plugin_it;
-  struct autobuf log;
-  struct cfg_db *db;
-  int opt, opt_idx, return_code;
-  bool loaded_file;
-
-  return_code = -1;
-  loaded_file = false;
-  db = olsr_cfg_get_rawdb();
-
-  /* reset getopt_long */
-  opt_idx = -1;
-  optind = 1;
-
-  abuf_init(&log);
-  cfg_cmd_clear_state(olsr_cfg_get_instance());
-
-  if (reload_only) {
-    /* only parameters that load and change configuration data */
-    parameters = "l:s:r:f:";
-  }
-  else {
-    parameters = "hvp:ql:S:s:r:g::f:";
-  }
-  while (return_code == -1
-      && 0 <= (opt = getopt_long(argc, argv, parameters, olsr_options, &opt_idx))) {
-    switch (opt) {
-      case 'h':
-#if !defined(REMOVE_HELPTEXT)
-        abuf_appendf(&log, "Usage: %s [OPTION]...\n%s%s%s", argv[0],
-            olsr_builddata_get()->help_prefix,
-            help_text,
-            olsr_builddata_get()->help_suffix);
-#endif
-        return_code = 0;
-        break;
-
-      case 'v':
-        olsr_log_printversion(&log);
-        OLSR_FOR_ALL_PLUGIN_ENTRIES(plugin, plugin_it) {
-          abuf_appendf(&log, " Static plugin: %s\n", plugin->name);
-        }
-        return_code = 0;
-        break;
-      case 'p':
-        if (olsr_plugins_load(optarg) == NULL) {
-          return_code = 1;
-        }
-        break;
-      case 'q':
-        olsr_exit();
-        break;
-
-      case argv_option_schema:
-        _schema_name = optarg;
-        _display_schema = true;
-        break;
-
-      case 'l':
-        if (cfg_cmd_handle_load(olsr_cfg_get_instance(), db, optarg, &log)) {
-          return_code = 1;
-        }
-        loaded_file = true;
-        break;
-      case 'S':
-        if (cfg_cmd_handle_save(olsr_cfg_get_instance(), db, optarg, &log)) {
-          return_code = 1;
-        }
-        break;
-      case 's':
-        if (cfg_cmd_handle_set(olsr_cfg_get_instance(), db, optarg, &log)) {
-          return_code = 1;
-        }
-        break;
-      case 'r':
-        if (cfg_cmd_handle_remove(olsr_cfg_get_instance(), db, optarg, &log)) {
-          return_code = 1;
-        }
-        break;
-      case 'g':
-        if (cfg_cmd_handle_get(olsr_cfg_get_instance(), db, optarg, &log)) {
-          return_code = 1;
-        }
-        else {
-          return_code = 0;
-        }
-        break;
-      case 'f':
-        if (cfg_cmd_handle_format(olsr_cfg_get_instance(), optarg)) {
-          return_code = 1;
-        }
-        break;
-
-      default:
-        if (!reload_only) {
-          return_code = 1;
-        }
-        break;
-    }
-  }
-
-  if (return_code == -1 && !loaded_file) {
-    /* try to load default config file if no other loaded */
-    cfg_cmd_handle_load(olsr_cfg_get_instance(), db,
-        olsr_builddata_get()->default_config, NULL);
-  }
-
-#if 0
-  if (return_code == -1) {
-    /* validate configuration */
-    if (cfg_schema_validate(db, false, true, &log)) {
-      return_code = 1;
-    }
-  }
-#endif
-
-  if (abuf_getlen(&log) > 0) {
-    if (reload_only) {
-      OLSR_WARN(LOG_MAIN, "Cannot reload configuration.\n%s", abuf_getptr(&log));
-    }
-    else {
-      fputs(abuf_getptr(&log), return_code == 0 ? stdout : stderr);
-    }
-  }
-
-  abuf_free(&log);
-
-  return return_code;
-}
-
-/**
- * Call the handle_schema command to give the user the schema of
- * the configuration including plugins
- * @return -1 if an error happened, 0 otherwise
- */
-static int
-display_schema(void) {
-  struct autobuf log;
-  int return_code;
-
-  return_code = 0;
-
-  abuf_init(&log);
-  cfg_cmd_clear_state(olsr_cfg_get_instance());
-
-  if (cfg_cmd_handle_schema(olsr_cfg_get_rawdb(), _schema_name, &log)) {
-    return_code = -1;
-  }
-
-  if (abuf_getlen(&log) > 0) {
-    fputs(abuf_getptr(&log), stdout);
-  }
-
-  abuf_free(&log);
-
-  return return_code;
-}
diff --git a/src/olsr_setup.c b/src/olsr_setup.c
deleted file mode 100644 (file)
index 077858a..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#include "common/common_types.h"
-#include "olsr_logging_cfg.h"
-#include "olsr.h"
-#include "olsr_setup.h"
-
-/* define the logging sources that are part of debug level 1 */
-static enum log_source _level_1_sources[] = {
-  LOG_MAIN,
-};
-
-/* remember if initialized or not */
-OLSR_SUBSYSTEM_STATE(_setup_state);
-
-/**
- * Allocate resources for the user of the framework
- * @return -1 if an error happened, 0 otherwise
- */
-int
-olsr_setup_init(void) {
-  if (olsr_subsystem_is_initialized(&_setup_state))
-    return 0;
-
-  /* add custom service setup here */
-
-
-  /* no error happened */
-  olsr_subsystem_init(&_setup_state);
-  return 0;
-}
-
-/**
- * Cleanup all resources allocated by setup initialization
- */
-void
-olsr_setup_cleanup(void) {
-  if (olsr_subsystem_cleanup(&_setup_state))
-    return;
-
-  /* add cleanup for custom services here */
-}
-
-/**
- * @return number of logging sources for debug level 1
- */
-size_t
-olsr_setup_get_level1count(void) {
-  return ARRAYSIZE(_level_1_sources);
-}
-
-/**
- * @return array of logging sources for debug level 1
- */
-enum log_source *
-olsr_setup_get_level1_logs(void) {
-  return _level_1_sources;
-}
diff --git a/src/olsr_setup.h b/src/olsr_setup.h
deleted file mode 100644 (file)
index c6646cd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-
-/*
- * The olsr.org Optimized Link-State Routing daemon(olsrd)
- * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the
- *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Visit http://www.olsr.org for more information.
- *
- * If you find this software useful feel free to make a donation
- * to the project. For more information see the website or contact
- * the copyright holders.
- *
- */
-
-#ifndef OLSR_SETUP_H_
-#define OLSR_SETUP_H_
-
-int olsr_setup_init(void) __attribute__((warn_unused_result));
-void olsr_setup_cleanup(void);
-size_t olsr_setup_get_level1count(void);
-enum log_source *olsr_setup_get_level1_logs(void);
-
-#endif /* OLSR_SETUP_H_ */
index cb7f8b5..0effae7 100644 (file)
@@ -2,11 +2,11 @@ function(compile_common_test executable source)
     # create executable
     ADD_EXECUTABLE(${executable} ${source})
 
-    TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_common)
+    TARGET_LINK_LIBRARIES(${executable} oonf_common)
 
     # link regex for windows and android
     IF (WIN32 OR ANDROID)
-        TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_regex)
+        TARGET_LINK_LIBRARIES(${executable} oonf_regex)
     ENDIF(WIN32 OR ANDROID)
 
     # link extra win32 libs
index 13fe223..a59f6b6 100644 (file)
@@ -2,12 +2,12 @@ function(compile_config_test executable source)
     # create executable
     ADD_EXECUTABLE(${executable} ${source})
 
-    TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_config)
-    TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_common)
+    TARGET_LINK_LIBRARIES(${executable} oonf_config)
+    TARGET_LINK_LIBRARIES(${executable} oonf_common)
 
     # link regex for windows and android
     IF (WIN32 OR ANDROID)
-        TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_regex)
+        TARGET_LINK_LIBRARIES(${executable} oonf_regex)
     ENDIF(WIN32 OR ANDROID)
 
     # link extra win32 libs
index c1d28b6..95aabda 100644 (file)
@@ -2,12 +2,12 @@ function(compile_packetbb_test executable source)
     # create executable
     ADD_EXECUTABLE(${executable} ${source})
 
-    TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_packetbb)
-    TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_common)
+    TARGET_LINK_LIBRARIES(${executable} oonf_packetbb)
+    TARGET_LINK_LIBRARIES(${executable} oonf_common)
 
     # link regex for windows and android
     IF (WIN32 OR ANDROID)
-        TARGET_LINK_LIBRARIES(${executable} ${OONF_LIBPREFIX}_regex)
+        TARGET_LINK_LIBRARIES(${executable} oonf_regex)
     ENDIF(WIN32 OR ANDROID)
 
     # link extra win32 libs