Skip to content

Commit

Permalink
[Part1|xwindow PR] Split up to dbus (#22642)
Browse files Browse the repository at this point in the history
* first batch of xwindow PR ports - up to dbus

* first batch of xwindow PR ports - up to dbus

* format manifest

* version stuff

* remove if block

* version stuff

* fix xcb hash

* fix xproto dependency on meson blocking cross builds

* adjust message

* use X11_xcb_LIB

* version stuff

* put xlib arm64-windows on baseline

* fix dbus on osx and linux

* version stuff

* forget to set the value

* fix --export-dynamic on osx

* version dbus

* ci-retrigger

* add license (needs tool update)

* version adjustments

* version update

* remove unnecessary comments

* v db

* Apply suggestions from code review

Co-authored-by: Billy O'Neal <bion@microsoft.com>

* nitpicks

* rename xau to libxau

* use vcpkg_install_copyright and silence usage

* xtrans silence usage

* format-manifest

* v db

* make license null for ports without exact match

* xdmcp rename to libxdmcp

* merge x11 wrapper into xlib
rename xlib to libx11 to avoid a metaport

* v db

* missed dbus depending on x11.

* v db

* Update scripts/ci.baseline.txt

Co-authored-by: LilyWangLL <94091114+LilyWangLL@users.noreply.github.com>
Co-authored-by: Alexander Neumann <you@example.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
  • Loading branch information
5 people committed Aug 22, 2022
1 parent 3fefadf commit 552f1ee
Show file tree
Hide file tree
Showing 60 changed files with 1,821 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ports/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 ports/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 7bc789f0e..ec476d9ed 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -44,6 +44,7 @@ check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY)

check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) # dbus-sysdeps.c, dbus-sysdeps-win.c
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(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c
check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index cbffcfa91..1f055ddb9 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -169,6 +169,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

17 changes: 17 additions & 0 deletions ports/dbus/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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}")
64 changes: 64 additions & 0 deletions ports/dbus/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO dbus/dbus
REF c91ca6edad658274607323a438eea7c7c6c5e392 #1.13.18
SHA512 4dd4d369152591040ebe9f474a0ba8911d8a91546d64b1d6f7335b7fd8026bd99a8a4fe1c78b80eb2e31e9e58324d432857e2a7af1d1cb950d22b4430cc0f7ac
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_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DDBUS_BUILD_TESTS=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
-DENABLE_SYSTEMD=ON
-DDBUS_ENABLE_PKGCONFIG=ON
-DPKG_CONFIG_FOUND=TRUE
"-DCMAKE_INSTALL_SYSCONFDIR=${CURRENT_PACKAGES_DIR}/etc/${PORT}"
"-DWITH_SYSTEMD_SYSTEMUNITDIR=lib/systemd/system"
"-DWITH_SYSTEMD_USERUNITDIR=lib/systemd/user"
)
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")

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/..")
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()
15 changes: 15 additions & 0 deletions ports/dbus/rdynamic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c2f6ba5b..6a4c5410b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,8 +277,8 @@ endif()

if(UNIX AND NOT DBUS_DISABLE_ASSERT)
# required for backtrace
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wl,--export-dynamic")
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,--export-dynamic")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -rdynamic")
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -rdynamic")
add_definitions(-DDBUS_BUILT_R_DYNAMIC)
endif()

27 changes: 27 additions & 0 deletions ports/dbus/rt_pc_link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index caef73840..caf7e61bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -726,7 +726,7 @@ 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})
+ foreach(LIB ${PLATFORM_LIBS})
set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
endforeach()
set(original_prefix "${CMAKE_INSTALL_PREFIX}")
diff --git a/dbus/CMakeLists.txt b/dbus/CMakeLists.txt
index 63070b69b..5752b7492 100644
--- a/dbus/CMakeLists.txt
+++ b/dbus/CMakeLists.txt
@@ -253,6 +253,9 @@ endif()

# for clock_getres() on e.g. GNU/Linux (but not Android)
find_library(LIBRT rt)
+get_filename_component(LIBRT "${LIBRT}" NAME_WLE)
+string(REPLACE "lib" "" LIBRT "${LIBRT}")
+set(LIBRT "${LIBRT}" CACHE STRING "" FORCE)

