Skip to content

Commit

Permalink
vcpkg: Avoid dependency on liblzma
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap committed Apr 3, 2024
1 parent 51072b5 commit 9d7c33b
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/cmake.dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 8cde1ffe0..d4d09f223 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -91,7 +91,9 @@ endif()
add_executable(dbus-launch ${dbus_launch_SOURCES})
target_link_libraries(dbus-launch ${DBUS_LIBRARIES})
if(DBUS_BUILD_X11)
- target_link_libraries(dbus-launch ${X11_LIBRARIES} )
+ find_package(Threads REQUIRED)
+ target_link_libraries(dbus-launch ${X11_LIBRARIES} ${X11_xcb_LIB} ${X11_Xau_LIB} ${X11_Xdmcp_LIB} Threads::Threads)
+ target_include_directories(dbus-launch PRIVATE ${X11_INCLUDE_DIR})
endif()
install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})

26 changes: 26 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/getpeereid.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index b7f3702..e2336ba 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -51,6 +51,7 @@ check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) #
check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON)
check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS)
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c
+check_symbol_exists(getpeereid "sys/types.h;unistd.h" HAVE_GETPEEREID) # dbus-sysdeps.c,
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c
check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 77fc19c..2f25643 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -140,6 +140,9 @@
/* Define to 1 if you have getgrouplist */
#cmakedefine HAVE_GETGROUPLIST 1

+/* Define to 1 if you have getpeereid */
+#cmakedefine HAVE_GETPEEREID 1
+
/* Define to 1 if you have getpeerucred */
#cmakedefine HAVE_GETPEERUCRED 1

15 changes: 15 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/libsystemd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3ec71b..932066a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,6 +141,10 @@ if(DBUS_LINUX)
if(ENABLE_SYSTEMD AND SYSTEMD_FOUND)
set(DBUS_BUS_ENABLE_SYSTEMD ON)
set(HAVE_SYSTEMD ${SYSTEMD_FOUND})
+ pkg_check_modules(SYSTEMD libsystemd IMPORTED_TARGET)
+ set(SYSTEMD_LIBRARIES PkgConfig::SYSTEMD CACHE INTERNAL "")
+ else()
+ set(SYSTEMD_LIBRARIES "" CACHE INTERNAL "")
endif()
option(ENABLE_USER_SESSION "enable user-session semantics for session bus under systemd" OFF)
set(DBUS_ENABLE_USER_SESSION ${ENABLE_USER_SESSION})
21 changes: 21 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index caef738..b878f42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -724,11 +724,11 @@ add_custom_target(help-options
#
if(DBUS_ENABLE_PKGCONFIG)
set(PLATFORM_LIBS pthread ${LIBRT})
- if(PKG_CONFIG_FOUND)
- # convert lists of link libraries into -lstdc++ -lm etc..
- foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
- set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
- endforeach()
+ if(1)
+ set(LIBDBUS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+ if(LIBRT)
+ string(APPEND LIBDBUS_LIBS " -lrt")
+ endif()
set(original_prefix "${CMAKE_INSTALL_PREFIX}")
if(DBUS_RELOCATABLE)
set(pkgconfig_prefix "\${pcfiledir}/../..")
88 changes: 88 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO dbus/dbus
REF "dbus-${VERSION}"
SHA512 8e476b408514e6540c36beb84e8025827c22cda8958b6eb74d22b99c64765eb3cd5a6502aea546e3e5f0534039857b37edee89c659acef40e7cab0939947d4af
HEAD_REF master
PATCHES
cmake.dep.patch
pkgconfig.patch
getpeereid.patch # missing check from configure.ac
libsystemd.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS options
FEATURES
systemd ENABLE_SYSTEMD
x11 DBUS_BUILD_X11
x11 CMAKE_REQUIRE_FIND_PACKAGE_X11
)

unset(ENV{DBUSDIR})

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DDBUS_BUILD_TESTS=OFF
-DDBUS_ENABLE_DOXYGEN_DOCS=OFF
-DDBUS_ENABLE_XML_DOCS=OFF
-DDBUS_INSTALL_SYSTEM_LIBS=OFF
#-DDBUS_SERVICE=ON
-DDBUS_WITH_GLIB=OFF
-DTHREADS_PREFER_PTHREAD_FLAG=ON
-DXSLTPROC_EXECUTABLE=FALSE
"-DCMAKE_INSTALL_SYSCONFDIR=${CURRENT_PACKAGES_DIR}/etc/${PORT}"
"-DWITH_SYSTEMD_SYSTEMUNITDIR=lib/systemd/system"
"-DWITH_SYSTEMD_USERUNITDIR=lib/systemd/user"
${options}
OPTIONS_RELEASE
-DDBUS_DISABLE_ASSERT=OFF
-DDBUS_ENABLE_STATS=OFF
-DDBUS_ENABLE_VERBOSE_MODE=OFF
MAYBE_UNUSED_VARIABLES
DBUS_BUILD_X11
DBUS_WITH_GLIB
ENABLE_SYSTEMD
THREADS_PREFER_PTHREAD_FLAG
WITH_SYSTEMD_SYSTEMUNITDIR
WITH_SYSTEMD_USERUNITDIR
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME "DBus1" CONFIG_PATH "lib/cmake/DBus1")
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/var/"
"${CURRENT_PACKAGES_DIR}/etc"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/services"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/session.d"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system-services"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.d"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
"${CURRENT_PACKAGES_DIR}/share/doc"
"${CURRENT_PACKAGES_DIR}/var"
)

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>" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<includedir>${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.d</includedir>" "")
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>" "")

set(TOOLS daemon launch monitor run-session send test-tool update-activation-environment)
if(VCPKG_TARGET_IS_WINDOWS)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/dbus-env.bat" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat" "${CURRENT_PACKAGES_DIR}" "%~dp0/../..")
else()
list(APPEND TOOLS cleanup-sockets uuidgen)
endif()
list(TRANSFORM TOOLS PREPEND "dbus-" )
vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN)

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
30 changes: 30 additions & 0 deletions dependencies/vcpkg_overlay_ports_linux/dbus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "dbus",
"version": "1.15.8",
"port-version": 2,
"description": "D-Bus specification and reference implementation, including libdbus and dbus-daemon",
"homepage": "https://gitlab.freedesktop.org/dbus/dbus",
"license": "AFL-2.1 OR GPL-2.0-or-later",
"supports": "!uwp & !staticcrt",
"dependencies": [
"expat",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
],
"features": {
"x11": {
"description": "Build with X11 autolaunch support",
"dependencies": [
"libx11"
]
}
}
}

0 comments on commit 9d7c33b

Please sign in to comment.