aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2015-04-26 11:37:35 +0200
committerMartijn Kaijser <martijn@xbmc.org>2015-04-26 11:37:35 +0200
commit008d4637abc035f14d96019098c09e299d9c15d4 (patch)
tree1a6a03b0383457e5407478902fb849217de5fb61 /project
parent81d04596960e28918f0360f25073cc5f4d2ddf54 (diff)
parent0e243bc650551cc8f9892fd38ba4f60f7ce5b103 (diff)
Merge pull request #6897 from wsnipex/kodi-config
[binary addons] use correct library install paths on different linux distros
Diffstat (limited to 'project')
-rw-r--r--project/cmake/kodi-config.cmake.in2
-rw-r--r--project/cmake/scripts/common/addon-helpers.cmake7
-rw-r--r--project/cmake/scripts/common/prepare-env.cmake13
-rw-r--r--project/cmake/scripts/linux/UseMultiArch.cmake44
4 files changed, 62 insertions, 4 deletions
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in
index 118d723cab..bd7065c009 100644
--- a/project/cmake/kodi-config.cmake.in
+++ b/project/cmake/kodi-config.cmake.in
@@ -5,7 +5,7 @@ SET(APP_VERSION_MINOR @APP_VERSION_MINOR@)
IF(NOT WIN32)
SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
ENDIF()
-LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi)
+LIST(APPEND CMAKE_MODULE_PATH @APP_LIBDIR@/@APP_NAME_LC@)
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 b94df2aebd..fa42b4b184 100644
--- a/project/cmake/scripts/common/addon-helpers.cmake
+++ b/project/cmake/scripts/common/addon-helpers.cmake
@@ -76,7 +76,12 @@ macro (build_addon target prefix libs)
ENDIF(WIN32)
add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
- INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target})
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ include(UseMultiArch)
+ else()
+ set(CMAKE_INSTALL_LIBDIR "lib")
+ endif()
+ INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/kodi/addons/${target})
INSTALL(DIRECTORY ${target} DESTINATION share/kodi/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 3413c4519f..a616ed8400 100644
--- a/project/cmake/scripts/common/prepare-env.cmake
+++ b/project/cmake/scripts/common/prepare-env.cmake
@@ -12,6 +12,7 @@ if(EXISTS "${APP_ROOT}/version.txt")
set(${name} "${value}")
endif()
endforeach()
+ string(TOLOWER ${APP_NAME} APP_NAME_LC)
endif()
# bail if we can't parse versions
@@ -49,13 +50,21 @@ if(NOT WIN32)
endif()
endif()
-# kodi-config.cmake.in (further down) expects a "prefix" variable
+# 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)
+
# 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})
+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()
# 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)
diff --git a/project/cmake/scripts/linux/UseMultiArch.cmake b/project/cmake/scripts/linux/UseMultiArch.cmake
new file mode 100644
index 0000000000..ce6b3e3b28
--- /dev/null
+++ b/project/cmake/scripts/linux/UseMultiArch.cmake
@@ -0,0 +1,44 @@
+# - 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
+ )