# for socket() on QNX
find_library(LIBSOCKET socket)
20 changes: 20 additions & 0 deletions ports/dbus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "dbus",
"version": "1.13.18",
"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",
"dependencies": [
"expat",
"glib",
"libx11",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
147 changes: 147 additions & 0 deletions ports/libx11/cl.build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 844571688..e46c4ec5d 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -1351,11 +1351,14 @@ extern int _XOpenFile(
int /* flags */
);

+#if defined(_MSC_VER) && !defined(mode_t)
+typedef int mode_t;
+#endif
extern int _XOpenFileMode(
_Xconst char* /* path */,
int /* flags */,
mode_t /* mode */
);

extern void* _XFopenFile(
_Xconst char* /* path */,
diff --git a/modules/im/ximcp/imLcLkup.c b/modules/im/ximcp/imLcLkup.c
index 56dba9673..d10de825e 100644
--- a/modules/im/ximcp/imLcLkup.c
+++ b/modules/im/ximcp/imLcLkup.c
@@ -61,27 +61,37 @@ _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
||(ic->private.local.brl_committed != 0))) {
if (ic->private.local.brl_committed != 0) { /* Braille Event */
unsigned char pattern = ic->private.local.brl_committed;
+#ifndef _MSC_VER
char mb2[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
+#else
+ char *mb2 = (char*)malloc(XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)*sizeof(char));
+#endif
ret = _Xlcwctomb(ic->core.im->core.lcd, mb2, BRL_UC_ROW | pattern);
if(ret > bytes) {
if(status) *status = XBufferOverflow;
+#ifdef _MSC_VER
+ free(mb2);
+#endif
return(ret);
}
if(keysym) *keysym = XK_braille_blank | pattern;
if(ret > 0) {
if (keysym) {
if(status) *status = XLookupBoth;
} else {
if(status) *status = XLookupChars;
}
memcpy(buffer, mb2, ret);
} else {
if(keysym) {
if(status) *status = XLookupKeySym;
} else {
if(status) *status = XLookupNone;
}
}
+#ifdef _MSC_VER
+ free(mb2);
+#endif
} else { /* Composed Event */
ret = strlen(&mb[b[ic->private.local.composed].mb]);
if(ret > bytes) {
diff --git a/src/XlibInt.c b/src/XlibInt.c
index e4fb4e5f2..4cfa1aeab 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -60,6 +60,8 @@ from The Open Group.
/* Needed for ioctl() on Solaris */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#else
+ #define F_OK 0
#endif

#ifdef XTHREADS
@@ -985,7 +987,7 @@ _XWireToEvent(
case KeymapNotify:
{
register XKeymapEvent *ev = (XKeymapEvent *) re;
- ev->window = None;
+ ev->window = 0;
memcpy(&ev->key_vector[1],
(char *)((xKeymapEvent *) event)->map,
sizeof (((xKeymapEvent *) event)->map));
@@ -1919,7 +1925,11 @@ int _XOpenFileMode(path, flags, mode)
UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS);

if (AccessFile (path, buf, MAX_PATH, &bufp))
+#ifndef _MSC_VER
ret = open (bufp, flags, mode);
+#else
+ ret = _open (bufp, flags, mode);
+#endif

(void) SetErrorMode (olderror);

diff --git a/src/xlibi18n/XDefaultOMIF.c b/src/xlibi18n/XDefaultOMIF.c
index 9345547c3..77d914fe1 100644
--- a/src/xlibi18n/XDefaultOMIF.c
+++ b/src/xlibi18n/XDefaultOMIF.c
@@ -70,6 +70,14 @@ Sun Microsystems, Inc. or its licensors is granted.
#include <X11/Xatom.h>
#include <stdio.h>

+#if !defined(ssize_t)
+ #ifdef _WIN64
+ #define ssize_t long long
+ #else
+ #define ssize_t long
+ #endif
+#endif
+
#define MAXFONTS 100

#define XOM_GENERIC(om) (&((XOMGeneric) om)->gen)
diff --git a/src/xlibi18n/lcDB.c b/src/xlibi18n/lcDB.c
index e04a5d89f..fa46f8ecc 100644
--- a/src/xlibi18n/lcDB.c
+++ b/src/xlibi18n/lcDB.c
@@ -65,6 +65,14 @@

#include <stdio.h>

+#if !defined(ssize_t)
+ #ifdef _WIN64
+ #define ssize_t long long
+ #else
+ #define ssize_t long
+ #endif
+#endif
+
typedef struct _DatabaseRec {
char *category;
char *name;
diff --git a/src/xlibi18n/lcFile.c b/src/xlibi18n/lcFile.c
index e43ac2c0e..d9f49b725 100644
--- a/src/xlibi18n/lcFile.c
+++ b/src/xlibi18n/lcFile.c
@@ -32,7 +32,9 @@
#include "Xlibint.h"
#include "XlcPubI.h"
#include <X11/Xos.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif

/************************************************************************/

44 changes: 44 additions & 0 deletions ports/libx11/dllimport.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 603d05669..8596cb434 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -389,23 +389,26 @@ struct _XLockPtrs {
#define _XLockMutex_fn (*_XLockMutex_fn_p)
#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
#define _Xglobal_lock (*_Xglobal_lock_p)
+#define X_LOCK_EXTERN __declspec(dllimport) extern
+#else
+#define X_LOCK_EXTERN extern
#endif

/* in XlibInt.c */
-extern void (*_XCreateMutex_fn)(
+X_LOCK_EXTERN void (*_XCreateMutex_fn)(
LockInfoPtr /* lock */
);
-extern void (*_XFreeMutex_fn)(
+X_LOCK_EXTERN void (*_XFreeMutex_fn)(
LockInfoPtr /* lock */
);
-extern void (*_XLockMutex_fn)(
+X_LOCK_EXTERN void (*_XLockMutex_fn)(
LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */
, int /* line */
#endif
);
-extern void (*_XUnlockMutex_fn)(
+X_LOCK_EXTERN void (*_XUnlockMutex_fn)(
LockInfoPtr /* lock */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char * /* file */
@@ -413,7 +416,7 @@ extern void (*_XUnlockMutex_fn)(
#endif
);

-extern LockInfoPtr _Xglobal_lock;
+X_LOCK_EXTERN LockInfoPtr _Xglobal_lock;

#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
12 changes: 12 additions & 0 deletions ports/libx11/io_include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/XlibInt.c b/src/XlibInt.c
index bab39bc00..31b6511cb 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -45,6 +45,7 @@ from The Open Group.
#include <stdio.h>
#ifdef WIN32
#include <direct.h>
+#include <io.h>
#endif

/* Needed for FIONREAD on Solaris */
Loading

0 comments on commit 552f1ee

Please sign in to comment.