[xwindow] part 3/n (#26572)

* [xcb-render-util] add port

* [libxkbfile] add port

* [libxkbcommon] add port

* v db

* Apply suggestions from code review

Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>

* v db

Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>
This commit is contained in:
Alexander Neumann 2022-09-01 01:20:31 +02:00 committed by GitHub
parent 2738b0efed
commit 6eb35f5af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 313 additions and 0 deletions

View File

@ -0,0 +1,27 @@
diff --git a/tools/how-to-type.c b/tools/how-to-type.c
index 0a6f79e68..c1205004d 100644
--- a/tools/how-to-type.c
+++ b/tools/how-to-type.c
@@ -25,8 +25,10 @@
#include <getopt.h>
#include <stdbool.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include "xkbcommon/xkbcommon.h"
diff --git a/tools/tools-common.c b/tools/tools-common.c
index 254499d8c..2465a88c2 100644
--- a/tools/tools-common.c
+++ b/tools/tools-common.c
@@ -42,6 +42,7 @@
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
+#include <process.h>
#else
#include <unistd.h>
#include <termios.h>

View File

@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index 47c436f8d..3fdbe4709 100644
--- a/meson.build
+++ b/meson.build
@@ -641,7 +641,7 @@ if get_option('enable-x11')
)
# test/x11comp is meant to be run, but it is (temporarily?) disabled.
# See: https://github.com/xkbcommon/libxkbcommon/issues/30
- executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
+ # executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
endif
if get_option('enable-xkbregistry')
test(

View File

@ -0,0 +1,55 @@
if(NOT X_VCPKG_FORCE_VCPKG_X_LIBRARIES AND NOT VCPKG_TARGET_IS_WINDOWS)
message(STATUS "Utils and libraries provided by '${PORT}' should be provided by your system! Install the required packages or force vcpkg libraries by setting X_VCPKG_FORCE_VCPKG_X_LIBRARIES in your triplet!")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
else()
set(PATCHES "")
if(VCPKG_TARGET_IS_WINDOWS)
#vcpkg_check_linkage(ONLY_STATIC_LIBRARY) # Meson is not able to automatically export symbols for DLLs
set(PATCHES fix_msvc_build.patch
build.patch)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xkbcommon/libxkbcommon
REF 57af9cb71f19f37394399b549f7cb7b0d9fe3988 # v 1.4.1
SHA512 0f1ecdf12c3cc6ff547a9cf42aa8ce1c63acbf2f6fb766899e5e8dbda401e25dd8137c2f59a04dadd445b4873bb80b8ae8b23f88140e5a318186c308a65921f5
HEAD_REF master
PATCHES ${PATCHES}
)
vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY )
vcpkg_add_to_path(PREPEND "${FLEX_DIR}")
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_DIR "${BISON}" DIRECTORY )
vcpkg_add_to_path(PREPEND "${BISON_DIR}")
set(OPTIONS "")
if(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS -Denable-xkbregistry=false)
endif()
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${OPTIONS}
-Denable-wayland=false
-Denable-docs=false
-Denable-tools=false
)
vcpkg_install_meson()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
endif()

View File

@ -0,0 +1,18 @@
{
"name": "libxkbcommon",
"version": "1.4.1",
"description": "keymap handling library for toolkits and window systems",
"homepage": "https://xkbcommon.org/",
"license": null,
"dependencies": [
"getopt",
"libx11",
"tool-meson",
{
"name": "wayland",
"platform": "linux"
},
"xcb",
"xcb-render-util"
]
}

View File

@ -0,0 +1,15 @@
diff --git a/src/xkbmisc.c b/src/xkbmisc.c
index 2f9b532e6..8be8dd508 100644
--- a/src/xkbmisc.c
+++ b/src/xkbmisc.c
@@ -688,7 +688,9 @@ XkbNameMatchesPattern(char *name, char *ptrn)
_X_HIDDEN int
_XkbStrCaseCmp(char *str1, char *str2)
{
- const u_char *us1 = (const u_char *) str1, *us2 = (const u_char *) str2;
+ typedef unsigned char u_char;
+ const u_char *us1 = (const u_char *) str1;
+ const u_char *us2 = (const u_char *) str2;
while (tolower(*us1) == tolower(*us2)) {
if (*us1++ == '\0')

View File

@ -0,0 +1,41 @@
if(NOT X_VCPKG_FORCE_VCPKG_X_LIBRARIES AND NOT VCPKG_TARGET_IS_WINDOWS)
message(STATUS "Utils and libraries provided by '${PORT}' should be provided by your system! Install the required packages or force vcpkg libraries by setting X_VCPKG_FORCE_VCPKG_X_LIBRARIES in your triplet!")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
else()
set(PATCHES "")
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(PATCHES symbol_visibility.patch)
list(APPEND VCPKG_C_FLAGS " /DXKBFILE_BUILD")
list(APPEND VCPKG_CXX_FLAGS " /DXKBFILE_BUILD")
endif()
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/xorg
OUT_SOURCE_PATH SOURCE_PATH
REPO lib/libxkbfile
REF 261992d42905f209cd5bf6afcf8a7ae3aa30b3ff #1.1.0
SHA512 5be520e408d25331c9a97648f2a6fa832f0d4f49f93f71490b89746da0fbbda404eaab3797c5fbe195287dc94581a6703fa4ecc2511e046127af057eab60378f
HEAD_REF master
PATCHES fix_u_char.patch
${PATCHES}
)
set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Handle copyright
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}/")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/" RENAME copyright)
endif()

