diff options
author | Damjan Marion <damarion@cisco.com> | 2021-09-30 20:04:14 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-10-05 16:44:32 +0000 |
commit | 5546e43f7943d6edff6c6587ed4e7233e8002e28 (patch) | |
tree | 16b4a8ce7a63c4cf1ce7f367b0d0f1d9268f2849 /src | |
parent | efd967faff168d037066b6e6824d2a579adbef93 (diff) |
build: don't hardcode triplet, allow specifying custom lib dir
Type: fix
Change-Id: I33f364fda88914f88f9b976cb83e6d3ff466f0bb
Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | src/pkg/debian/rules.in | 7 | ||||
-rw-r--r-- | src/vat/main.c | 3 | ||||
-rw-r--r-- | src/vat2/main.c | 3 | ||||
-rw-r--r-- | src/vlib/unix/plugin.c | 9 | ||||
-rw-r--r-- | src/vlib/unix/plugin.h | 1 | ||||
-rw-r--r-- | src/vpp/conf/startup.conf | 2 | ||||
-rw-r--r-- | src/vpp/vnet/main.c | 6 | ||||
-rw-r--r-- | src/vppinfra/config.h.in | 2 |
9 files changed, 21 insertions, 18 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bb5caad734..0448a5b640e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,6 +33,10 @@ if(CMAKE_VERSION VERSION_LESS 3.12) endmacro() endif() +if(NOT DEFINED CMAKE_INSTALL_LIBDIR AND EXISTS "/etc/debian_version") + set(CMAKE_INSTALL_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}") +endif() + include(CheckCCompilerFlag) include(CheckIPOSupported) include(GNUInstallDirs) @@ -152,7 +156,7 @@ endif() ############################################################################## option(VPP_SET_RPATH "Set rpath for resulting binaries and libraries." ON) if(VPP_SET_RPATH) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${VPP_LIBRARY_DIR}") endif() set(CMAKE_INSTALL_MESSAGE NEVER) diff --git a/src/pkg/debian/rules.in b/src/pkg/debian/rules.in index 15f8eb6f810..2af1fe7d966 100755 --- a/src/pkg/debian/rules.in +++ b/src/pkg/debian/rules.in @@ -23,8 +23,6 @@ build3vers := $(shell py3versions -sv) override_dh_strip: dh_strip --dbg-package=vpp-dbg -DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) - override_dh_install: @for c in @VPP_COMPONENTS@; do \ @CMAKE_COMMAND@ \ @@ -33,11 +31,6 @@ override_dh_install: -D CMAKE_INSTALL_PREFIX=@VPP_BINARY_DIR@/debian/$$c \ -P @CMAKE_BINARY_DIR@/cmake_install.cmake 2>&1 \ | grep -v 'Set runtime path of' ; \ - if [ -d debian/$$c/lib ] ; then \ - mv debian/$$c/lib debian/$$c/$(DEB_HOST_MULTIARCH) ; \ - mkdir -p debian/$$c/usr/lib ; \ - mv debian/$$c/$(DEB_HOST_MULTIARCH) debian/$$c/usr/lib ; \ - fi ; \ for d in bin include share ; do \ if [ -d debian/$$c/$$d ] ; then \ mkdir -p debian/$$c/usr ; \ diff --git a/src/vat/main.c b/src/vat/main.c index 70352e6bf95..c718197e30d 100644 --- a/src/vat/main.c +++ b/src/vat/main.c @@ -313,8 +313,7 @@ vat_find_plugin_path () return; *p = 0; - s = format (0, "%s/lib/" CLIB_TARGET_TRIPLET "/vpp_api_test_plugins:" - "%s/lib/vpp_api_test_plugins", path, path); + s = format (0, "%s/" CLIB_LIB_DIR "/vpp_api_test_plugins", path, path); vec_add1 (s, 0); vat_plugin_path = (char *) s; } diff --git a/src/vat2/main.c b/src/vat2/main.c index 2d148472d42..dc27c6e608f 100644 --- a/src/vat2/main.c +++ b/src/vat2/main.c @@ -85,8 +85,7 @@ vat2_find_plugin_path () return; *p = 0; - s = format (0, "%s/lib/" CLIB_TARGET_TRIPLET "/vat2_plugins:" - "%s/lib/vat2_plugins", path, path); + s = format (0, "%s/" CLIB_LIB_DIR "/vat2_plugins", path, path); vec_add1 (s, 0); vat2_plugin_path = (char *) s; } diff --git a/src/vlib/unix/plugin.c b/src/vlib/unix/plugin.c index 4a7ff2753f2..891e2cb642d 100644 --- a/src/vlib/unix/plugin.c +++ b/src/vlib/unix/plugin.c @@ -594,7 +594,12 @@ vlib_plugin_early_init (vlib_main_t * vm) 0x7FFFFFFF /* aka no rate limit */ ); if (pm->plugin_path == 0) - pm->plugin_path = format (0, "%s%c", vlib_plugin_path, 0); + pm->plugin_path = format (0, "%s", vlib_plugin_path); + + if (pm->plugin_path_add) + pm->plugin_path = format (pm->plugin_path, ":%s", pm->plugin_path_add); + + pm->plugin_path = format (pm->plugin_path, "%c", 0); PLUGIN_LOG_DBG ("plugin path %s", pm->plugin_path); @@ -756,6 +761,8 @@ done: u8 *s = 0; if (unformat (input, "path %s", &s)) pm->plugin_path = s; + else if (unformat (input, "add-path %s", &s)) + pm->plugin_path_add = s; else if (unformat (input, "name-filter %s", &s)) pm->plugin_name_filter = s; else if (unformat (input, "vat-path %s", &s)) diff --git a/src/vlib/unix/plugin.h b/src/vlib/unix/plugin.h index e3555fe3ba9..1c46e6b196c 100644 --- a/src/vlib/unix/plugin.h +++ b/src/vlib/unix/plugin.h @@ -123,6 +123,7 @@ typedef struct /* paths and name filters */ u8 *plugin_path; + u8 *plugin_path_add; u8 *plugin_name_filter; u8 *vat_plugin_path; u8 *vat_plugin_name_filter; diff --git a/src/vpp/conf/startup.conf b/src/vpp/conf/startup.conf index ee10faa8683..a879db38864 100644 --- a/src/vpp/conf/startup.conf +++ b/src/vpp/conf/startup.conf @@ -201,6 +201,8 @@ cpu { # plugins { ## Adjusting the plugin path depending on where the VPP plugins are # path /ws/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins + ## Add additional directory to the plugin path + # add-path /tmp/vpp_plugins ## Disable all plugins by default and then selectively enable specific plugins # plugin default { disable } diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c index e0c7b0dbf58..e9cef5e76a8 100644 --- a/src/vpp/vnet/main.c +++ b/src/vpp/vnet/main.c @@ -60,13 +60,11 @@ vpp_find_plugin_path () return; *p = 0; - s = format (0, "%s/lib/" CLIB_TARGET_TRIPLET "/vpp_plugins:" - "%s/lib/vpp_plugins", path, path); + s = format (0, "%s/" CLIB_LIB_DIR "/vpp_plugins", path, path); vec_add1 (s, 0); vlib_plugin_path = (char *) s; - s = format (0, "%s/lib/" CLIB_TARGET_TRIPLET "/vpp_api_test_plugins:" - "%s/lib/vpp_api_test_plugins", path, path); + s = format (0, "%s/" CLIB_LIB_DIR "/vpp_api_test_plugins", path, path); vec_add1 (s, 0); vat_plugin_path = (char *) s; } diff --git a/src/vppinfra/config.h.in b/src/vppinfra/config.h.in index 7aad027a8b6..c2b804cd590 100644 --- a/src/vppinfra/config.h.in +++ b/src/vppinfra/config.h.in @@ -20,7 +20,7 @@ #define CLIB_LOG2_CACHE_LINE_BYTES @LOG2_CACHE_LINE_BYTES@ #endif -#define CLIB_TARGET_TRIPLET "@CMAKE_C_COMPILER_TARGET@" +#define CLIB_LIB_DIR "@VPP_LIBRARY_DIR@" #define CLIB_VECTOR_GROW_BY_ONE @VECTOR_GROW_BY_ONE@ #endif |