Skip to content

Commit 85141f1

Browse files
committed
vcpkg/linux: Avoid dependency on libsystemd/liblzma
libsystemd which is required by dbus has an optional dependency on liblzma and since we don't need it we can just strip it out of dbus
1 parent 5c0d5a5 commit 85141f1

File tree

6 files changed

+195
-0
lines changed

6 files changed

+195
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
2+
index 8cde1ffe0..d4d09f223 100644
3+
--- a/tools/CMakeLists.txt
4+
+++ b/tools/CMakeLists.txt
5+
@@ -91,7 +91,9 @@ endif()
6+
add_executable(dbus-launch ${dbus_launch_SOURCES})
7+
target_link_libraries(dbus-launch ${DBUS_LIBRARIES})
8+
if(DBUS_BUILD_X11)
9+
- target_link_libraries(dbus-launch ${X11_LIBRARIES} )
10+
+ find_package(Threads REQUIRED)
11+
+ target_link_libraries(dbus-launch ${X11_LIBRARIES} ${X11_xcb_LIB} ${X11_Xau_LIB} ${X11_Xdmcp_LIB} Threads::Threads)
12+
+ target_include_directories(dbus-launch PRIVATE ${X11_INCLUDE_DIR})
13+
endif()
14+
install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
2+
index b7f3702..e2336ba 100644
3+
--- a/cmake/ConfigureChecks.cmake
4+
+++ b/cmake/ConfigureChecks.cmake
5+
@@ -51,6 +51,7 @@ check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) #
6+
check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON)
7+
check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS)
8+
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c
9+
+check_symbol_exists(getpeereid "sys/types.h;unistd.h" HAVE_GETPEEREID) # dbus-sysdeps.c,
10+
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c
11+
check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c
12+
check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
13+
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
14+
index 77fc19c..2f25643 100644
15+
--- a/cmake/config.h.cmake
16+
+++ b/cmake/config.h.cmake
17+
@@ -140,6 +140,9 @@
18+
/* Define to 1 if you have getgrouplist */
19+
#cmakedefine HAVE_GETGROUPLIST 1
20+
21+
+/* Define to 1 if you have getpeereid */
22+
+#cmakedefine HAVE_GETPEEREID 1
23+
+
24+
/* Define to 1 if you have getpeerucred */
25+
#cmakedefine HAVE_GETPEERUCRED 1
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index d3ec71b..932066a 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -141,6 +141,10 @@ if(DBUS_LINUX)
6+
if(ENABLE_SYSTEMD AND SYSTEMD_FOUND)
7+
set(DBUS_BUS_ENABLE_SYSTEMD ON)
8+
set(HAVE_SYSTEMD ${SYSTEMD_FOUND})
9+
+ pkg_check_modules(SYSTEMD libsystemd IMPORTED_TARGET)
10+
+ set(SYSTEMD_LIBRARIES PkgConfig::SYSTEMD CACHE INTERNAL "")
11+
+ else()
12+
+ set(SYSTEMD_LIBRARIES "" CACHE INTERNAL "")
13+
endif()
14+
option(ENABLE_USER_SESSION "enable user-session semantics for session bus under systemd" OFF)
15+
set(DBUS_ENABLE_USER_SESSION ${ENABLE_USER_SESSION})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index caef738..b878f42 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -724,11 +724,11 @@ add_custom_target(help-options
6+
#
7+
if(DBUS_ENABLE_PKGCONFIG)
8+
set(PLATFORM_LIBS pthread ${LIBRT})
9+
- if(PKG_CONFIG_FOUND)
10+
- # convert lists of link libraries into -lstdc++ -lm etc..
11+
- foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
12+
- set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
13+
- endforeach()
14+
+ if(1)
15+
+ set(LIBDBUS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
16+
+ if(LIBRT)
17+
+ string(APPEND LIBDBUS_LIBS " -lrt")
18+
+ endif()
19+
set(original_prefix "${CMAKE_INSTALL_PREFIX}")
20+
if(DBUS_RELOCATABLE)
21+
set(pkgconfig_prefix "\${pcfiledir}/../..")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
2+
3+
vcpkg_from_gitlab(
4+
GITLAB_URL https://gitlab.freedesktop.org/
5+
OUT_SOURCE_PATH SOURCE_PATH
6+
REPO dbus/dbus
7+
REF "dbus-${VERSION}"
8+
SHA512 8e476b408514e6540c36beb84e8025827c22cda8958b6eb74d22b99c64765eb3cd5a6502aea546e3e5f0534039857b37edee89c659acef40e7cab0939947d4af
9+
HEAD_REF master
10+
PATCHES
11+
cmake.dep.patch
12+
pkgconfig.patch
13+
getpeereid.patch # missing check from configure.ac
14+
libsystemd.patch
15+
)
16+
17+
vcpkg_check_features(OUT_FEATURE_OPTIONS options
18+
FEATURES
19+
systemd ENABLE_SYSTEMD
20+
x11 DBUS_BUILD_X11
21+
x11 CMAKE_REQUIRE_FIND_PACKAGE_X11
22+
)
23+
24+
unset(ENV{DBUSDIR})
25+
26+
vcpkg_cmake_configure(
27+
SOURCE_PATH "${SOURCE_PATH}"
28+
OPTIONS
29+
-DDBUS_BUILD_TESTS=OFF
30+
-DDBUS_ENABLE_DOXYGEN_DOCS=OFF
31+
-DDBUS_ENABLE_XML_DOCS=OFF
32+
-DDBUS_INSTALL_SYSTEM_LIBS=OFF
33+
#-DDBUS_SERVICE=ON
34+
-DDBUS_WITH_GLIB=OFF
35+
-DTHREADS_PREFER_PTHREAD_FLAG=ON
36+
-DXSLTPROC_EXECUTABLE=FALSE
37+
"-DCMAKE_INSTALL_SYSCONFDIR=${CURRENT_PACKAGES_DIR}/etc/${PORT}"
38+
"-DWITH_SYSTEMD_SYSTEMUNITDIR=lib/systemd/system"
39+
"-DWITH_SYSTEMD_USERUNITDIR=lib/systemd/user"
40+
${options}
41+
OPTIONS_RELEASE
42+
-DDBUS_DISABLE_ASSERT=OFF
43+
-DDBUS_ENABLE_STATS=OFF
44+
-DDBUS_ENABLE_VERBOSE_MODE=OFF
45+
MAYBE_UNUSED_VARIABLES
46+
DBUS_BUILD_X11
47+
DBUS_WITH_GLIB
48+
ENABLE_SYSTEMD
49+
THREADS_PREFER_PTHREAD_FLAG
50+
WITH_SYSTEMD_SYSTEMUNITDIR
51+
WITH_SYSTEMD_USERUNITDIR
52+
)
53+
vcpkg_cmake_install()
54+
vcpkg_copy_pdbs()
55+
vcpkg_cmake_config_fixup(PACKAGE_NAME "DBus1" CONFIG_PATH "lib/cmake/DBus1")
56+
vcpkg_fixup_pkgconfig()
57+
58+
file(REMOVE_RECURSE
59+
"${CURRENT_PACKAGES_DIR}/debug/include"
60+
"${CURRENT_PACKAGES_DIR}/debug/share"
61+
"${CURRENT_PACKAGES_DIR}/debug/var/"
62+
"${CURRENT_PACKAGES_DIR}/etc"
63+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/services"
64+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/session.d"
65+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system-services"
66+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.d"
67+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
68+
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
69+
"${CURRENT_PACKAGES_DIR}/share/doc"
70+
"${CURRENT_PACKAGES_DIR}/var"
71+
)
72+
73+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<include ignore_missing=\"yes\">${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.conf</include>" "")
74+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<includedir>${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.d</includedir>" "")
75+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<include ignore_missing=\"yes\">${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session-local.conf</include>" "")
76+
77+
set(TOOLS daemon launch monitor run-session send test-tool update-activation-environment)
78+
if(VCPKG_TARGET_IS_WINDOWS)
79+
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
80+
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/dbus-env.bat" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat")
81+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat" "${CURRENT_PACKAGES_DIR}" "%~dp0/../..")
82+
else()
83+
list(APPEND TOOLS cleanup-sockets uuidgen)
84+
endif()
85+
list(TRANSFORM TOOLS PREPEND "dbus-" )
86+
vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN)
87+
88+
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "dbus",
3+
"version": "1.15.8",
4+
"port-version": 2,
5+
"description": "D-Bus specification and reference implementation, including libdbus and dbus-daemon",
6+
"homepage": "https://gitlab.freedesktop.org/dbus/dbus",
7+
"license": "AFL-2.1 OR GPL-2.0-or-later",
8+
"supports": "!uwp & !staticcrt",
9+
"dependencies": [
10+
"expat",
11+
{
12+
"name": "vcpkg-cmake",
13+
"host": true
14+
},
15+
{
16+
"name": "vcpkg-cmake-config",
17+
"host": true
18+
}
19+
],
20+
"default-features": [
21+
],
22+
"features": {
23+
"x11": {
24+
"description": "Build with X11 autolaunch support",
25+
"dependencies": [
26+
"libx11"
27+
]
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)