Cleanup build system and related files, there are no "app-libraries" anymore
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Fri, 7 Nov 2014 08:04:56 +0000 (09:04 +0100)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Fri, 7 Nov 2014 08:04:56 +0000 (09:04 +0100)
12 files changed:
cmake/app_config.cmake
cmake/link_app_dynamic.cmake
cmake/prepare_app.cmake
src-api/core/CMakeLists.txt
src-api/core/oonf_appdata.h [new file with mode: 0644]
src-api/core/oonf_libdata.c.in
src-api/core/oonf_libdata.h
src-api/core/oonf_logging.c
src-api/core/oonf_logging.h
src-api/core/oonf_subsystem.c
src-plugins/subsystems/oonf_http.c
src/app_data.c.in

index ffe58dd..36f87fb 100644 (file)
@@ -18,9 +18,6 @@ set (OONF_APP_DEFAULT_CFG_HANDLER Compact CACHE STRING
 set (OONF_APP OLSRd2)
 set (OONF_EXE olsrd2)
 
-# set Application library prefix
-set (OONF_APP_LIBPREFIX "olsrd2")
-
 # setup custom text before and after default help message
 set (OONF_HELP_PREFIX "OLSRv2 routing agent\\\\n")
 set (OONF_HELP_SUFFIX "")
index 1a3cd96..9232c28 100644 (file)
@@ -6,9 +6,6 @@ FOREACH(plugin ${PLUGIN_LIST})
     IF(TARGET oonf_static_${plugin})
         message ("    Found target: oonf_static_${plugin}")  
         TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,--whole-archive oonf_static_${plugin} -Wl,--no-whole-archive)
-    ELSEIF (TARGET ${OONF_APP_LIBPREFIX}_static_${plugin})
-        message ("    Found target: ${OONF_APP_LIBPREFIX}_static_${plugin}")  
-        TARGET_LINK_LIBRARIES(${OONF_EXE} -Wl,--whole-archive ${OONF_APP_LIBPREFIX}_static_${plugin} -Wl,--no-whole-archive)
     ELSE (TARGET oonf_static_${plugin})
         message (FATAL_ERROR "    Did not found target: oonf_static_${plugin} or ${OONF_APP_LIBPREFIX}_static_${plugin}")
     ENDIF(TARGET oonf_static_${plugin})
index ecb0ecb..aa5a7bd 100644 (file)
@@ -29,11 +29,9 @@ ADD_CUSTOM_COMMAND (
         -DOONF_HELP_PREFIX=${OONF_HELP_PREFIX}
         -DOONF_HELP_SUFFIX=${OONF_HELP_SUFFIX}
         -DOONF_APP_DEFAULT_CFG_HANDLER=${DEFAULT_CFG_HANDLER}
-        -DOONF_APP_LIBPREFIX=${OONF_APP_LIBPREFIX}
         -DCMAKE_SYSTEM=${CMAKE_SYSTEM}
         -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
         -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}
-        -DOONF_APP_GIT=${OONF_APP_GIT}
         -P ${PROJECT_SOURCE_DIR}/cmake/generate_builddata.cmake
     DEPENDS AppCleanData
     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
index 5fa24b2..81b1952 100644 (file)
@@ -29,7 +29,8 @@ SET(OONF_CORE_SRCS oonf_cfg.c
                    oonf_subsystem.c
                    ${GEN_DATA_C})
 
