Source: ddnet Version: 16.4-1.3 Tags: patch upstream User: debian-cr...@lists.debian.org Usertags: ftcbfs
Hi, ddnet fails to cross build from source. Digging into this I found that ddnet upstream has a very different idea about cross building from Debian. For instance, ddnet stops using any kind of system libraries and expects that you vendor them all into the ddnet source code. Also they immediately opt out of using pkgconf for cross compilation. This is very much not what we do in Debian. I managed to make it cross buildable, but given how ddnet upstream has chosen to implement cross building, I expect that they very much won't like this patch. Possibly, there could be some kind of global switch between that vendoring-world that they want and that "like native" world that Debian's cross build environment is? Do you mind maintaining this patch in the source package? Helmut
--- ddnet-16.4.orig/CMakeLists.txt +++ ddnet-16.4/CMakeLists.txt @@ -493,7 +493,7 @@ # be more aggressive with android toolchain set(CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) else() - set(CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH NO_CMAKE_SYSTEM_PATH) + set(CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH) endif() else() set(CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH) @@ -512,11 +512,9 @@ endif() endfunction() -if(NOT CMAKE_CROSSCOMPILING) - # Check for PkgConfig once so all the other `find_package` calls can do it - # quietly. - find_package(PkgConfig) -endif() +# Check for PkgConfig once so all the other `find_package` calls can do it +# quietly. +find_package(PkgConfig) if(TARGET_OS STREQUAL "android") find_package(Android) endif() --- ddnet-16.4.orig/cmake/FindMySQL.cmake +++ ddnet-16.4/cmake/FindMySQL.cmake @@ -1,3 +1,7 @@ +find_package(PkgConfig QUIET) +pkg_check_modules(MYSQLCLIENT mysqlclient) +pkg_check_modules(LIBMARIADB libmariadb) + if(NOT CMAKE_CROSSCOMPILING) find_program(MYSQL_CONFIG NAMES mysql_config mariadb_config @@ -39,13 +43,13 @@ set_extra_dirs_lib(MYSQL mysql) find_library(MYSQL_LIBRARY NAMES "mysqlclient" "mysqlclient_r" "mariadbclient" - HINTS ${MYSQL_CONFIG_LIBRARY_PATH} + HINTS ${MYSQL_CONFIG_LIBRARY_PATH} ${MYSQLCLIENT_LIBRARY_DIRS} ${LIBMARIADB_LIBRARY_DIRS} ${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH} ) set_extra_dirs_include(MYSQL mysql "${MYSQL_LIBRARY}") find_path(MYSQL_INCLUDEDIR NAMES "mysql.h" - HINTS ${MYSQL_CONFIG_INCLUDE_DIR} + HINTS ${MYSQL_CONFIG_INCLUDE_DIR} ${MYSQLCLIENT_INCLUDE_DIRS} ${LIBMARIADB_INCLUDE_DIRS} ${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH} )