diff options
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | project/cmake/addons/CMakeLists.txt | 12 | ||||
-rw-r--r-- | project/cmake/kodi-config.cmake.in | 8 | ||||
-rw-r--r-- | project/cmake/scripts/common/addon-helpers.cmake | 18 | ||||
-rw-r--r-- | project/cmake/scripts/common/prepare-env.cmake | 27 | ||||
-rw-r--r-- | project/cmake/scripts/linux/UseMultiArch.cmake | 44 |
7 files changed, 45 insertions, 77 deletions
diff --git a/Makefile.in b/Makefile.in index 819a43ca07..9eaa40e972 100644 --- a/Makefile.in +++ b/Makefile.in @@ -624,9 +624,6 @@ endif @for f in project/cmake/scripts/common/*.cmake; do \ install -m 0644 $$f $(DESTDIR)$(libdir)/@APP_NAME_LC@; \ done -ifeq ($(findstring linux,@host@),linux) - install -m 0644 project/cmake/scripts/linux/UseMultiArch.cmake $(DESTDIR)$(libdir)/@APP_NAME_LC@ -endif @cd $(DESTDIR)$(includedir); [ -L xbmc ] || [ -d xbmc ] || ln -s @APP_NAME_LC@ xbmc uninstall: diff --git a/configure.ac b/configure.ac index 5dcc3bef2b..8c1e41221d 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,7 @@ AC_DEFUN([XB_PUSH_FLAGS], [ # version can be overridden by setting the following as ENV vars when running configure APP_NAME=${APP_NAME-$(${AWK} '/APP_NAME/ {print $2}' version.txt)} APP_NAME_LC=$(echo $APP_NAME | ${AWK} '{print tolower($0)}') +APP_NAME_UC=$(echo $APP_NAME | ${AWK} '{print toupper($0)}') APP_VERSION_MAJOR=${APP_VERSION_MAJOR-$(${AWK} '/VERSION_MAJOR/ {print $2}' version.txt)} APP_VERSION_MINOR=${APP_VERSION_MINOR-$(${AWK} '/VERSION_MINOR/ {print $2}' version.txt)} APP_VERSION_TAG=${APP_VERSION_TAG-$(${AWK} '/VERSION_TAG/ {print $2}' version.txt)} @@ -134,6 +135,7 @@ if test "$APP_NAME" != "" && test "$APP_VERSION_MAJOR" != "" && test "$APP_VERSI AC_SUBST(APP_NAME) AC_SUBST(APP_NAME_LC) + AC_SUBST(APP_NAME_UC) AC_SUBST(APP_VERSION) AC_SUBST(APP_VERSION_MAJOR) AC_SUBST(APP_VERSION_MINOR) @@ -2560,8 +2562,12 @@ if echo "$libdir" | grep -q '${exec_prefix}'; then exec_prefix=${prefix} fi fi -eval "APP_LIBDIR=${libdir}" -AC_SUBST(APP_LIBDIR) +eval "APP_PREFIX=${prefix}" +eval "APP_LIB_DIR=${libdir}/${APP_NAME_LC}" +eval "APP_INCLUDE_DIR=${includedir}/${APP_NAME_LC}" +AC_SUBST(APP_PREFIX) +AC_SUBST(APP_LIB_DIR) +AC_SUBST(APP_INCLUDE_DIR) # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding # .dummy.am does nothing. diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index 070c7c7532..54f73d0c20 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt @@ -101,12 +101,14 @@ if(ADDON_SRC_PREFIX) message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") endif() -if(NOT KODI_LIB_DIR) - set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") +if(NOT APP_LIB_DIR) + set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi") else() - file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR) + file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR) endif() +set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}") + # check for platform specific stuff if(EXISTS ${PLATFORM_DIR}/defines.txt) file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) @@ -130,10 +132,10 @@ endif() ### prepare the build environment for the binary addons # copy the prepare-env.cmake script to the depends path so that we can include it -file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR}) +file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR}) # add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found -list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR}) +list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR}) # include prepare-env.cmake which contains the logic to install the addon header bindings etc include(prepare-env) diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in index bd7065c009..76626ec123 100644 --- a/project/cmake/kodi-config.cmake.in +++ b/project/cmake/kodi-config.cmake.in @@ -1,11 +1,15 @@ -SET(KODI_INCLUDE_DIR @prefix@/include) SET(APP_NAME @APP_NAME@) +SET(APP_NAME_LC @APP_NAME_LC@) +SET(APP_NAME_UC @APP_NAME_UC@) SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) +SET(@APP_NAME_UC@_PREFIX @APP_PREFIX@) +SET(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@) +SET(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@) IF(NOT WIN32) SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") ENDIF() -LIST(APPEND CMAKE_MODULE_PATH @APP_LIBDIR@/@APP_NAME_LC@) +LIST(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@) ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) include(addon-helpers) diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake index fa42b4b184..c44266ca19 100644 --- a/project/cmake/scripts/common/addon-helpers.cmake +++ b/project/cmake/scripts/common/addon-helpers.cmake @@ -77,12 +77,22 @@ macro (build_addon target prefix libs) add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - include(UseMultiArch) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) + message(STATUS "setting install paths to match ${APP_NAME}: CMAKE_INSTALL_PREFIX: ${${APP_NAME_UC}_PREFIX}") + set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE) + set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE) + elseif(NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}" AND NOT OVERRIDE_PATHS) + message(FATAL_ERROR "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check") + else() + if(NOT CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}") + endif() + endif() else() - set(CMAKE_INSTALL_LIBDIR "lib") + set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}") endif() - INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/kodi/addons/${target}) - INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons) + INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) + INSTALL(DIRECTORY ${target} DESTINATION share/${APP_NAME_LC}/addons) ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) endmacro() diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake index a616ed8400..a4bd9089a8 100644 --- a/project/cmake/scripts/common/prepare-env.cmake +++ b/project/cmake/scripts/common/prepare-env.cmake @@ -13,6 +13,7 @@ if(EXISTS "${APP_ROOT}/version.txt") endif() endforeach() string(TOLOWER ${APP_NAME} APP_NAME_LC) + string(TOUPPER ${APP_NAME} APP_NAME_UC) endif() # bail if we can't parse versions @@ -22,14 +23,14 @@ endif() ### copy all the addon binding header files to include/kodi # make sure include/kodi exists and is empty -set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi) -if(NOT EXISTS "${KODI_LIB_DIR}/") - file(MAKE_DIRECTORY ${KODI_LIB_DIR}) +set(APP_LIB_DIR ${DEPENDS_PATH}/lib/${APP_NAME_LC}) +if(NOT EXISTS "${APP_LIB_DIR}/") + file(MAKE_DIRECTORY ${APP_LIB_DIR}) endif() -set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi) -if(NOT EXISTS "${KODI_INCLUDE_DIR}/") - file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR}) +set(APP_INCLUDE_DIR ${DEPENDS_PATH}/include/${APP_NAME_LC}) +if(NOT EXISTS "${APP_INCLUDE_DIR}/") + file(MAKE_DIRECTORY ${APP_INCLUDE_DIR}) endif() # we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc @@ -50,21 +51,13 @@ if(NOT WIN32) endif() endif() -# kodi-config.cmake.in (further down) expects "prefix" and "APP_LIBDIR" variables -get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE) -set(APP_LIBDIR "${prefix}/lib") - # generate the proper kodi-config.cmake file -configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY) +configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${APP_LIB_DIR}/kodi-config.cmake @ONLY) # copy cmake helpers to lib/kodi file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake - DESTINATION ${KODI_LIB_DIR}) - -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - file(COPY ${APP_ROOT}/project/cmake/scripts/linux/UseMultiArch.cmake DESTINATION ${KODI_LIB_DIR}) -endif() + DESTINATION ${APP_LIB_DIR}) # generate xbmc-config.cmake for backwards compatibility to xbmc configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) @@ -78,7 +71,7 @@ foreach(binding ${bindings}) string(REPLACE "+=" ";" binding "${binding}") list(GET binding 1 header) # copy the header file to include/kodi - file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR}) + file(COPY ${APP_ROOT}/${header} DESTINATION ${APP_INCLUDE_DIR}) # auto-generate header files for backwards compatibility to xbmc with deprecation warning # but only do it if the file doesn't already exist diff --git a/project/cmake/scripts/linux/UseMultiArch.cmake b/project/cmake/scripts/linux/UseMultiArch.cmake deleted file mode 100644 index ce6b3e3b28..0000000000 --- a/project/cmake/scripts/linux/UseMultiArch.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Multiarch support in object code library directories -# -# This module sets the following variable -# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu -# depending on the platform; use this path -# for platform-specific binaries. -# -# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform; -# use this path for architecture-independent -# files. -# -# Note that it will override the results of GNUInstallDirs if included after -# that module. - -# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu; -# Fedora put module files in lib64/ too, but Debian uses lib/ for that -if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND - "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND - NOT "${CORE_SYSTEM_NAME}" STREQUAL "android") - # Debian or Ubuntu? - if (EXISTS "/etc/debian_version") - set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}") - set (_libdir_noarch "lib") - else (EXISTS "/etc/debian_version") - # 64-bit system? - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_noarch "lib64") - else (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_noarch "lib") - endif (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_def "${_libdir_noarch}") - endif (EXISTS "/etc/debian_version") -else () - set (_libdir_def "lib") - set (_libdir_noarch "lib") -endif () - -# let the user override if somewhere else is desirable -set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries") -set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files") -mark_as_advanced ( - CMAKE_INSTALL_LIBDIR - CMAKE_INSTALL_LIBDIR_NOARCH - ) |