View File

@ -0,0 +1,24 @@
diff --git a/include/X11/extensions/XKBfile.h b/include/X11/extensions/XKBfile.h
index 1455463e6..5bcabdd14 100644
--- a/include/X11/extensions/XKBfile.h
+++ b/include/X11/extensions/XKBfile.h
@@ -83,10 +83,15 @@ typedef void (*XkbFileAddOnFunc)(
#define _XkbErrXReqFailure 25
#define _XkbErrBadImplementation 26
-extern const char * _XkbErrMessages[];
-extern unsigned _XkbErrCode;
-extern const char * _XkbErrLocation;
-extern unsigned _XkbErrData;
+#if defined(_MSC_VER) && !defined(XKBFILE_BUILD)
+#define XKBFILE_EXTERN __declspec(dllimport) extern
+#else
+#define XKBFILE_EXTERN extern
+#endif
+XKBFILE_EXTERN const char * _XkbErrMessages[];
+XKBFILE_EXTERN unsigned _XkbErrCode;
+XKBFILE_EXTERN const char * _XkbErrLocation;
+XKBFILE_EXTERN unsigned _XkbErrData;
/***====================================================================***/

View File

@ -0,0 +1,12 @@
{
"name": "libxkbfile",
"version": "1.1.0",
"description": "XKB file handling routines",
"homepage": "https://gitlab.freedesktop.org/xorg/lib/libxkbfile",
"license": null,
"dependencies": [
"libx11",
"xorg-macros",
"xproto"
]
}

View File

@ -0,0 +1,31 @@
if(NOT X_VCPKG_FORCE_VCPKG_X_LIBRARIES AND NOT VCPKG_TARGET_IS_WINDOWS)
message(STATUS "Utils and libraries provided by '${PORT}' should be provided by your system! Install the required packages or force vcpkg libraries by setting X_VCPKG_FORCE_VCPKG_X_LIBRARIES")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
else()
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/xorg
OUT_SOURCE_PATH SOURCE_PATH
REPO lib/libxcb-render-util
REF 0317caf63de532fd7a0493ed6afa871a67253747 #v 0.3.9
SHA512 9a16c3eb3575586fce85a548cb5fd8b23aa8e42363b2c6d4e074e45f5c04089301ef2ff3012cf9cc94490359d4e28ff062feaecb97a880c9240bf7dbe5d03612
HEAD_REF master # branch name
PATCHES pthread.patch # required since this port directly depends on pthread functions. So it has to directly link it!
)
file(TOUCH "${SOURCE_PATH}/m4/dummy")
set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
)
vcpkg_install_make()
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)
endif()

View File

@ -0,0 +1,28 @@
diff --git a/configure.ac b/configure.ac
index 803abe77b..7d694e401 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,7 @@ AM_MAINTAINER_MODE
XCB_UTIL_COMMON([1.4], [1.6])
PKG_CHECK_MODULES(XCB_RENDER, xcb-render)
+PKG_CHECK_MODULES(PTHREAD_STUBS, pthread-stubs)
AC_CONFIG_FILES([Makefile
renderutil/Makefile
diff --git a/renderutil/Makefile.am b/renderutil/Makefile.am
index 3a5179884..d403aa34a 100644
--- a/renderutil/Makefile.am
+++ b/renderutil/Makefile.am
@@ -4,9 +4,9 @@ lib_LTLIBRARIES = libxcb-render-util.la
xcbinclude_HEADERS = xcb_renderutil.h
AM_CFLAGS = $(BASE_CFLAGS)
-AM_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS)
+AM_CPPFLAGS = $(XCB_CFLAGS) $(XCB_RENDER_CFLAGS) ${PTHREAD_STUBS_CFLAGS}
libxcb_render_util_la_SOURCES = cache.c util.c glyph.c
-libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS)
+libxcb_render_util_la_LIBADD = $(XCB_LIBS) $(XCB_RENDER_LIBS) ${PTHREAD_STUBS_LIBS}
libxcb_render_util_la_LDFLAGS = -no-undefined
pkgconfig_DATA = xcb-renderutil.pc

View File

@ -0,0 +1,10 @@
{
"name": "xcb-render-util",
"version": "0.3.9",
"description": "XCB convenience functions for the Render extension.",
"homepage": "https://xcb.freedesktop.org/",
"license": null,
"dependencies": [
"xcb"
]
}

View File

@ -4308,6 +4308,14 @@
"baseline": "6.0.0",
"port-version": 0
},
"libxkbcommon": {
"baseline": "1.4.1",
"port-version": 0
},
"libxkbfile": {
"baseline": "1.1.0",
"port-version": 0
},
"libxlsxwriter": {
"baseline": "1.1.4",
"port-version": 0
@ -7812,6 +7820,10 @@
"baseline": "1.14.1",
"port-version": 0
},
"xcb-render-util": {
"baseline": "0.3.9",
"port-version": 0
},
"xcb-util-m4": {
"baseline": "2022-01-24",
"port-version": 0

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "41ae34eb1eb104faea75a726f115e0e774c17d65",
"version": "1.4.1",
"port-version": 0
}
]
}

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "4b6df8dfd8284d03ff745d341c1269c191027811",
"version": "1.1.0",
"port-version": 0
}
]
}

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "c33cb9ea07d2bd0e8662ad5d8a1368aae2144da2",
"version": "0.3.9",
"port-version": 0
}
]
}