-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#11616) dbus/1.12.20: Use CMake to build D-Bus to fix cross-compiling
* dbus/1.12.20: Use CMake to build D-Bus to fix cross-compiling Currently, Autotools errors out when attempting to cross-compile D-Bus. However, D-Bus can be built with CMake by defining a simple variable. Using CMake, D-Bus is able to be cross-compiled successfully. This minimizes the complexity of the D-Bus Conanfile by using 1 build system. D-Bus has better support for CMake in newer versions. This should lead to reduced maintenance overhead in the future, too. * Add CMake wrapper * Revert "Add CMake wrapper" This reverts commit 49ace14. * Patch as necessary to support CMake wrapper * Fix credentials detection on FreeBSD * Patch missing semicolon in CMake code to fix FreeBSD error * Use existing upstream patch for FreeBSD compilation issue * Use ConanFile from conans in attempt to fix Visual Studio builds * Revert "Use ConanFile from conans in attempt to fix Visual Studio builds" This reverts commit 549ddbc. * Use proper source directory for CMakeLists.txt * Update cmake_current-source_dir patch * Reduce path sizes for Windows * Add patch metadata * Make sure patch file can be applied
- Loading branch information
1 parent
2083d54
commit 84dd07c
Showing
6 changed files
with
196 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
|
||
include(../conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory("cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
recipes/dbus/1.x.x/patches/cmake_configure_checks_list_separator.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake | ||
index a9a5fc90..1a59461a 100644 | ||
--- a/cmake/ConfigureChecks.cmake | ||
+++ b/cmake/ConfigureChecks.cmake | ||
@@ -43,7 +43,7 @@ check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) # | ||
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c | ||
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c | ||
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c | ||
-check_symbol_exists(getpwnam_r "errno.h pwd.h" HAVE_POSIX_GETPWNAM_R) # dbus-sysdeps-util-unix.c | ||
+check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_POSIX_GETPWNAM_R) # dbus-sysdeps-util-unix.c | ||
check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) # dbus-sysdeps.c | ||
check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c | ||
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c | ||
@@ -66,7 +66,7 @@ check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT) | ||
check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT) | ||
check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT) | ||
|
||
-check_struct_member(cmsgcred cmcred_pid "sys/types.h sys/socket.h" HAVE_CMSGCRED) # dbus-sysdeps.c | ||
+check_struct_member(cmsgcred cmcred_pid "sys/types.h;sys/socket.h" HAVE_CMSGCRED) # dbus-sysdeps.c | ||
|
||
# missing: | ||
# DBUS_HAVE_GCC33_GCOV |
112 changes: 112 additions & 0 deletions
112
recipes/dbus/1.x.x/patches/cmake_current_source_dir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt | ||
index 3ac71a5a..9d203d5f 100644 | ||
--- a/cmake/CMakeLists.txt | ||
+++ b/cmake/CMakeLists.txt | ||
@@ -1,5 +1,5 @@ | ||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked | ||
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") | ||
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules") | ||
|
||
# we do not need to have WIN32 defined | ||
set(CMAKE_LEGACY_CYGWIN_WIN32 0) | ||
@@ -114,7 +114,7 @@ endif (CYGWIN) | ||
# search for required packages | ||
if (WIN32) | ||
# include local header first to avoid using old installed header | ||
- set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/..) | ||
+ set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${PROJECT_SOURCE_DIR}/..) | ||
find_package(LibIconv) | ||
include(Win32Macros) | ||
addExplorerWrapper(${CMAKE_PROJECT_NAME}) | ||
@@ -148,7 +148,7 @@ add_definitions(-D_GNU_SOURCE) | ||
INCLUDE(ConfigureChecks.cmake) | ||
|
||
# @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ? | ||
-SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..) | ||
+SET(DBUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
|
||
# make some more macros available | ||
include (MacroLibrary) | ||
@@ -281,7 +281,7 @@ endif (WIN32 OR CYGWIN) | ||
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) | ||
|
||
# for including config.h and for includes like <dir/foo.h> | ||
-include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} ) | ||
+include_directories( ${PROJECT_SOURCE_DIR}/.. ${PROJECT_BINARY_DIR} ${CMAKE_INCLUDE_PATH} ) | ||
|
||
# linker search directories | ||
link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} ) | ||
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt | ||
index 4c5bdcf2..5ac8454c 100644 | ||
--- a/cmake/bus/CMakeLists.txt | ||
+++ b/cmake/bus/CMakeLists.txt | ||
@@ -1,7 +1,7 @@ | ||
add_definitions(-DDBUS_COMPILATION) | ||
|
||
SET(EFENCE "") | ||
-SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus) | ||
+SET(BUS_DIR ${PROJECT_SOURCE_DIR}/../bus) | ||
|
||
# config files for installation | ||
CONFIGURE_FILE( "${BUS_DIR}/session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/session.conf" IMMEDIATE @ONLY) | ||
@@ -16,7 +16,7 @@ endif() | ||
|
||
# copy services for local daemon start to local service dir data/dbus-1/services | ||
SET (SERVICE_FILES test/data/valid-service-files) | ||
-FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" ) | ||
+FILE(GLOB FILES "${PROJECT_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" ) | ||
FOREACH(FILE ${FILES}) | ||
GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME_WE) | ||
SET (TARGET ${CMAKE_BINARY_DIR}/data/dbus-1/services/${FILENAME}.service) | ||
@@ -84,7 +84,7 @@ endif(DBUS_ENABLE_STATS) | ||
|
||
include_directories( | ||
${CMAKE_BINARY_DIR} | ||
- ${CMAKE_SOURCE_DIR}/.. | ||
+ ${PROJECT_SOURCE_DIR}/.. | ||
${EXPAT_INCLUDE_DIR} | ||
) | ||
|
||
diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt | ||
index 8a01d918..93e541a5 100644 | ||
--- a/cmake/dbus/CMakeLists.txt | ||
+++ b/cmake/dbus/CMakeLists.txt | ||
@@ -1,4 +1,4 @@ | ||
-SET(DBUS_DIR ${CMAKE_SOURCE_DIR}/../dbus) | ||
+SET(DBUS_DIR ${PROJECT_SOURCE_DIR}/../dbus) | ||
|
||
configure_file(${DBUS_DIR}/dbus-arch-deps.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-arch-deps.h ) | ||
|
||
@@ -98,7 +98,7 @@ set (DBUS_LIB_HEADERS | ||
${DBUS_DIR}/dbus-transport.h | ||
${DBUS_DIR}/dbus-transport-protected.h | ||
${DBUS_DIR}/dbus-watch.h | ||
- ${CMAKE_BINARY_DIR}/config.h | ||
+ ${PROJECT_BINARY_DIR}/config.h | ||
) | ||
if(UNIX) | ||
set (DBUS_LIB_HEADERS ${DBUS_LIB_HEADERS} | ||
@@ -330,7 +330,7 @@ else(WIN32) | ||
endif(WIN32) | ||
|
||
if (DBUS_ENABLE_EMBEDDED_TESTS) | ||
- add_test_executable(test-dbus ${CMAKE_SOURCE_DIR}/../dbus/dbus-test-main.c ${DBUS_INTERNAL_LIBRARIES}) | ||
+ add_test_executable(test-dbus ${PROJECT_SOURCE_DIR}/../dbus/dbus-test-main.c ${DBUS_INTERNAL_LIBRARIES}) | ||
set_target_properties(test-dbus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) | ||
ENDIF (DBUS_ENABLE_EMBEDDED_TESTS) | ||
|
||
diff --git a/cmake/modules/CPackInstallConfig.cmake b/cmake/modules/CPackInstallConfig.cmake | ||
index 46e8fb6d..e2331425 100644 | ||
--- a/cmake/modules/CPackInstallConfig.cmake | ||
+++ b/cmake/modules/CPackInstallConfig.cmake | ||
@@ -9,8 +9,8 @@ endif (DBUS_INSTALL_SYSTEM_LIBS) | ||
|
||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "D-BUS For Windows") | ||
SET(CPACK_PACKAGE_VENDOR "D-BUS Windows Team") | ||
-SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/../README") | ||
-SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../COPYING") | ||
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README") | ||
+SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../COPYING") | ||
# duplicated from VERSION | ||
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) | ||
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import cross_building | ||
from conans import CMake | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
generators = "cmake", "cmake_find_package_multi", "VirtualBuildEnv", "VirtualRunEnv" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
if not cross_building(self): | ||
self.run("dbus-monitor --help", run_environment=True) | ||
self.run(os.path.join("bin", "test_package"), run_environment=True) |