dbus: enable static library (#25188)
- enable static library - dbus-daemon is linked to static expat
This commit is contained in:
parent
6576fd9b24
commit
ca0fa0e675
102
mingw-w64-dbus/0002-enable-static-lib.patch
Normal file
102
mingw-w64-dbus/0002-enable-static-lib.patch
Normal file
@ -0,0 +1,102 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 3d96059..56b46ad 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -100,7 +100,7 @@ set(DBUS_LIBEXECDIR ${CMAKE_INSTALL_FULL_LIBEXECDIR})
|
||||
set(DBUS_DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
|
||||
|
||||
#enable building of shared library
|
||||
-set(BUILD_SHARED_LIBS ON)
|
||||
+option(BUILD_SHARED_LIBS "Enable building of shared library" ON)
|
||||
|
||||
set(INSTALL_TARGETS_DEFAULT_ARGS EXPORT DBus1Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
@@ -183,6 +183,14 @@ endif()
|
||||
find_package(EXPAT)
|
||||
find_package(X11)
|
||||
find_package(GLIB2)
|
||||
+
|
||||
+if(EXPAT_FOUND)
|
||||
+ if(MINGW)
|
||||
+ # always linked with static expat lib
|
||||
+ set(EXPAT_LIBRARIES "${CMAKE_STATIC_LIBRARY_PREFIX}expat${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
+ endif()
|
||||
+endif()
|
||||
+
|
||||
if(GLIB2_FOUND)
|
||||
option(DBUS_WITH_GLIB "build with glib" ON)
|
||||
endif()
|
||||
@@ -828,12 +836,16 @@ add_custom_target(help-options
|
||||
# create pkgconfig file
|
||||
#
|
||||
if(DBUS_ENABLE_PKGCONFIG)
|
||||
- set(PLATFORM_LIBS pthread ${LIBRT})
|
||||
+ if(NOT MINGW)
|
||||
+ set(PLATFORM_LIBS pthread ${LIBRT})
|
||||
+ endif()
|
||||
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(NOT MINGW)
|
||||
+ foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
|
||||
+ set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
|
||||
+ endforeach()
|
||||
+ endif()
|
||||
set(original_prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
if(DBUS_RELOCATABLE)
|
||||
set(pkgconfig_prefix "\${pcfiledir}/../..")
|
||||
diff --git a/dbus/CMakeLists.txt b/dbus/CMakeLists.txt
|
||||
index 04f9ca2..8d5a8af 100644
|
||||
--- a/dbus/CMakeLists.txt
|
||||
+++ b/dbus/CMakeLists.txt
|
||||
@@ -262,14 +262,20 @@ find_library(LIBRT rt)
|
||||
# for socket() on QNX
|
||||
find_library(LIBSOCKET socket)
|
||||
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
+ set(LIBRARY_TYPE SHARED)
|
||||
+else()
|
||||
+ set(LIBRARY_TYPE STATIC)
|
||||
+endif()
|
||||
+
|
||||
### Client library
|
||||
-add_library(dbus-1 SHARED
|
||||
+add_library(dbus-1 ${LIBRARY_TYPE}
|
||||
${libdbus_SOURCES}
|
||||
${libdbus_HEADERS}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
- if(DEFINED DBUS_LIBRARY_REVISION)
|
||||
+ if(DEFINED DBUS_LIBRARY_REVISION AND BUILD_SHARED_LIBS)
|
||||
set_target_properties(dbus-1 PROPERTIES SUFFIX "-${DBUS_LIBRARY_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
add_custom_command(TARGET dbus-1 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:dbus-1>" "$<TARGET_FILE_DIR:dbus-1>/${CMAKE_SHARED_LIBRARY_PREFIX}dbus-1${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
diff --git a/dbus/dbus-macros.h b/dbus/dbus-macros.h
|
||||
index 5ca7bf0..5ba490e 100644
|
||||
--- a/dbus/dbus-macros.h
|
||||
+++ b/dbus/dbus-macros.h
|
||||
@@ -198,7 +198,7 @@
|
||||
|
||||
#if defined(DBUS_EXPORT)
|
||||
/* value forced by compiler command line, don't redefine */
|
||||
-#elif defined(_WIN32)
|
||||
+#elif defined(_MSC_VER)
|
||||
# if defined(DBUS_STATIC_BUILD)
|
||||
# define DBUS_EXPORT
|
||||
# elif defined(dbus_1_EXPORTS)
|
||||
diff --git a/dbus/dbus-macros-internal.h b/dbus/dbus-macros-internal.h
|
||||
index 474a84b..986e955 100644
|
||||
--- a/dbus/dbus-macros-internal.h
|
||||
+++ b/dbus/dbus-macros-internal.h
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#if defined(DBUS_PRIVATE_EXPORT)
|
||||
/* value forced by compiler command line, don't redefine */
|
||||
-#elif defined(_WIN32)
|
||||
+#elif defined(_MSC_VER)
|
||||
# if defined(DBUS_STATIC_BUILD)
|
||||
# define DBUS_PRIVATE_EXPORT /* no decoration */
|
||||
# elif defined(dbus_1_EXPORTS)
|
||||
@ -4,7 +4,7 @@ _realname=dbus
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=1.16.2
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="Freedesktop.org message bus system (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
|
||||
@ -21,18 +21,20 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
|
||||
"${MINGW_PACKAGE_PREFIX}-expat"
|
||||
"${MINGW_PACKAGE_PREFIX}-glib2"
|
||||
"${MINGW_PACKAGE_PREFIX}-doxygen")
|
||||
optdepends=("${MINGW_PACKAGE_PREFIX}-expat: For dbus-daemon")
|
||||
source=("https://dbus.freedesktop.org/releases/dbus/${_realname}-${pkgver}.tar.xz"{,.asc}
|
||||
"0001-add-aarch64-backtrace-support.patch")
|
||||
"0001-add-aarch64-backtrace-support.patch"
|
||||
"0002-enable-static-lib.patch")
|
||||
sha256sums=('0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6beb7e2'
|
||||
'SKIP'
|
||||
'8938f866ffa1699f24fe6c92334d17c3c65b595044156f35833ed731461c9dc3')
|
||||
'8938f866ffa1699f24fe6c92334d17c3c65b595044156f35833ed731461c9dc3'
|
||||
'870286583ee0c2349652fc163567789b5648c7db89ce68430dad0ac4710c4399')
|
||||
validpgpkeys=('DA98F25C0871C49A59EAFF2C4DE8FF2A63C7CC90')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${_realname}-${pkgver}"
|
||||
|
||||
patch -Np1 -i "${srcdir}/0001-add-aarch64-backtrace-support.patch"
|
||||
patch -Np1 -i "${srcdir}/0002-enable-static-lib.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -43,17 +45,31 @@ build() {
|
||||
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
|
||||
fi
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
# dbus defaults to __USE_MINGW_ANSI_STDIO=0
|
||||
CFLAGS+=" -U__USE_MINGW_ANSI_STDIO"
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
cmake \
|
||||
-GNinja \
|
||||
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DDBUS_ENABLE_XML_DOCS=OFF \
|
||||
"${extra_config[@]}" \
|
||||
-S ${_realname}-${pkgver} \
|
||||
-B "build-${MSYSTEM}-static"
|
||||
|
||||
cmake --build "build-${MSYSTEM}-static"
|
||||
|
||||
CFLAGS+=" -U__USE_MINGW_ANSI_STDIO"
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
cmake \
|
||||
-GNinja \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
|
||||
-DDBUS_ENABLE_XML_DOCS=OFF \
|
||||
"${extra_config[@]}" \
|
||||
-S ${_realname}-${pkgver} \
|
||||
-B "build-${MSYSTEM}"
|
||||
-B "build-${MSYSTEM}-shared"
|
||||
|
||||
cmake --build "build-${MSYSTEM}"
|
||||
cmake --build "build-${MSYSTEM}-shared"
|
||||
}
|
||||
|
||||
check() {
|
||||
@ -62,10 +78,9 @@ check() {
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="${pkgdir}" cmake --install build-${MSYSTEM}
|
||||
DESTDIR="${pkgdir}" cmake --install build-${MSYSTEM}-static
|
||||
DESTDIR="${pkgdir}" cmake --install build-${MSYSTEM}-shared
|
||||
|
||||
install -Dt ""${pkgdir}${MINGW_PREFIX}"/share/licenses/${_realname}" -m644 "${srcdir}"/${_realname}-${pkgver}/COPYING
|
||||
install -Dt ""${pkgdir}${MINGW_PREFIX}"/share/licenses/${_realname}/LICENSES" -m644 \
|
||||
"${srcdir}"/${_realname}-${pkgver}/LICENSES/AFL-2.1.txt \
|
||||
"${srcdir}"/${_realname}-${pkgver}/LICENSES/GPL-2.0-or-later.txt
|
||||
install -Dt "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname} -m644 "${srcdir}"/${_realname}-${pkgver}/COPYING
|
||||
install -Dt "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname} -m644 "${srcdir}"/${_realname}-${pkgver}/LICENSES/{AFL-2.1,GPL-2.0-or-later}.txt
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user