Skip to content

Commit

Permalink
[many ports] Add X windows part 11/N (#27441)
Browse files Browse the repository at this point in the history
* [libice] replace macros with typedefs

* [libx11] fix dl linkage on linux and cleanup the cmake wrapper.

* [libxxf86vm] add port

* [libxtst] add port

* [libxt] add port

* [libxmu] add port

* [libxaw] add port

* bump port version

* v db

* fix libxpm and maybe cross libxt

* malloc returns null for cross builds

* fix typo

* fix stuff

* v db

* fix stuff ?

* WIP commit

* libxt cross fix

* add todo

* fix libxaw

* xcb add some fixes.

* fix todos

* fix arm ?

* fix path

* bump some versions

* shorten comment

* format manifest

* v db

* fix stuff

* ci baseline

* v db

* adjust libx11 wrapper again

* v db

* add license

* remove doubled entry from v db

* v db

* libxmu remove global variable.

* correctly split unistd.patch and apply it

* disable thread safe init in libx11 on windows

* v db

* libx11 append options correctly.

* v db

* still not correct.

* v db
  • Loading branch information
Neumann-A authored Nov 12, 2022
1 parent 59b58fc commit 6f7ffeb
Show file tree
Hide file tree
Showing 50 changed files with 1,073 additions and 27 deletions.
1 change: 1 addition & 0 deletions ports/kf5kio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ file(WRITE "${SOURCE_PATH}/.clang-format" "DisableFormat: true\nSortIncludes: fa
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON
-DBUILD_TESTING=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON
-DCMAKE_VERBOSE_MAKEFILE=ON
Expand Down
3 changes: 2 additions & 1 deletion ports/kf5kio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "kf5kio",
"version": "5.89.0",
"port-version": 1,
"port-version": 2,
"description": "Network transparent access to files and data",
"homepage": "https://api.kde.org/frameworks/kio/html/index.html",
"license": null,
"dependencies": [
"ecm",
{
Expand Down
1 change: 1 addition & 0 deletions ports/libice/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ vcpkg_from_gitlab(
SHA512 ad79cfbc3b1d51fb1f019bc088999ac8a64062a71667dbb4ffb62fe6d1b7dba7665944f64be6dcd27de08cc77e91512de97231db1e4ac018088727e90113d040
HEAD_REF master
PATCHES fix_build.patch
replace_macros.patch
)

set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")
Expand Down
15 changes: 15 additions & 0 deletions ports/libice/replace_macros.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/include/X11/ICE/ICElib.h b/include/X11/ICE/ICElib.h
index 402cbc8bd..506c18baf 100644
--- a/include/X11/ICE/ICElib.h
+++ b/include/X11/ICE/ICElib.h
@@ -32,8 +32,8 @@ Author: Ralph Mor, X Consortium
#include <X11/ICE/ICE.h>
#include <X11/Xfuncproto.h>

-#define Bool int
-#define Status int
+typedef int Bool;
+typedef int Status;
#define True 1
#define False 0

1 change: 1 addition & 0 deletions ports/libice/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "libice",
"version": "1.0.10",
"port-version": 1,
"description": "Inter-Client Exchange Library",
"homepage": "https://gitlab.freedesktop.org/xorg/lib/libice",
"license": "MIT-open-group",
Expand Down
14 changes: 14 additions & 0 deletions ports/libsm/missing-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/sm_genid.c b/src/sm_genid.c
index 3726eb1d2..082ce89fe 100644
--- a/src/sm_genid.c
+++ b/src/sm_genid.c
@@ -90,6 +90,9 @@ in this Software without prior written authorization from The Open Group.
# define X_INCLUDE_NETDB_H
# define XOS_USE_MTSAFE_NETDBAPI
# include <X11/Xos_r.h>
+# ifdef _MSC_VER
+# include <process.h>
+# endif

#endif /* WIN32 */

1 change: 1 addition & 0 deletions ports/libsm/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ vcpkg_from_gitlab(
SHA512 379e450d90e61d80d4fea8449a582b3eee3968bef137022053cb3bd51fa2815d8fccc43ff11e3b593c4a67ad64e93209c25111a20ac88e38c1f663cd274f5d56
HEAD_REF master
PATCHES windows.patch
missing-include.patch # avoids: warning C4013: '_getpid' undefined; assuming extern returning int
)

set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")
Expand Down
1 change: 1 addition & 0 deletions ports/libsm/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "libsm",
"version": "1.2.3",
"port-version": 1,
"description": "X Session Management Library",
"homepage": "https://gitlab.freedesktop.org/xorg/lib/libsm",
"license": null,
Expand Down
36 changes: 36 additions & 0 deletions ports/libx11/add_dl_pc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/configure.ac b/configure.ac
index 92b740b88..083e37ee5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,8 +106,12 @@ if test "x$ac_cv_search_dlopen" = xno; then
AC_DEFINE(HAVE_SHL_LOAD,1,
[Use shl_load to load shared libraries])
AC_CHECK_HEADERS([dl.h])
+ XLDLIB="$ac_cv_search_shl_load"
fi
else
+ if test "x$ac_cv_search_dlopen" != 'xnone required'; then
+ XLDLIB="$ac_cv_search_dlopen"
+ fi
AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries])
AC_CHECK_HEADERS([dlfcn.h])
fi
@@ -116,6 +120,7 @@ if test "x$ac_cv_header_dlfcn_h" = xyes -o "x$ac_cv_header_dl_h" = xyes; then
else
HAVE_LOADABLE_MODULES=no
fi
+AC_SUBST(XLDLIB)
AC_MSG_RESULT($HAVE_LOADABLE_MODULES)

AC_MSG_CHECKING([if loadable i18n module support should be enabled])
diff --git a/x11.pc.in b/x11.pc.in
index 25c7e7cd0..4ecf23e8d 100644
--- a/x11.pc.in
+++ b/x11.pc.in
@@ -11,5 +11,5 @@ Version: @PACKAGE_VERSION@
Requires: xproto @XKBPROTO_REQUIRES@
Requires.private: @X11_EXTRA_DEPS@
Cflags: -I${includedir} @XTHREAD_CFLAGS@
-Libs: -L${libdir} -lX11
+Libs: -L${libdir} -lX11 @XLDLIB@
Libs.private: @XTHREADLIB@
20 changes: 12 additions & 8 deletions ports/libx11/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,37 @@ vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/xorg
OUT_SOURCE_PATH SOURCE_PATH
REPO lib/libx11
REF 4c96f3567a8d045ee57b886fddc9618b71282530 #x11 v 1.7.3.1
SHA512 15c55b6283aec363f6af5b549584d487ec5a8c0f74b95dc44674ff50764abe5b9fa216e2af3c5408faf12d17b04e9433f0ad66da6e32a0dfef0427ca131ef23b
REF 3a30ada60c5217ada37b143b541c8e6f6284c7fa
SHA512 441f86ff8293d27459feaa93f85bcd4d02c6bd64fdb4d95199e5ee8a75340c2ce9b0fccd0b05840ce0de30ff3af3d21e6f37c81840e82b37dbddf082911b585d
HEAD_REF master
PATCHES cl.build.patch
io_include.patch
${PATCHES}
vcxserver.patch
add_dl_pc.patch
)

set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")

if(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS "")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(ENV{CPP} "cl_cpp_wrapper")
list(APPEND OPTIONS
--enable-loadable-i18n=no #Pointer conversion errors
--enable-unix-transport=no
--disable-thread-safety-constructor
)
endif()

set(OPTIONS "")
if(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS
list(APPEND OPTIONS
--enable-malloc0returnsnull=yes #Configure fails to run the test for some reason
--enable-loadable-i18n=no #Pointer conversion errors
--enable-ipv6
--enable-hyperv
--enable-tcp-transport
--with-launchd=no
--with-lint=no
--disable-selective-werror
--enable-unix-transport=no)
)
endif()
if(NOT XLSTPROC)
find_program(XLSTPROC NAMES "xsltproc${VCPKG_HOST_EXECUTABLE_SUFFIX}" PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/libxslt" PATH_SUFFIXES "bin")
Expand Down
22 changes: 15 additions & 7 deletions ports/libx11/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
set(Z_VCPKG_FIRST_X11_SEARCH OFF)
if(NOT X11_FOUND)
set(Z_VCPKG_FIRST_X11_SEARCH ON)
endif()
_find_package(${ARGS})
if(TARGET X11::xcb)
if(TARGET X11:X11)
target_link_libraries(X11::X11 INTERFACE X11:xcb)
if(TARGET X11::X11 AND Z_VCPKG_FIRST_X11_SEARCH)
target_link_libraries(X11::X11 INTERFACE ${CMAKE_DL_LIBS})
if(TARGET X11::xcb)
target_link_libraries(X11::X11 INTERFACE X11::xcb)
endif()
if(TARGET X11:xdmcp)
target_link_libraries(X11::xcb INTERFACE X11:xdmcp)
endif()
if(TARGET X11::xcb AND Z_VCPKG_FIRST_X11_SEARCH)
if(TARGET X11::Xdmcp)
set_property(TARGET X11::xcb APPEND PROPERTY INTERFACE_LINK_LIBRARIES X11::Xdmcp)
endif()
if(TARGET X11:xau)
target_link_libraries(X11::xcb INTERFACE X11:xau)
if(TARGET X11::Xau)
set_property(TARGET X11::xcb APPEND PROPERTY INTERFACE_LINK_LIBRARIES X11::Xau)
endif()
endif()
unset(Z_VCPKG_FIRST_X11_SEARCH)
3 changes: 1 addition & 2 deletions ports/libx11/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "libx11",
"version": "1.7.3.1",
"port-version": 1,
"version": "1.8.1",
"description": "The X Window System is a network-transparent window system that was designed at MIT.",
"homepage": "https://www.x.org/wiki/",
"license": "MIT",
Expand Down
45 changes: 45 additions & 0 deletions ports/libxaw/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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()
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

if(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS lt_cv_deplibs_check_method=pass_all) # since libxt will always be static
endif()

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/xorg
OUT_SOURCE_PATH SOURCE_PATH
REPO lib/libxaw
REF 9cfeba9db7f3ac4e0b351969c9ff5ab8f58ec7ef
SHA512 52c6e390aa90190ca528716eaa164ae2d79dd3345372ccc263ad1cfd2f1f49edc67df6ac34f2b9847bc099a3188d7d7161d7038565aae008cc12da373b0fc3b2
HEAD_REF master
PATCHES win.patch
)

set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS lt_cv_deplibs_check_method=pass_all
)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(makefile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Makefile")
if(EXISTS "${makefile}")
vcpkg_replace_string("${makefile}" ".dll.a" ".lib")
endif()
set(makefile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Makefile")
if(EXISTS "${makefile}")
vcpkg_replace_string("${makefile}" ".dll.a" ".lib")
endif()
endif()
vcpkg_install_make()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
endif()
17 changes: 17 additions & 0 deletions ports/libxaw/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "libxaw",
"version": "1.0.13",
"description": "X Athena Widget Set, based on the X Toolkit Intrinsics (Xt) Library",
"homepage": "https://gitlab.freedesktop.org/xorg/lib/libxaw",
"license": null,
"dependencies": [
"bzip2",
"libx11",
"libxext",
"libxmu",
"libxpm",
"libxt",
"xorg-macros",
"xproto"
]
}
98 changes: 98 additions & 0 deletions ports/libxaw/win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/Makefile.am b/Makefile.am
index 8e039a07f..e99d5d6d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,8 +9,12 @@ pkgconfig_DATA += xaw6.pc
if PLATFORM_DARWIN
DEFAULT_LIB = libXaw.6.@LIBEXT@
else
+if PLATFORM_WIN32
+DEFAULT_LIB = Xaw6.@LIBEXT@
+else
DEFAULT_LIB = libXaw6.@LIBEXT@
endif
+endif

endif

@@ -20,8 +24,12 @@ pkgconfig_DATA += xaw7.pc
if PLATFORM_DARWIN
DEFAULT_LIB = libXaw.7.@LIBEXT@
else
+if PLATFORM_WIN32
+DEFAULT_LIB = Xaw7.@LIBEXT@
+else
DEFAULT_LIB = libXaw7.@LIBEXT@
endif
+endif

endif

@@ -33,7 +41,7 @@ EXTRA_DIST = \
old-doc/CHANGES

install-exec-hook:
- cd $(DESTDIR)$(libdir) && rm -f libXaw.@LIBEXT@ && $(LN_S) $(DEFAULT_LIB) libXaw.@LIBEXT@
+ cd $(DESTDIR)$(libdir) && rm -f libXaw.@LIBEXT@ && $(LN_S) $(DEFAULT_LIB) Xaw.@LIBEXT@

uninstall-local:
-rm -f $(DESTDIR)$(libdir)/libXaw.@LIBEXT@
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index 875b97c6c..8223e3bf4 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -54,6 +54,10 @@ in this Software without prior written authorization from The Open Group.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#ifdef _WIN32
+#include <io.h>
+typedef int mode_t;
+#endif

#if (defined(ASCII_STRING) || defined(ASCII_DISK))
#include <X11/Xaw/AsciiText.h> /* for Widget Classes */
diff --git a/src/MultiSrc.c b/src/MultiSrc.c
index b4a123c14..dc2146913 100644
--- a/src/MultiSrc.c
+++ b/src/MultiSrc.c
@@ -74,6 +74,10 @@ in this Software without prior written authorization from The Open Group.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#ifdef _WIN32
+#include <io.h>
+typedef int mode_t;
+#endif

#define MAGIC_VALUE ((XawTextPosition)-1)
#define streq(a, b) (strcmp((a), (b)) == 0)
diff --git a/src/TextAction.c b/src/TextAction.c
index 43d1d3258..e083c908f 100644
--- a/src/TextAction.c
+++ b/src/TextAction.c
@@ -29,7 +29,12 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef _WIN32
+#define _WILLWINSOCK_
+#endif
#include <X11/Xos.h> /* for select() and struct timeval */
#include <ctype.h>
#include <X11/IntrinsicP.h>
@@ -3186,7 +3191,11 @@ InsertChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED)
FD_SET(ConnectionNumber(XtDisplay(w)), &fds);
(void)select(FD_SETSIZE, &fds, NULL, NULL, &tmval);
if (tmval.tv_usec != 500000)
+ #ifndef _WIN32
usleep(40000);
+ #else
+ Sleep(40);
+ #endif

StartAction(ctx, NULL);
#ifndef OLDXAW
14 changes: 14 additions & 0 deletions ports/libxmu/cl-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/EditresCom.c b/src/EditresCom.c
index 716a2b3c6..d570e19e4 100644
--- a/src/EditresCom.c
+++ b/src/EditresCom.c
@@ -34,6 +34,9 @@ in this Software without prior written authorization from The Open Group.
#include <X11/IntrinsicP.h> /* To get into the composite and core widget
structures. */
#include <X11/ObjectP.h> /* For XtIs<Classname> macros. */
+#ifdef _MSC_VER
+#define XTSTRINGDEFINES // Otherwise XtRImmediate is not a constant expression
+#endif
#include <X11/StringDefs.h> /* for XtRString. */
#include <X11/ShellP.h> /* for Application Shell Widget class. */

Loading

0 comments on commit 6f7ffeb

Please sign in to comment.