From 80765f1d6ea16892224be8da954e5b0a4c53303b Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 27 Jun 2016 12:03:31 +0200 Subject: build: Fix installation prefix The installation prefix was taking a trailing backslash, while it is common not to do so. Fixed it so that any trailing backslash is removed by the compilation and installation scripts. --- CMakeLists.txt | 4 ++-- compile_debug.sh | 4 ++-- compile_release.sh | 4 ++-- include/ouroboros/CMakeLists.txt | 2 +- include/ouroboros/config.h.in | 2 +- install_debug.sh | 2 +- install_release.sh | 4 ++-- src/ipcpd/local/CMakeLists.txt | 2 +- src/ipcpd/normal/CMakeLists.txt | 2 +- src/ipcpd/shim-eth-llc/CMakeLists.txt | 2 +- src/ipcpd/shim-udp/CMakeLists.txt | 2 +- src/irmd/CMakeLists.txt | 2 +- src/lib/CMakeLists.txt | 2 +- src/lib/ipcp.c | 6 +++--- src/nsmd/CMakeLists.txt | 2 +- src/tools/cbr/CMakeLists.txt | 2 +- src/tools/echo/CMakeLists.txt | 2 +- src/tools/irm/CMakeLists.txt | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9875bd7c..ba900645 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}usr/lib" isSystemDir) + "${CMAKE_INSTALL_PREFIX}/usr/lib" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/usr/lib") ENDIF("${isSystemDir}" STREQUAL "-1") @@ -50,7 +50,7 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.pc" - DESTINATION "usr/lib/pkgconfig") + DESTINATION "/usr/lib/pkgconfig") enable_testing() add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) diff --git a/compile_debug.sh b/compile_debug.sh index 78a298fc..3ea1e039 100755 --- a/compile_debug.sh +++ b/compile_debug.sh @@ -4,9 +4,9 @@ ME=compile_debug if (($# == 1 )) then - PREFIX=$1 + PREFIX=`echo "$1"|sed -e "s,\/$,,"` else - PREFIX="/usr/local/ouroboros/" + PREFIX="/usr/local/ouroboros" fi BUILDDIR=build diff --git a/compile_release.sh b/compile_release.sh index d2400ec2..58a16e52 100755 --- a/compile_release.sh +++ b/compile_release.sh @@ -4,9 +4,9 @@ ME=compile_release if (($# == 1 )) then - PREFIX=$1 + PREFIX=`echo "$1"|sed -e "s,\/$,,"` else - PREFIX="/" + PREFIX="" fi BUILDDIR=build diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index c5f65d49..2ea86883 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -14,4 +14,4 @@ set(HEADER_FILES qos.h ) -install(FILES ${HEADER_FILES} DESTINATION usr/include/ouroboros) +install(FILES ${HEADER_FILES} DESTINATION /usr/include/ouroboros) diff --git a/include/ouroboros/config.h.in b/include/ouroboros/config.h.in index a20715ac..0dce7acd 100644 --- a/include/ouroboros/config.h.in +++ b/include/ouroboros/config.h.in @@ -25,7 +25,7 @@ #define PROJECT_NAME "@CMAKE_PROJECT_NAME@" #define PROJECT_VERSION "@PACKAGE_VERSION@" -#define INSTALL_DIR "@CMAKE_INSTALL_PREFIX@" +#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" #define _POSIX_C_SOURCE 200112L #define IPCP_SHIM_UDP_EXEC "@IPCP_SHIM_UDP_TARGET@" #define IPCP_SHIM_ETH_LLC_EXEC "@IPCP_SHIM_ETH_LLC_TARGET@" diff --git a/install_debug.sh b/install_debug.sh index abb5c1c9..10e50706 100755 --- a/install_debug.sh +++ b/install_debug.sh @@ -4,7 +4,7 @@ ME=install_debug if (($# == 1 )) then - PREFIX=$1 + PREFIX=`echo "$1"|sed -e "s,\/$,,"` else PREFIX="/usr/local/ouroboros/" fi diff --git a/install_release.sh b/install_release.sh index 383c3f9b..f5d08bb5 100755 --- a/install_release.sh +++ b/install_release.sh @@ -4,9 +4,9 @@ ME=install_release if (($# == 1 )) then - PREFIX=$1 + PREFIX=`echo "$1"|sed -e "s,\/$,,"` else - PREFIX="/" + PREFIX="" fi BUILDDIR=build diff --git a/src/ipcpd/local/CMakeLists.txt b/src/ipcpd/local/CMakeLists.txt index cc19aad0..8052f513 100644 --- a/src/ipcpd/local/CMakeLists.txt +++ b/src/ipcpd/local/CMakeLists.txt @@ -26,7 +26,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ipcpd-local -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ipcpd-local RUNTIME DESTINATION sbin) +install(TARGETS ipcpd-local RUNTIME DESTINATION /sbin) # Enable once ipcp-local has tests # add_subdirectory(tests) diff --git a/src/ipcpd/normal/CMakeLists.txt b/src/ipcpd/normal/CMakeLists.txt index 74bd19ec..5c14c87a 100644 --- a/src/ipcpd/normal/CMakeLists.txt +++ b/src/ipcpd/normal/CMakeLists.txt @@ -28,7 +28,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ipcpd-normal -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ipcpd-normal RUNTIME DESTINATION sbin) +install(TARGETS ipcpd-normal RUNTIME DESTINATION /sbin) # Enable once ipcp-normal has tests # add_subdirectory(tests) diff --git a/src/ipcpd/shim-eth-llc/CMakeLists.txt b/src/ipcpd/shim-eth-llc/CMakeLists.txt index a3f96735..951deadc 100644 --- a/src/ipcpd/shim-eth-llc/CMakeLists.txt +++ b/src/ipcpd/shim-eth-llc/CMakeLists.txt @@ -34,4 +34,4 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ipcpd-shim-eth-llc -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ipcpd-shim-eth-llc RUNTIME DESTINATION sbin) +install(TARGETS ipcpd-shim-eth-llc RUNTIME DESTINATION /sbin) diff --git a/src/ipcpd/shim-udp/CMakeLists.txt b/src/ipcpd/shim-udp/CMakeLists.txt index 6430661c..edf5252d 100644 --- a/src/ipcpd/shim-udp/CMakeLists.txt +++ b/src/ipcpd/shim-udp/CMakeLists.txt @@ -84,7 +84,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ipcpd-shim-udp -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ipcpd-shim-udp RUNTIME DESTINATION sbin) +install(TARGETS ipcpd-shim-udp RUNTIME DESTINATION /sbin) # Enable once ipcp-shim-udp has tests # add_subdirectory(tests) diff --git a/src/irmd/CMakeLists.txt b/src/irmd/CMakeLists.txt index a402b242..1b373c99 100644 --- a/src/irmd/CMakeLists.txt +++ b/src/irmd/CMakeLists.txt @@ -19,7 +19,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(irmd -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS irmd RUNTIME DESTINATION sbin) +install(TARGETS irmd RUNTIME DESTINATION /sbin) # Enable once irmd has tests # add_subdirectory(tests) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 2a75ef17..8803fc3b 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -50,7 +50,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(ouroboros -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS ouroboros LIBRARY DESTINATION usr/lib) +install(TARGETS ouroboros LIBRARY DESTINATION /usr/lib) target_include_directories(ouroboros PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c index 730880f9..77263bcf 100644 --- a/src/lib/ipcp.c +++ b/src/lib/ipcp.c @@ -105,7 +105,7 @@ pid_t ipcp_create(char * ipcp_name, pid_t pid = 0; char irmd_pid[10]; size_t len = 0; - char * ipcp_dir = "sbin/"; + char * ipcp_dir = "/sbin/"; char * full_name = NULL; char * exec_name = NULL; @@ -132,7 +132,7 @@ pid_t ipcp_create(char * ipcp_name, else exit(EXIT_FAILURE); - len += strlen(INSTALL_DIR); + len += strlen(INSTALL_PREFIX); len += strlen(ipcp_dir); len += strlen(exec_name); len += 1; @@ -143,7 +143,7 @@ pid_t ipcp_create(char * ipcp_name, exit(EXIT_FAILURE); } - strcpy(full_name, INSTALL_DIR); + strcpy(full_name, INSTALL_PREFIX); strcat(full_name, ipcp_dir); strcat(full_name, exec_name); full_name[len] = '\0'; diff --git a/src/nsmd/CMakeLists.txt b/src/nsmd/CMakeLists.txt index b916170b..8539c79c 100644 --- a/src/nsmd/CMakeLists.txt +++ b/src/nsmd/CMakeLists.txt @@ -18,7 +18,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) MACRO_ADD_COMPILE_FLAGS(nsmd -DCONFIG_OUROBOROS_DEBUG) endif (CMAKE_BUILD_TYPE MATCHES Debug) -install(TARGETS nsmd RUNTIME DESTINATION sbin) +install(TARGETS nsmd RUNTIME DESTINATION /sbin) # Enable once nsmd has tests # add_subdirectory(tests) diff --git a/src/tools/cbr/CMakeLists.txt b/src/tools/cbr/CMakeLists.txt index 232bea36..e54ffff6 100644 --- a/src/tools/cbr/CMakeLists.txt +++ b/src/tools/cbr/CMakeLists.txt @@ -13,4 +13,4 @@ add_executable(cbr ${SOURCE_FILES}) target_link_libraries(cbr LINK_PUBLIC ouroboros) -install(TARGETS cbr RUNTIME DESTINATION usr/bin) +install(TARGETS cbr RUNTIME DESTINATION /usr/bin) diff --git a/src/tools/echo/CMakeLists.txt b/src/tools/echo/CMakeLists.txt index 42bcdbfe..ec8ed7ba 100644 --- a/src/tools/echo/CMakeLists.txt +++ b/src/tools/echo/CMakeLists.txt @@ -13,4 +13,4 @@ add_executable(echo-app ${SOURCE_FILES}) target_link_libraries(echo-app LINK_PUBLIC ouroboros) -install(TARGETS echo-app RUNTIME DESTINATION usr/bin) +install(TARGETS echo-app RUNTIME DESTINATION /usr/bin) diff --git a/src/tools/irm/CMakeLists.txt b/src/tools/irm/CMakeLists.txt index d1f227a8..42fabcb0 100644 --- a/src/tools/irm/CMakeLists.txt +++ b/src/tools/irm/CMakeLists.txt @@ -20,4 +20,4 @@ add_executable (irm ${SOURCE_FILES}) target_link_libraries (irm LINK_PUBLIC ouroboros) -install(TARGETS irm RUNTIME DESTINATION sbin) +install(TARGETS irm RUNTIME DESTINATION /sbin) -- cgit v1.2.3