aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2022-06-22 14:00:02 +1000
committerfuzzard <fuzzard@kodi.tv>2022-06-27 11:03:51 +1000
commite3e6e7a1e42fc773cb6e6530cedd3ca3e8e78630 (patch)
tree3590e5cac03362b2b668df08c79f1e8ec570a590
parent59a9c66c185a25784e777111543b500fa3dabdb0 (diff)
[cmake] Split libdvd findmodules
-rw-r--r--cmake/modules/FindLibDvd.cmake284
-rw-r--r--cmake/modules/FindLibDvdCSS.cmake119
-rw-r--r--cmake/modules/FindLibDvdNav.cmake143
-rw-r--r--cmake/modules/FindLibDvdRead.cmake151
-rw-r--r--tools/depends/target/Makefile5
-rw-r--r--tools/depends/target/libdvdcss/LIBDVDCSS-VERSION2
-rw-r--r--tools/depends/target/libdvdnav/LIBDVDNAV-VERSION2
-rw-r--r--tools/depends/target/libdvdread/LIBDVDREAD-VERSION2
8 files changed, 443 insertions, 265 deletions
diff --git a/cmake/modules/FindLibDvd.cmake b/cmake/modules/FindLibDvd.cmake
index 8b579bbf6a..aa1d12c301 100644
--- a/cmake/modules/FindLibDvd.cmake
+++ b/cmake/modules/FindLibDvd.cmake
@@ -1,268 +1,32 @@
-# Generic externaproject_add call for windows platforms
-function(windows_externalprojectadd module_name)
- string(TOUPPER ${module_name} DVDLIB)
- string(PREPEND DVDLIB "LIB")
- ExternalProject_Add(${module_name}
- URL ${${DVDLIB}_URL}
- URL_HASH ${${DVDLIB}_HASH}
- DOWNLOAD_DIR ${TARBALL_DIR}
- DOWNLOAD_NAME ${${DVDLIB}_ARCHIVE}
- CMAKE_ARGS
- ${LIBDVD_ADDITIONAL_ARGS}
- -DCMAKE_PREFIX_PATH:PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd
- -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd
- )
-endfunction()
-# Generic autoreconf step
-function(addstep_autoreconf module_name)
- ExternalProject_Add_Step(${module_name} autoreconf
- DEPENDEES download update patch
- DEPENDERS configure
- COMMAND ${CMAKE_COMMAND} -E env PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
- WORKING_DIRECTORY <SOURCE_DIR>)
-endfunction()
+# Check for existing LIBDVDREAD.
+# Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+set(FPHSA_NAME_MISMATCHED 1)
+find_package(LibDvdNav MODULE REQUIRED)
+unset(FPHSA_NAME_MISMATCHED)
-if(KODI_DEPENDSBUILD)
- set(_dvdlibs dvdread dvdnav)
- set(_handlevars LIBDVD_INCLUDE_DIRS DVDREAD_LIBRARY DVDNAV_LIBRARY)
- if(ENABLE_DVDCSS)
- list(APPEND _dvdlibs libdvdcss)
- list(APPEND _handlevars DVDCSS_LIBRARY)
- endif()
-
- if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_DVD ${_dvdlibs} QUIET)
- endif()
-
- find_path(LIBDVD_INCLUDE_DIRS dvdnav/dvdnav.h PATHS ${PC_DVD_INCLUDE_DIRS})
- find_library(DVDREAD_LIBRARY NAMES dvdread libdvdread PATHS ${PC_DVD_dvdread_LIBDIR})
- find_library(DVDNAV_LIBRARY NAMES dvdnav libdvdnav PATHS ${PC_DVD_dvdnav_LIBDIR})
- if(ENABLE_DVDCSS)
- find_library(DVDCSS_LIBRARY NAMES dvdcss libdvdcss PATHS ${PC_DVD_libdvdcss_LIBDIR})
- endif()
+set(_dvdlibs ${LIBDVDREAD_LIBRARY} ${LIBDVDCSS_LIBRARY})
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(LibDvd REQUIRED_VARS ${_handlevars})
- if(LIBDVD_FOUND)
- add_library(dvdnav UNKNOWN IMPORTED)
- set_target_properties(dvdnav PROPERTIES
- FOLDER "External Projects"
- IMPORTED_LOCATION "${DVDNAV_LIBRARY}")
-
- add_library(dvdread UNKNOWN IMPORTED)
- set_target_properties(dvdread PROPERTIES
- FOLDER "External Projects"
- IMPORTED_LOCATION "${DVDREAD_LIBRARY}")
- add_library(dvdcss UNKNOWN IMPORTED)
- set_target_properties(dvdcss PROPERTIES
- FOLDER "External Projects"
- IMPORTED_LOCATION "${DVDCSS_LIBRARY}")
-
- set(_linklibs ${DVDREAD_LIBRARY})
- if(ENABLE_DVDCSS)
- list(APPEND _linklibs ${DVDCSS_LIBRARY})
- endif()
- core_link_library(${DVDNAV_LIBRARY} system/players/VideoPlayer/libdvdnav dvdnav archives "${_linklibs}")
- set(LIBDVD_LIBRARIES ${DVDNAV_LIBRARY})
- mark_as_advanced(LIBDVD_INCLUDE_DIRS LIBDVD_LIBRARIES)
- endif()
+if(NOT CORE_SYSTEM_NAME MATCHES windows)
+ # link a shared dvdnav library that includes the whole archives of dvdread and dvdcss as well
+ # the quotes around _dvdlibs are on purpose, since we want to pass a list to the function that will be unpacked automatically
+ core_link_library(LibDvdNav::LibDvdNav system/players/VideoPlayer/libdvdnav libdvdnav archives "${_dvdlibs}")
else()
- include(cmake/scripts/common/ModuleHelpers.cmake)
-
- set(dvdlibs libdvdread libdvdnav)
- if(ENABLE_DVDCSS)
- list(APPEND dvdlibs libdvdcss)
- endif()
-
- foreach(dvdlib ${dvdlibs})
-
- # Set variables normally set in SETUP_BUILD_VARS macro
- set(LIB_TYPE "target")
- set(PROJECTSOURCE ${CMAKE_SOURCE_DIR})
- set(DEP_LOCATION "${DEPENDS_PATH}")
-
- string(TOUPPER ${dvdlib} MODULE)
-
- # Variables required being set for clean get_versionfile_data use
- set(MODULE_LC ${dvdlib})
-
- get_versionfile_data()
-
- # allow user to override the download URL with a local tarball
- # needed for offline build envs
- # allow upper and lowercase var name
- if(${dvdlib}_URL)
- set(${MODULE}_URL ${${dvdlib}_URL})
- endif()
- if(${MODULE}_URL)
- get_filename_component(${MODULE}_URL "${${MODULE}_URL}" ABSOLUTE)
- else()
- # github tarball format is tagname.tar.gz where tagname is VERSION in lib VERSION file
- set(${MODULE}_URL ${${MODULE}_BASE_URL}/archive/${${MODULE}_VER}.tar.gz)
- endif()
- if(VERBOSE)
- message(STATUS "${MODULE}_URL: ${${MODULE}_URL}")
- endif()
-
- # clear any potentially set variables
- CLEAR_BUILD_VARS()
- endforeach()
-
- set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
-
- if(APPLE)
- string(APPEND CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation")
- if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
- string(APPEND CMAKE_EXE_LINKER_FLAGS " -framework IOKit")
- endif()
- endif()
-
- set(HOST_ARCH ${ARCH})
- if(CORE_SYSTEM_NAME STREQUAL android)
- if(ARCH STREQUAL arm)
- set(HOST_ARCH arm-linux-androideabi)
- elseif(ARCH STREQUAL aarch64)
- set(HOST_ARCH aarch64-linux-android)
- elseif(ARCH STREQUAL i486-linux)
- set(HOST_ARCH i686-linux-android)
- elseif(ARCH STREQUAL x86_64)
- set(HOST_ARCH x86_64-linux-android)
- endif()
- elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
- set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
- endif()
-
- set(MAKE_COMMAND $(MAKE))
- if(CMAKE_GENERATOR STREQUAL Ninja)
- set(MAKE_COMMAND make)
- include(ProcessorCount)
- ProcessorCount(N)
- if(NOT N EQUAL 0)
- set(MAKE_COMMAND make -j${N})
- endif()
- endif()
-
- if(ENABLE_DVDCSS)
- if(NOT CORE_SYSTEM_NAME MATCHES windows)
- set(DVDCSS_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a)
- ExternalProject_Add(dvdcss URL ${LIBDVDCSS_URL}
- URL_HASH ${LIBDVDCSS_HASH}
- DOWNLOAD_NAME ${LIBDVDCSS_ARCHIVE}
- DOWNLOAD_DIR ${TARBALL_DIR}
- PREFIX ${CORE_BUILD_DIR}/libdvd
- CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
- --target=${HOST_ARCH}
- --host=${HOST_ARCH}
- --disable-doc
- --enable-static
- --disable-shared
- --with-pic
- --prefix=<INSTALL_DIR>
- --libdir=<INSTALL_DIR>/lib
- "CC=${CMAKE_C_COMPILER}"
- "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
- "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}"
- BUILD_COMMAND ${MAKE_COMMAND}
- BUILD_BYPRODUCTS ${DVDCSS_LIBRARY})
- addstep_autoreconf("dvdcss")
- else()
- windows_externalprojectadd("dvdcss")
- endif()
- set_target_properties(dvdcss PROPERTIES FOLDER "External Projects")
- endif()
-
- set(DVDREAD_CFLAGS "-D_XBMC -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
- if(ENABLE_DVDCSS)
- set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H")
- endif()
-
- if(NOT CORE_SYSTEM_NAME MATCHES windows)
- set(DVDREAD_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a)
- ExternalProject_Add(dvdread URL ${LIBDVDREAD_URL}
- URL_HASH ${LIBDVDREAD_HASH}
- DOWNLOAD_NAME ${LIBDVDREAD_ARCHIVE}
- DOWNLOAD_DIR ${TARBALL_DIR}
- PREFIX ${CORE_BUILD_DIR}/libdvd
- CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
- --target=${HOST_ARCH}
- --host=${HOST_ARCH}
- --enable-static
- --disable-shared
- --with-pic
- --prefix=<INSTALL_DIR>
- --libdir=<INSTALL_DIR>/lib
- "CC=${CMAKE_C_COMPILER}"
- "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
- "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}"
- BUILD_COMMAND ${MAKE_COMMAND}
- BUILD_BYPRODUCTS ${DVDREAD_LIBRARY})
- addstep_autoreconf("dvdread")
- else()
- windows_externalprojectadd("dvdread")
- endif()
- if(ENABLE_DVDCSS)
- add_dependencies(dvdread dvdcss)
- endif()
-
- set_target_properties(dvdread PROPERTIES FOLDER "External Projects")
-
- if(ENABLE_DVDCSS)
- set(DVDNAV_LIBS -ldvdcss)
- endif()
-
- if(NOT CORE_SYSTEM_NAME MATCHES windows)
- set(DVDNAV_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a)
- ExternalProject_Add(dvdnav URL ${LIBDVDNAV_URL}
- URL_HASH ${LIBDVDNAV_HASH}
- DOWNLOAD_NAME ${LIBDVDNAV_ARCHIVE}
- DOWNLOAD_DIR ${TARBALL_DIR}
- PREFIX ${CORE_BUILD_DIR}/libdvd
- CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
- --target=${HOST_ARCH}
- --host=${HOST_ARCH}
- --enable-static
- --disable-shared
- --with-pic
- --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd
- --libdir=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib
- "CC=${CMAKE_C_COMPILER}"
- "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib"
- "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
- "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}"
- "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la"
- "LIBS=${DVDNAV_LIBS}"
- BUILD_COMMAND ${MAKE_COMMAND}
- BUILD_BYPRODUCTS ${DVDNAV_LIBRARY})
- addstep_autoreconf("dvdnav")
- else()
- set(DVDNAV_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.lib)
- windows_externalprojectadd("dvdnav")
- endif()
- add_dependencies(dvdnav dvdread)
- set_target_properties(dvdnav PROPERTIES FOLDER "External Projects")
-
- set(_dvdlibs ${DVDREAD_LIBRARY} ${DVDCSS_LIBRARY})
- if(NOT CORE_SYSTEM_NAME MATCHES windows)
- # link a shared dvdnav library that includes the whole archives of dvdread and dvdcss as well
- # the quotes around _dvdlibs are on purpose, since we want to pass a list to the function that will be unpacked automatically
- core_link_library(${DVDNAV_LIBRARY} system/players/VideoPlayer/libdvdnav dvdnav archives "${_dvdlibs}")
- else()
- set(LIBDVD_TARGET_DIR .)
- if(CORE_SYSTEM_NAME STREQUAL windowsstore)
- set(LIBDVD_TARGET_DIR dlls)
- endif()
- copy_file_to_buildtree(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/bin/libdvdnav.dll DIRECTORY ${LIBDVD_TARGET_DIR})
- add_dependencies(export-files dvdnav)
+ set(LIBDVD_TARGET_DIR .)
+ if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_TARGET_DIR dlls)
endif()
+ copy_file_to_buildtree(${DEPENDS_PATH}/bin/libdvdnav.dll DIRECTORY ${LIBDVD_TARGET_DIR})
+ add_dependencies(export-files LibDvdNav::LibDvdNav)
+endif()
- set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include)
- set(LIBDVD_LIBRARIES ${DVDNAV_LIBRARY} ${DVDREAD_LIBRARY})
- if(ENABLE_DVDCSS)
- list(APPEND LIBDVD_LIBRARIES ${DVDCSS_LIBRARY})
- endif()
- set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE)
- set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE)
+set(LIBDVD_INCLUDE_DIRS ${LIBDVDREAD_INCLUDE_DIR} ${LIBDVDNAV_INCLUDE_DIR})
+set(LIBDVD_LIBRARIES ${LIBDVDNAV_LIBRARY} ${LIBDVDREAD_LIBRARY})
+if(TARGET LibDvdCSS::LibDvdCSS)
+ list(APPEND LIBDVD_LIBRARIES ${LIBDVDCSS_LIBRARY})
+ list(APPEND LIBDVD_INCLUDE_DIRS ${LIBDVDCSS_INCLUDE_DIR})
endif()
+set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE)
+set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE)
-set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP dvdnav)
+mark_as_advanced(LIBDVD_INCLUDE_DIRS LIBDVD_LIBRARIES)
diff --git a/cmake/modules/FindLibDvdCSS.cmake b/cmake/modules/FindLibDvdCSS.cmake
new file mode 100644
index 0000000000..494e49d831
--- /dev/null
+++ b/cmake/modules/FindLibDvdCSS.cmake
@@ -0,0 +1,119 @@
+#.rst:
+# FindLibDvdCSS
+# ----------
+# Finds the libdvdcss library
+#
+# This will define the following variables::
+#
+# LIBDVDCSS_FOUND - system has LibDvdCSS
+# LIBDVDCSS_INCLUDE_DIRS - the LibDvdCSS include directory
+# LIBDVDCSS_LIBRARIES - the LibDvdCSS libraries
+#
+# and the following imported targets::
+#
+# LibDvdCSS::LibDvdCSS - The LibDvdCSS library
+
+if(ENABLE_DVDCSS)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdcss)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDCSS_URL or libdvdcss_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDCSS_URL OR ${MODULE_LC}_URL)
+ set(LIBDVDCSS_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDCSS_URL_PROVIDED)
+ # override LIBDVDCSS_URL_PROVIDED due to tar naming when retrieved from github release
+ set(LIBDVDCSS_URL ${LIBDVDCSS_BASE_URL}/archive/${LIBDVDCSS_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDCSS_VERSION ${${MODULE}_VER})
+
+ set(HOST_ARCH ${ARCH})
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ if(ARCH STREQUAL arm)
+ set(HOST_ARCH arm-linux-androideabi)
+ elseif(ARCH STREQUAL aarch64)
+ set(HOST_ARCH aarch64-linux-android)
+ elseif(ARCH STREQUAL i486-linux)
+ set(HOST_ARCH i686-linux-android)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ if(APPLE)
+ set(LIBDVDCSS_FLAGS " -framework CoreFoundation")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDCSS_FLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --disable-doc
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDCSS_FLAGS}")
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdCSS)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdCSS
+ REQUIRED_VARS LIBDVDCSS_LIBRARY LIBDVDCSS_INCLUDE_DIR
+ VERSION_VAR LIBDVDCSS_VERSION)
+
+if(LIBDVDCSS_FOUND)
+ set(LIBDVDCSS_INCLUDE_DIRS ${LIBDVDCSS_INCLUDE_DIR})
+ set(LIBDVDCSS_LIBRARIES ${LIBDVDCSS_LIBRARY})
+ set(LIBDVDCSS_DEFINITIONS -DHAVE_DVDCSS_DVDCSS_H)
+
+ if(NOT TARGET LibDvdCSS::LibDvdCSS)
+ add_library(LibDvdCSS::LibDvdCSS UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdCSS::LibDvdCSS PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDCSS_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDCSS_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDCSS_INCLUDE_DIR}")
+
+ if(TARGET libdvdcss)
+ add_dependencies(LibDvdCSS::LibDvdCSS libdvdcss)
+ endif()
+ endif()
+
+else()
+ if(LIBDVDCSS_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdcss not found. Possibly remove ENABLE_DVDCSS.")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDCSS_INCLUDE_DIR LIBDVDCSS_LIBRARY)
diff --git a/cmake/modules/FindLibDvdNav.cmake b/cmake/modules/FindLibDvdNav.cmake
new file mode 100644
index 0000000000..0bdf8a7bab
--- /dev/null
+++ b/cmake/modules/FindLibDvdNav.cmake
@@ -0,0 +1,143 @@
+#.rst:
+# FindLibDvdNav
+# ----------
+# Finds the dvdnav library
+#
+# This will define the following variables::
+#
+# LIBDVDNAV_FOUND - system has LibDvdNav
+# LIBDVDNAV_INCLUDE_DIRS - the LibDvdNav include directory
+# LIBDVDNAV_LIBRARIES - the LibDvdNav libraries
+#
+# and the following imported targets::
+#
+# LibDvdNav::LibDvdNav - The LibDvdNav library
+
+if(NOT TARGET LibDvdNav::LibDvdNav)
+
+ # Check for existing LibDvdRead.
+ # Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+ set(FPHSA_NAME_MISMATCHED 1)
+ find_package(LibDvdRead MODULE REQUIRED)
+ unset(FPHSA_NAME_MISMATCHED)
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdnav)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDNAV_URL or libdvdnav_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDNAV_URL OR ${MODULE_LC}_URL)
+ set(LIBDVDNAV_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDNAV_URL_PROVIDED)
+ # override LIBDVDNAV_URL due to tar naming when retrieved from github release
+ set(LIBDVDNAV_URL ${LIBDVDNAV_BASE_URL}/archive/${LIBDVDNAV_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDNAV_VERSION ${${MODULE}_VER})
+
+ set(HOST_ARCH ${ARCH})
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ if(ARCH STREQUAL arm)
+ set(HOST_ARCH arm-linux-androideabi)
+ elseif(ARCH STREQUAL aarch64)
+ set(HOST_ARCH aarch64-linux-android)
+ elseif(ARCH STREQUAL i486-linux)
+ set(HOST_ARCH i686-linux-android)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ string(APPEND LIBDVDNAV_CFLAGS "-D_XBMC")
+
+ if(APPLE)
+ set(LIBDVDNAV_LDFLAGS "-framework CoreFoundation")
+ string(APPEND LIBDVDNAV_CFLAGS " -D__DARWIN__")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDNAV_LDFLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+
+ string(APPEND LIBDVDNAV_CFLAGS " -I$<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_COMPILE_DEFINITIONS>")
+
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${LIBDVDNAV_CFLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDNAV_LDFLAGS}"
+ "PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig")
+
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+ if(TARGET LibDvdRead::LibDvdRead)
+ add_dependencies(libdvdnav LibDvdRead::LibDvdRead)
+ endif()
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdNav)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdNav
+ REQUIRED_VARS LIBDVDNAV_LIBRARY LIBDVDNAV_INCLUDE_DIR
+ VERSION_VAR LIBDVDNAV_VERSION)
+
+if(LIBDVDNAV_FOUND)
+ set(LIBDVDNAV_INCLUDE_DIRS ${LIBDVDNAV_INCLUDE_DIR})
+ set(LIBDVDNAV_LIBRARIES ${LIBDVDNAV_LIBRARY})
+ set(LIBDVDNAV_DEFINITIONS -D_XBMC)
+
+ if(APPLE)
+ string(APPEND LIBDVDNAV_DEFINITIONS " -D__DARWIN__")
+ endif()
+
+ if(NOT TARGET LibDvdNav::LibDvdNav)
+ add_library(LibDvdNav::LibDvdNav UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdNav::LibDvdNav PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDNAV_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDNAV_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDNAV_INCLUDE_DIR}")
+
+ if(TARGET libdvdnav)
+ add_dependencies(LibDvdNav::LibDvdNav libdvdnav)
+ endif()
+ if(TARGET LibDvdRead::LibDvdRead)
+ add_dependencies(LibDvdNav::LibDvdNav LibDvdRead::LibDvdRead)
+ endif()
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP LibDvdNav::LibDvdNav)
+else()
+ if(LIBDVDNAV_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdnav not found")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDNAV_INCLUDE_DIR LIBDVDNAV_LIBRARY)
diff --git a/cmake/modules/FindLibDvdRead.cmake b/cmake/modules/FindLibDvdRead.cmake
new file mode 100644
index 0000000000..3ac199be90
--- /dev/null
+++ b/cmake/modules/FindLibDvdRead.cmake
@@ -0,0 +1,151 @@
+#.rst:
+# FindLibDvdRead
+# ----------
+# Finds the dvdread library
+#
+# This will define the following variables::
+#
+# LIBDVDREAD_FOUND - system has LibDvdRead
+# LIBDVDREAD_INCLUDE_DIRS - the LibDvdRead include directory
+# LIBDVDREAD_LIBRARIES - the LibDvdRead libraries
+#
+# and the following imported targets::
+#
+# LibDvdRead::LibDvdRead - The LibDvdRead library
+
+if(NOT TARGET LibDvdRead::LibDvdRead)
+
+ if(ENABLE_DVDCSS)
+ # Check for existing LIBDVDCSS.
+ # Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+ set(FPHSA_NAME_MISMATCHED 1)
+ find_package(LibDvdCSS MODULE REQUIRED)
+ unset(FPHSA_NAME_MISMATCHED)
+ endif()
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdread)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDREAD_URL or libdvdread_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDREAD_URL OR ${MODULE_LC}_URL)
+ set(LIBDVDREAD_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDREAD_URL_PROVIDED)
+ # override LIBDVDREAD_URL due to tar naming when retrieved from github release
+ set(LIBDVDREAD_URL ${LIBDVDREAD_BASE_URL}/archive/${LIBDVDREAD_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDREAD_VERSION ${${MODULE}_VER})
+
+ set(HOST_ARCH ${ARCH})
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ if(ARCH STREQUAL arm)
+ set(HOST_ARCH arm-linux-androideabi)
+ elseif(ARCH STREQUAL aarch64)
+ set(HOST_ARCH aarch64-linux-android)
+ elseif(ARCH STREQUAL i486-linux)
+ set(HOST_ARCH i686-linux-android)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ string(APPEND LIBDVDREAD_CFLAGS "-D_XBMC")
+
+ if(APPLE)
+ set(LIBDVDREAD_LDFLAGS "-framework CoreFoundation")
+ string(APPEND LIBDVDREAD_CFLAGS " -D__DARWIN__")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDREAD_LDFLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ string(APPEND LIBDVDREAD_CFLAGS " -I$<TARGET_PROPERTY:LibDvdCSS::LibDvdCSS,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:LibDvdCSS::LibDvdCSS,INTERFACE_COMPILE_DEFINITIONS>")
+ string(APPEND with-css "--with-libdvdcss")
+ endif()
+
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ ${with-css}
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${LIBDVDREAD_CFLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDREAD_LDFLAGS}"
+ "PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig")
+
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ add_dependencies(libdvdread LibDvdCSS::LibDvdCSS)
+ endif()
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdRead)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdRead
+ REQUIRED_VARS LIBDVDREAD_LIBRARY LIBDVDREAD_INCLUDE_DIR
+ VERSION_VAR LIBDVDREAD_VERSION)
+
+if(LIBDVDREAD_FOUND)
+ set(LIBDVDREAD_INCLUDE_DIRS ${LIBDVDREAD_INCLUDE_DIR})
+ set(LIBDVDREAD_LIBRARIES ${LIBDVDREAD_LIBRARY})
+ set(LIBDVDREAD_DEFINITIONS -D_XBMC)
+
+ if(APPLE)
+ string(APPEND LIBDVDREAD_DEFINITIONS " -D__DARWIN__")
+ endif()
+
+ if(NOT TARGET LibDvdRead::LibDvdRead)
+ add_library(LibDvdRead::LibDvdRead UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdRead::LibDvdRead PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDREAD_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDREAD_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDREAD_INCLUDE_DIR}")
+
+ if(TARGET libdvdread)
+ add_dependencies(LibDvdRead::LibDvdRead libdvdread)
+ endif()
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ add_dependencies(LibDvdRead::LibDvdRead LibDvdCSS::LibDvdCSS)
+ set_target_properties(LibDvdRead::LibDvdRead PROPERTIES
+ INTERFACE_LINK_LIBRARIES "-ldvdcss")
+ endif()
+ endif()
+
+else()
+ if(LIBDVDREAD_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdread not found")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDREAD_INCLUDE_DIR LIBDVDREAD_LIBRARY)
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
index 274355d8bb..e553292002 100644
--- a/tools/depends/target/Makefile
+++ b/tools/depends/target/Makefile
@@ -25,9 +25,6 @@ DEPENDS = \
libass \
libbluray \
libcec \
- libdvdcss \
- libdvdnav \
- libdvdread \
libffi \
libgcrypt \
libgpg-error \
@@ -147,8 +144,6 @@ libcdio-gplv3: $(ICONV)
libcdio: $(ICONV)
libcec: p8-platform
libdrm: meson-cross-file
-libdvdnav: libdvdread
-libdvdread: libdvdcss
libevdev: libudev
libgcrypt: libgpg-error
libinput: mtdev libevdev meson-cross-file
diff --git a/tools/depends/target/libdvdcss/LIBDVDCSS-VERSION b/tools/depends/target/libdvdcss/LIBDVDCSS-VERSION
index 828821cd19..d1be5a2103 100644
--- a/tools/depends/target/libdvdcss/LIBDVDCSS-VERSION
+++ b/tools/depends/target/libdvdcss/LIBDVDCSS-VERSION
@@ -3,3 +3,5 @@ BASE_URL=https://github.com/xbmc/libdvdcss
VERSION=1.4.3-Next-Nexus-Alpha2
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
SHA512=a8cc334036888599feaafc7e563ca079a22e52ca3d0a5f5579571f95fe27d22778f390c86b72912a1bacb0ea6b8a6008ff9d47b32383e3eac810e6ba92e8dea1
+BYPRODUCT=libdvdcss.a
+BYPRODUCT_WIN=dvdcss.lib
diff --git a/tools/depends/target/libdvdnav/LIBDVDNAV-VERSION b/tools/depends/target/libdvdnav/LIBDVDNAV-VERSION
index 403f567d56..9e76f175cf 100644
--- a/tools/depends/target/libdvdnav/LIBDVDNAV-VERSION
+++ b/tools/depends/target/libdvdnav/LIBDVDNAV-VERSION
@@ -3,3 +3,5 @@ BASE_URL=https://github.com/xbmc/libdvdnav
VERSION=6.1.1-Next-Nexus-Alpha2
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
SHA512=01c415a561ea8bd9d568ad2668fbf8bc54304557e413776e1b841145cad3f7b9991a6772af7bac408b2cb87c6236c378e79c1c023a58b280a6c92fee151f0fb1
+BYPRODUCT=libdvdnav.a
+BYPRODUCT_WIN=libdvdnav.lib
diff --git a/tools/depends/target/libdvdread/LIBDVDREAD-VERSION b/tools/depends/target/libdvdread/LIBDVDREAD-VERSION
index f998aec2f5..62c398ce4e 100644
--- a/tools/depends/target/libdvdread/LIBDVDREAD-VERSION
+++ b/tools/depends/target/libdvdread/LIBDVDREAD-VERSION
@@ -3,3 +3,5 @@ BASE_URL=https://github.com/xbmc/libdvdread
VERSION=6.1.3-Next-Nexus-Alpha2
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
SHA512=f96e365ac6788c538b5ed54c5330ef8625962e77c27098b5cbd21332fed5cbafd422f2a997499bc17aa814849fa44b131942278547207e6611a491b0ee05b91a
+BYPRODUCT=libdvdread.a
+BYPRODUCT_WIN=dvdread.lib