-SET(OONF_CORE_INCLUDES oonf_cfg.h
+SET(OONF_CORE_INCLUDES oonf_appdata.h
+                       oonf_cfg.h
                        oonf_logging.h
                        oonf_logging_cfg.h
                        oonf_main.h
diff --git a/src-api/core/oonf_appdata.h b/src-api/core/oonf_appdata.h
new file mode 100644 (file)
index 0000000..4f231c4
--- /dev/null
@@ -0,0 +1,57 @@
+
+/*
+ * The olsr.org Optimized Link-State Routing daemon version 2 (olsrd2)
+ * Copyright (c) 2004-2013, 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 OONF_APPDATA_H_
+#define OONF_APPDATA_H_
+
+#include "common/common_types.h"
+
+struct oonf_appdata {
+  const char *app_name;
+  const char *versionstring_trailer;
+  const char *help_prefix;
+  const char *help_suffix;
+
+  const char *default_lockfile;
+  const char *default_cfg_handler;
+};
+
+#endif /* OONF_APPDATA_H_ */
index c384a8c..7215a04 100644 (file)
@@ -42,7 +42,7 @@
 #include "core/oonf_libdata.h"
 
 static struct oonf_libdata _libdata = {
-  .lib_version = "${OONF_VERSION}",
+  .version = "${OONF_VERSION}",
   
   .git_commit = "${OONF_LIB_GIT}",
   
index 61c1304..04c6006 100644 (file)
@@ -45,7 +45,7 @@
 #include "common/common_types.h"
 
 struct oonf_libdata {
-  const char *lib_version;
+  const char *version;
 
   const char *git_commit;
 
index 4a67bc5..d9eb391 100644 (file)
@@ -267,12 +267,10 @@ oonf_log_get_libdata(void) {
  */
 void
 oonf_log_printversion(struct autobuf *abuf) {
-  abuf_appendf(abuf," %s version %s\n"
-            " Application commit: %s\n",
+  abuf_appendf(abuf," %s version %s\n",
             _appdata->app_name,
-            _libdata->lib_version,
-            _appdata->git_commit);
-  abuf_appendf(abuf, " Library commit: %s\n", _libdata->git_commit);
+            _libdata->version);
+  abuf_appendf(abuf, " Git commit: %s\n", _libdata->git_commit);
   abuf_puts(abuf, _appdata->versionstring_trailer);
 }
 
index 865b0a9..9e8288d 100644 (file)
@@ -49,6 +49,7 @@ struct oonf_log_handler_entry;
 #include "common/common_types.h"
 #include "common/autobuf.h"
 #include "common/list.h"
+#include "core/oonf_appdata.h"
 #include "core/oonf_libdata.h"
 
 /**
@@ -94,21 +95,6 @@ struct oonf_log_parameters {
   int prefixLength;
 };
 
-struct oonf_appdata {
-  const char *app_name;
-  const char *versionstring_trailer;
-  const char *help_prefix;
-  const char *help_suffix;
-
-  const char *default_lockfile;
-  const char *default_cfg_handler;
-
-  const char *git_commit;
-
-  const char *sharedlibrary_prefix;
-  const char *sharedlibrary_postfix;
-};
-
 /*
  * macros to check which logging levels are active
  *
index 30840a7..6366fe4 100644 (file)
@@ -61,9 +61,7 @@ enum {
   IDX_DLOPEN_LIB,
   IDX_DLOPEN_PATH,
   IDX_DLOPEN_PRE,
-  IDX_DLOPEN_PRELIB,
   IDX_DLOPEN_POST,
-  IDX_DLOPEN_POSTLIB,
   IDX_DLOPEN_VER,
 };
 
@@ -82,23 +80,15 @@ static void *_open_plugin_template(const char *filename, int template, int mode)
  * %LIB%:  name of the plugin
  * %PATH%: local path (linux: ".")
  *
- * %PRE%:  shared library prefix defined by the app (linux: "lib<app>_")
- * %POST%: shared library postfix defined by the app (linux: ".so")
- * %VER:   version number as defined by the app (e.g. "0.1.0")
- *
- * %PRELIB%: shared library prefix defined by the API (linux: "liboonf_")
- * %POST%:   shared library postfix defined by the app (linux: ".so")
- * %VER:     version number as defined by the app (e.g. "0.1.0")
+ * %PRE%:  shared library prefix  (linux: "liboonf_")
+ * %POST%: shared library postfix (linux: ".so")
+ * %VER:   version number (e.g. "0.1.0")
  */
 static const char *DLOPEN_PATTERNS[] = {
   "%PATH%/%PRE%%LIB%%POST%.%VER%",
-  "%PATH%/%PRELIB%%LIB%%POSTLIB%.%VER%",
   "%PATH%/%PRE%%LIB%%POST%",
-  "%PATH%/%PRELIB%%LIB%%POSTLIB%",
   "%PRE%%LIB%%POST%.%VER%",
-  "%PRELIB%%LIB%%POSTLIB%.%VER%",
   "%PRE%%LIB%%POST%",
-  "%PRELIB%%LIB%%POSTLIB%",
 };
 
 /* Local functions */
@@ -110,9 +100,7 @@ static struct abuf_template_data_entry _dlopen_data[] = {
   [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" },
 };
 
@@ -131,17 +119,11 @@ oonf_plugins_init(void) {
 
   /* load predefined values for dlopen templates */
   _dlopen_data[IDX_DLOPEN_PRE].value =
-      oonf_log_get_appdata()->sharedlibrary_prefix;
-  _dlopen_data[IDX_DLOPEN_POST].value =
-      oonf_log_get_appdata()->sharedlibrary_postfix;
-
-  _dlopen_data[IDX_DLOPEN_PRELIB].value =
       oonf_log_get_libdata()->sharedlibrary_prefix;
-  _dlopen_data[IDX_DLOPEN_POSTLIB].value =
+  _dlopen_data[IDX_DLOPEN_POST].value =
       oonf_log_get_libdata()->sharedlibrary_postfix;
-
   _dlopen_data[IDX_DLOPEN_VER].value =
-      oonf_log_get_libdata()->lib_version;
+      oonf_log_get_libdata()->version;
   return 0;
 }
 
@@ -286,20 +268,12 @@ oonf_plugins_extract_name(
       oonf_log_get_libdata()->sharedlibrary_prefix)) {
     start += strlen(oonf_log_get_libdata()->sharedlibrary_prefix);
   }
-  else if (str_startswith_nocase(&libname[start],
-      oonf_log_get_appdata()->sharedlibrary_prefix)) {
-    start += strlen(oonf_log_get_appdata()->sharedlibrary_prefix);
-  }
 
   /* remove (oonf/app) lib postfix */
   if (str_endswith_nocase(&libname[start],
       oonf_log_get_libdata()->sharedlibrary_postfix)) {
     end -= strlen(oonf_log_get_libdata()->sharedlibrary_prefix);
   }
-  else if (str_endswith_nocase(&libname[start],
-      oonf_log_get_appdata()->sharedlibrary_postfix)) {
-    end -= strlen(oonf_log_get_appdata()->sharedlibrary_prefix);
-  }
 
   if (end-start+1 <= sizeof(*pluginname)) {
     memcpy(pluginname->name, &libname[start], end-start);
index 78cb7af..768724b 100644 (file)
@@ -431,7 +431,7 @@ _create_http_error(struct oonf_stream_session *session,
     enum oonf_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>",
-      oonf_log_get_appdata()->app_name, oonf_log_get_libdata()->lib_version,
+      oonf_log_get_appdata()->app_name, oonf_log_get_libdata()->version,
       error, _get_headertype_string(error));
   _create_http_header(session, error, NULL);
 }
@@ -530,7 +530,7 @@ _create_http_header(struct oonf_stream_session *session,
 
   /* Server version */
   abuf_appendf(&buf, "Server: %s\r\n",
-      oonf_log_get_libdata()->lib_version);
+      oonf_log_get_libdata()->version);
 
   /* connection-type */
   abuf_puts(&buf, "Connection: closed\r\n");
index 056e6f6..4eee894 100644 (file)
@@ -51,10 +51,6 @@ static struct oonf_appdata _appdata = {
 
   .default_lockfile = OS_CORE_LOCKFILE_FOLDER "${OONF_APP_LIBPREFIX}.lock",
   .default_cfg_handler = ${OONF_APP_DEFAULT_CFG_HANDLER},
-  .git_commit = "${OONF_APP_GIT}",
-
-  .sharedlibrary_prefix = "${CMAKE_SHARED_LIBRARY_PREFIX}${OONF_APP_LIBPREFIX}_",
-  .sharedlibrary_postfix = "${CMAKE_SHARED_LIBRARY_SUFFIX}",
 };
 
 const struct oonf_appdata *