Skip to content

Commit

Permalink
[dbus] Cleanup, fix pkgconfig for osx (#27425)
Browse files Browse the repository at this point in the history
* Revise portfile

* Revise pkgconfig patching

* More cleanup

* Update versions

* Only dynamic library

* Fix warnings

* Update versions

* glib unneeded unless building tests

* More changes

* Add opt-in x11 feature

* Dynamic lib implies !staticcrt

* Update versions

* !uwp

* Update versions
  • Loading branch information
dg0yt authored Oct 26, 2022
1 parent d7787aa commit fc66853
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 77 deletions.
38 changes: 21 additions & 17 deletions ports/dbus/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c2f6ba5b..a5f7fe222 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -723,8 +723,10 @@ add_custom_target(help-options
# create pkgconfig file
#
if(DBUS_ENABLE_PKGCONFIG)
- set(PLATFORM_LIBS pthread ${LIBRT})
- if(PKG_CONFIG_FOUND)
+ if(NOT WIN32)
+ set(PLATFORM_LIBS pthread ${LIBRT})
+ endif()
+ if(1)
# convert lists of link libraries into -lstdc++ -lm etc..
foreach(LIB ${PLATFORM_LIBS})
set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
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}/../..")
71 changes: 43 additions & 28 deletions ports/dbus/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -7,66 +9,79 @@ vcpkg_from_gitlab(
HEAD_REF master
PATCHES
cmake.dep.patch
rt_pc_link.patch
pkgconfig.patch
getpeereid.patch # missing check from configure.ac
rdynamic.patch # OSX doesn't like '-Wl,--export-dynamic'
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
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_XML_DOCS=OFF
-DDBUS_ENABLE_DOXYGEN_DOCS=OFF
-DDBUS_ENABLE_XML_DOCS=OFF
-DDBUS_INSTALL_SYSTEM_LIBS=OFF
-DDBUS_ENABLE_PKGCONFIG=ON
#-DDBUS_SERVICE=ON
-DDBUS_WITH_GLIB=ON
-DXSLTPROC_EXECUTABLE=FALSE
-DDBUS_WITH_GLIB=OFF
-DENABLE_SYSTEMD=ON
-DDBUS_ENABLE_PKGCONFIG=ON
-DPKG_CONFIG_FOUND=TRUE
-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_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")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var/"
"${CURRENT_PACKAGES_DIR}/var"
"${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}/etc")
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>" "")

file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
set(TOOLS daemon launch monitor run-session send test-tool update-activation-environment)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/dbus-env.bat" "${CURRENT_PACKAGES_DIR}" "%~dp0/..")
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)


if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
27 changes: 0 additions & 27 deletions ports/dbus/rt_pc_link.patch

This file was deleted.

15 changes: 11 additions & 4 deletions ports/dbus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "dbus",
"version": "1.13.18",
"port-version": 2,
"port-version": 3,
"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",
"glib",
"libx11",
{
"name": "vcpkg-cmake",
"host": true
Expand All @@ -17,5 +16,13 @@
"name": "vcpkg-cmake-config",
"host": true
}
]
],
"features": {
"x11": {
"description": "Build with X11 autolaunch support",
"dependencies": [
"libx11"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@
},
"dbus": {
"baseline": "1.13.18",
"port-version": 2
"port-version": 3
},
"dcmtk": {
"baseline": "3.6.7",
Expand Down
5 changes: 5 additions & 0 deletions versions/d-/dbus.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "64987c1349d8190e762e5e7779a8cee15e92b1ef",
"version": "1.13.18",
"port-version": 3
},
{
"git-tree": "68f92ce062e5a0bfb408087a34e1c5b7d0a8315a",
"version": "1.13.18",
Expand Down

0 comments on commit fc66853

Please sign in to comment.