diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d4acf141d..faa3d9dc35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,6 @@ set (OPENAIR2_DIR ${OPENAIR_DIR}/openair2) set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3) set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3) set (OPENAIR_CMAKE ${OPENAIR_DIR}/cmake_targets) -set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) project (OpenAirInterface) @@ -254,12 +253,6 @@ if(GIT_FOUND) ) endif() -# Below is a hard-coded info -set (FIRMWARE_VERSION "No svn information") -add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") -add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"") -add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") - # Debug related options ######################################### add_boolean_option(DEBUG_ASN1 False "Enable ASN1 debug logs" OFF) @@ -544,16 +537,8 @@ add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)" add_boolean_option(RRC_DEFAULT_RAB_IS_AM True "set the LTE RLC mode to AM for the default bearer, otherwise it is UM." ON) # add the binary tree to the search path for include files -####################################################### -# We will find ConfigOAI.h after generation in target directory -include_directories("${OPENAIR_BIN_DIR}") -# add directories to find all include files -# the internal rule is to use generic names such as defs.h -# but to make it uniq name as adding the relative path in the include directtive -# example: #include "RRC/LTE/rrc_defs.h" -#find_path (include_dirs_all *.h ${OPENAIR_DIR}) -#find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH) -#include_directories("${include_dirs_all}") +# We will find common/oai_version.h after generation in target directory +include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Legacy exact order diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 512d2b1553..6c2d123397 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1 +1,3 @@ add_subdirectory(utils) + +configure_file(oai_version.h.in oai_version.h @ONLY) diff --git a/common/oai_version.h.in b/common/oai_version.h.in new file mode 100644 index 0000000000..4b54e6fc44 --- /dev/null +++ b/common/oai_version.h.in @@ -0,0 +1,32 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef OAI_VERSION_H_ +#define OAI_VERSION_H_ + +#define GIT_BRANCH "@GIT_BRANCH@" +#define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" +#define GIT_COMMIT_DATE "@GIT_COMMIT_DATE@" + +#define OAI_FIRMWARE_VERSION GIT_COMMIT_HASH +#define OAI_PACKAGE_VERSION "Branch: " GIT_BRANCH " Abrev. Hash: " GIT_COMMIT_HASH " Date: " GIT_COMMIT_DATE + +#endif /* OAI_VERSION_H_ */ diff --git a/common/utils/DOC/loader/devusage/api.md b/common/utils/DOC/loader/devusage/api.md index 59623e256b..4fbc8febfa 100644 --- a/common/utils/DOC/loader/devusage/api.md +++ b/common/utils/DOC/loader/devusage/api.md @@ -6,7 +6,7 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf) * Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters. * loads the shared library, using the dlopen system call * looks for `< modname >_autoinit` symbol, using the `dlsym` system call and possibly call the corresponding function. -* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function. +* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `OAI_PACKAGE_VERSION` macro defined in the [`common/CMakeLists`](../../../CMakeLists). The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function. * If the farray pointer is null, looks for `< modname >_getfarray` symbol, calls the corresponding function when the symbol is found. `< modname >_getfarray` takes one argument, a pointer to a `loader_shlibfunc_t` array, and returns the number of items in this array, as defined by the `getfarrayfunc_t` type. The `loader_shlibfunc_t` array returned by the shared library must be fully filled (both `fname` and `fptr` fields). * looks for the `numf` function symbols listed in the `farray[i].fname` arguments and set the corresponding `farray[i].fptr`function pointers diff --git a/common/utils/load_module_shlib.c b/common/utils/load_module_shlib.c index 15d2b3d852..4fa1b9f357 100644 --- a/common/utils/load_module_shlib.c +++ b/common/utils/load_module_shlib.c @@ -38,6 +38,7 @@ #include #include #include "openair1/PHY/defs_common.h" +#include "common/oai_version.h" #define LOAD_MODULE_SHLIB_MAIN #include "common/config/config_userapi.h" @@ -45,7 +46,7 @@ void loader_init(void) { paramdef_t LoaderParams[] = LOADER_PARAMS_DESC; - loader_data.mainexec_buildversion = PACKAGE_VERSION; + loader_data.mainexec_buildversion = OAI_PACKAGE_VERSION; int ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), LOADER_CONFIG_PREFIX); if (ret <0) { printf("[LOADER] configuration couldn't be performed via config module, parameters set to default values\n"); diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 46e00e0019..43208748d0 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -56,6 +56,7 @@ #include "common/utils/threadPool/thread-pool.h" #include "executables/softmodem-common.h" #include +#include "common/oai_version.h" #include "telnetsrv_phycmd.h" @@ -938,10 +939,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde against main exec version. version mismatch not considered as fatal (interfaces not supposed to change) */ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildversion) { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__ -#endif - *shlib_buildversion = PACKAGE_VERSION; + *shlib_buildversion = OAI_PACKAGE_VERSION; if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) { fprintf(stderr,"[TELNETSRV] shared lib version %s, doesn't match main version %s, compatibility should be checked\n", diff --git a/common/utils/websrv/CMakeLists.txt b/common/utils/websrv/CMakeLists.txt index fd1b216c88..5a54460342 100644 --- a/common/utils/websrv/CMakeLists.txt +++ b/common/utils/websrv/CMakeLists.txt @@ -87,6 +87,6 @@ add_custom_target( add_dependencies(websrv websrvfront) # copy frontend files to a websrv subdirectory of where oai copy all built files add_custom_command(TARGET websrvfront - POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist/softmodem-ngx ${OPENAIR_BIN_DIR}/../websrv - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/helpfiles ${OPENAIR_BIN_DIR}/../websrv/helpfiles - COMMENT "Moving frontend files to:\n ${OPENAIR_BIN_DIR}/../websrv \n " ) + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist/softmodem-ngx ${CMAKE_CURRENT_BINARY_DIR}/../websrv + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/helpfiles ${CMAKE_CURRENT_BINARY_DIR}/../websrv/helpfiles + COMMENT "Moving frontend files to: ${CMAKE_CURRENT_BINARY_DIR}/../websrv" ) diff --git a/doc/Doxyfile b/doc/Doxyfile index 5ae52a3c3a..5f377964cf 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = OpenAirInterface # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = @GIT_COMMIT_HASH@ (@GIT_BRANCH@) # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c index 99f98d4f83..69abbb4464 100644 --- a/executables/lte-softmodem.c +++ b/executables/lte-softmodem.c @@ -37,6 +37,7 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" +#include "common/oai_version.h" #include "PHY/types.h" @@ -466,11 +467,8 @@ int main ( int argc, char **argv ) init_opt(); // to make a graceful exit when ctrl-c is pressed set_softmodem_sighandler(); -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" -#endif // strdup to put the sring in the core file for post mortem identification - LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION)); + LOG_I(HW, "Version: %s\n", strdup(OAI_PACKAGE_VERSION)); /* Read configuration */ if (RC.nb_inst > 0) { diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c index a75a22fba4..74c63687b0 100644 --- a/executables/lte-uesoftmodem.c +++ b/executables/lte-uesoftmodem.c @@ -42,6 +42,7 @@ #include "pdcp.h" #include "PHY/defs_UE.h" +#include "common/oai_version.h" #include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" @@ -575,11 +576,8 @@ int main( int argc, char **argv ) { pdcp_pc5_socket_init(); // to make a graceful exit when ctrl-c is pressed set_softmodem_sighandler(); -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" -#endif // strdup to put the sring in the core file for post mortem identification - LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION)); + LOG_I(HW, "Version: %s\n", strdup(OAI_PACKAGE_VERSION)); // init the parameters for (CC_id=0; CC_id +#include "common/oai_version.h" #include "PHY/types.h" #include "common/ran_context.h" @@ -644,11 +645,8 @@ int main( int argc, char **argv ) { // initialize mscgen log after ITTI init_opt(); -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" -#endif // strdup to put the sring in the core file for post mortem identification - char *pckg = strdup(PACKAGE_VERSION); + char *pckg = strdup(OAI_PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", pckg); // don't create if node doesn't connect to RRC/S1/GTP diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index bc5f4bc778..47284cd355 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -26,6 +26,7 @@ #include #include "T.h" +#include "common/oai_version.h" #include "assertions.h" #include "PHY/types.h" #include "PHY/defs_nr_UE.h" @@ -430,11 +431,8 @@ int main(int argc, char **argv) if (ouput_vcd) { vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd"); } -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" -#endif // strdup to put the sring in the core file for post mortem identification - char *pckg = strdup(PACKAGE_VERSION); + char *pckg = strdup(OAI_PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", pckg); PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g) * NB_UE_INST); diff --git a/nfapi/open-nFAPI/docs/Doxyfile.in b/nfapi/open-nFAPI/docs/Doxyfile.in index 74d405ad00..1120edd8f4 100644 --- a/nfapi/open-nFAPI/docs/Doxyfile.in +++ b/nfapi/open-nFAPI/docs/Doxyfile.in @@ -31,7 +31,7 @@ PROJECT_NAME = @PACKAGE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @GIT_COMMIT_HASH@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 865ffef2d9..c161682f7d 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -33,6 +33,7 @@ #include #include #include +#include "common/oai_version.h" #include "PHY/sse_intrin.h" @@ -359,10 +360,7 @@ void init_encoder_sse (void) { against main exec version. version mismatch no considered as fatal (interfaces not supposed to change) */ int coding_checkbuildver(char *mainexec_buildversion, char **shlib_buildversion) { -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__ -#endif - *shlib_buildversion = PACKAGE_VERSION; + *shlib_buildversion = OAI_PACKAGE_VERSION; if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) { fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n", diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 33c585bcc3..ac2cc4db16 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -30,6 +30,7 @@ # include "nas_parser.h" # include "nas_proc.h" #include "common/utils/mem/oai_memory.h" +#include "common/oai_version.h" #include "nas_user.h" #include "common/ran_context.h" @@ -134,7 +135,7 @@ void *nas_ue_task(void *args_p) user->at_response = calloc_or_fail(1, sizeof(at_response_t)); user->lowerlayer_data = calloc_or_fail(1, sizeof(lowerlayer_data_t)); /* Initialize NAS user */ - nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION); + nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, OAI_FIRMWARE_VERSION); } } else @@ -174,7 +175,7 @@ void *nas_ue_task(void *args_p) user->at_response = calloc_or_fail(1, sizeof(at_response_t)); user->lowerlayer_data = calloc_or_fail(1, sizeof(lowerlayer_data_t)); /* Initialize NAS user */ - nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION); + nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, OAI_FIRMWARE_VERSION); user->ueid = 0; }