diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libxt | |
Diffstat (limited to 'vcpkg/ports/libxt')
| -rw-r--r-- | vcpkg/ports/libxt/add-missing-process-h.patch | 14 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/cc_for_build.patch | 25 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/getcwd.patch | 14 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/globals.patch | 96 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/portfile.cmake | 113 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/vcpkg.json | 24 | ||||
| -rw-r--r-- | vcpkg/ports/libxt/windows_build.patch | 178 |
7 files changed, 464 insertions, 0 deletions
diff --git a/vcpkg/ports/libxt/add-missing-process-h.patch b/vcpkg/ports/libxt/add-missing-process-h.patch new file mode 100644 index 0000000..f38db36 --- /dev/null +++ b/vcpkg/ports/libxt/add-missing-process-h.patch @@ -0,0 +1,14 @@ +diff --git a/src/Shell.c b/src/Shell.c +index fcf10a5..67e24bf 100644 +--- a/src/Shell.c ++++ b/src/Shell.c +@@ -90,6 +90,9 @@ in this Software without prior written authorization from The Open Group. + #ifdef HAVE_UNISTD_H + #include <unistd.h> + #endif ++#ifdef _WIN32 ++#include <process.h> ++#endif // _WIN32 + + #ifdef EDITRES + #include <X11/Xmu/Editres.h> diff --git a/vcpkg/ports/libxt/cc_for_build.patch b/vcpkg/ports/libxt/cc_for_build.patch new file mode 100644 index 0000000..2be319f --- /dev/null +++ b/vcpkg/ports/libxt/cc_for_build.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile.am b/Makefile.am +index f8d5a6b72..47f847bbd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,7 +19,7 @@ + # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + # PERFORMANCE OF THIS SOFTWARE. + +-SUBDIRS = util src include man specs test ++SUBDIRS = src include man specs test + + ACLOCAL_AMFLAGS = -I m4 + +diff --git a/src/Makefile.am b/src/Makefile.am +index a26e10d7a..e8a520a2f 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -104,5 +104,5 @@ $(BUILT_SOURCE): $(top_builddir)/util/makestrs$(EXEEXT) + $(AM_V_at)cp Shell.h $(top_builddir)/include/X11 + $(AM_V_at)rm StringDefs.h Shell.h + +-$(top_builddir)/util/makestrs$(EXEEXT) : +- $(am__cd) $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) ++# $(top_builddir)/util/makestrs$(EXEEXT) : ++# $(am__cd) $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) diff --git a/vcpkg/ports/libxt/getcwd.patch b/vcpkg/ports/libxt/getcwd.patch new file mode 100644 index 0000000..349c2bf --- /dev/null +++ b/vcpkg/ports/libxt/getcwd.patch @@ -0,0 +1,14 @@ +diff --git a/src/Converters.c b/src/Converters.c +index 4c2762356..5376a34fb 100644 +--- a/src/Converters.c ++++ b/src/Converters.c +@@ -82,6 +82,9 @@ in this Software without prior written authorization from The Open Group. + #include <X11/Xlocale.h> + #include <errno.h> /* for StringToDirectoryString */ ++#ifdef _MSC_VER ++#include <direct.h> ++#endif + + #define IsNewline(str) ((str) == '\n') + #define IsWhitespace(str) ((str)== ' ' || (str) == '\t') + diff --git a/vcpkg/ports/libxt/globals.patch b/vcpkg/ports/libxt/globals.patch new file mode 100644 index 0000000..8a2c320 --- /dev/null +++ b/vcpkg/ports/libxt/globals.patch @@ -0,0 +1,96 @@ +diff --git a/util/StrDefs.ct b/util/StrDefs.ct +index b597b2051..b682255ad 100644 +--- a/util/StrDefs.ct ++++ b/util/StrDefs.ct +@@ -46,6 +46,8 @@ SOFTWARE. + ******************************************************************/ + + #define Const const ++#include "StringDefs.h" ++#include "Shell.h" + + <<<STRING_TABLE_GOES_HERE>>> + +diff --git a/util/StrDefs.ht b/util/StrDefs.ht +index 2ce20562f..ceab2610f 100644 +--- a/util/StrDefs.ht ++++ b/util/StrDefs.ht +@@ -52,6 +52,18 @@ SOFTWARE. + #define _XtStringDefs_h_Const const + #endif + ++#ifndef XT_EXTERN_API ++# if defined(_MSC_VER) && defined(XT_DLL_EXPORTS) ++# ifdef XT_BUILD ++# define XT_EXTERN_API extern __declspec(dllexport) ++# else ++# define XT_EXTERN_API extern __declspec(dllimport) ++# endif ++# else ++# define XT_EXTERN_API extern ++# endif ++#endif ++ + <<<STRING_TABLE_GOES_HERE>>> + + #ifndef XTSTRINGDEFINES +diff --git a/util/string.list b/util/string.list +index 49ba7476e..753c592b3 100644 +--- a/util/string.list ++++ b/util/string.list +@@ -6,7 +6,7 @@ + + #prefix Xt + #feature XTSTRINGDEFINES +-#externref extern ++#externref XT_EXTERN_API + #externdef + ! note that the trailing space is required in the #externdef line. + #ctmpl util/StrDefs.ct +diff --git a/util/Shell.ht b/util/Shell.ht +index 500e0fd75..ac8fc2a2e 100644 +--- a/util/Shell.ht ++++ b/util/Shell.ht +@@ -64,6 +64,18 @@ SOFTWARE. + #define _XtShell_h_Const const + #endif + ++#ifndef XT_EXTERN_API ++# if defined(_MSC_VER) && defined(XT_DLL_EXPORTS) ++# ifdef XT_BUILD ++# define XT_EXTERN_API extern __declspec(dllexport) ++# else ++# define XT_EXTERN_API extern __declspec(dllimport) ++# endif ++# else ++# define XT_EXTERN_API extern ++# endif ++#endif ++ + <<<STRING_TABLE_GOES_HERE>>> + + #ifndef XTSTRINGDEFINES +diff --git a/include/X11/Intrinsic.h b/include/X11/Intrinsic.h +index 559697aa0..d11eb0955 100644 +--- a/include/X11/Intrinsic.h ++++ b/include/X11/Intrinsic.h +@@ -106,7 +106,18 @@ typedef char *String; + #define externalref globalref + #define externaldef(psect) globaldef {"psect"} noshare + #else +-#define externalref extern ++#ifndef XT_EXTERN_API ++# if defined(_MSC_VER) && defined(XT_DLL_EXPORTS) ++# ifdef XT_BUILD ++# define XT_EXTERN_API extern __declspec(dllexport) ++# else ++# define XT_EXTERN_API extern __declspec(dllimport) ++# endif ++# else ++# define XT_EXTERN_API extern ++# endif ++#endif ++#define externalref XT_EXTERN_API + #define externaldef(psect) + #endif /* VMS */ + diff --git a/vcpkg/ports/libxt/portfile.cmake b/vcpkg/ports/libxt/portfile.cmake new file mode 100644 index 0000000..7109c42 --- /dev/null +++ b/vcpkg/ports/libxt/portfile.cmake @@ -0,0 +1,113 @@ +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()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+ # Downstream uses &widgetClassRec in a const context which doesn't work
+ # if this is a dynamic library since the memory adress is only known at runtime
+endif()
+
+if(VCPKG_CROSSCOMPILING)
+ set(PATCHES cc_for_build.patch)
+endif()
+
+vcpkg_from_gitlab(
+ GITLAB_URL https://gitlab.freedesktop.org/xorg
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO lib/libxt
+ REF "libXt-${VERSION}"
+ SHA512 7cb22be9706bd7d089e84c09a99597f730ca858a9f8134d2741916b28cd4786e236beaad568c8b7ab8cdcfdea1c49140cefac528244bab8c94d48dc4729267e8
+ HEAD_REF master
+ PATCHES
+ windows_build.patch
+ globals.patch
+ getcwd.patch
+ add-missing-process-h.patch
+ ${PATCHES}
+)
+
+set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/xorg/aclocal/\"")
+
+string(APPEND VCPKG_C_FLAGS " -DXT_BUILD")
+string(APPEND VCPKG_CXX_FLAGS " -DXT_BUILD")
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS)
+ string(APPEND VCPKG_C_FLAGS " -DXT_DLL_EXPORTS")
+ string(APPEND VCPKG_CXX_FLAGS " -DXT_DLL_EXPORTS")
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ z_vcpkg_get_cmake_vars(cmake_vars_file)
+ include("${cmake_vars_file}")
+ if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ vcpkg_find_acquire_program(CLANG)
+ cmake_path(GET CLANG PARENT_PATH CLANG_PARENT_PATH)
+ set(CLANG_CL "${CLANG_PARENT_PATH}/clang-cl.exe")
+ file(READ "${cmake_vars_file}" contents)
+ string(APPEND contents "\nset(VCPKG_DETECTED_CMAKE_C_COMPILER \"${CLANG_CL}\")")
+ string(APPEND contents "\nset(VCPKG_DETECTED_CMAKE_CXX_COMPILER \"${CLANG_CL}\")")
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
+ string(APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \" -m32\")")
+ string(APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \" -m32\")")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
+ string(APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \"--target=arm64-pc-win32 \")")
+ string(APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \"--target=arm64-pc-win32 \")")
+ endif()
+ file(WRITE "${cmake_vars_file}" "${contents}")
+ endif()
+ set(cmake_vars_file "${cmake_vars_file}" CACHE INTERNAL "") # Don't run z_vcpkg_get_cmake_vars twice
+ set(OPTIONS --disable-selective-werror)
+endif()
+
+
+
+vcpkg_configure_make(
+ SOURCE_PATH "${SOURCE_PATH}"
+ AUTOCONFIG
+ OPTIONS
+ --with-xfile-search-path=X11
+ --with-appdefaultdir=share/X11/app-defaults
+ --enable-malloc0returnsnull=yes
+ xorg_cv_malloc0_returns_null=yes
+ ${OPTIONS}
+)
+
+if(VCPKG_CROSSCOMPILING)
+ file(INSTALL "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/makestrs${VCPKG_HOST_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/util/")
+ if(NOT VCPKG_BUILD_TYPE)
+ file(INSTALL "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/makestrs${VCPKG_HOST_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/util/")
+ endif()
+endif()
+
+vcpkg_install_make()
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/X11/StringDefs.h" "defined(XT_DLL_EXPORTS)" "1")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/X11/Shell.h" "defined(XT_DLL_EXPORTS)" "1")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/X11/Intrinsic.h" "defined(XT_DLL_EXPORTS)" "1")
+ # XTSTRINGDEFINES is required since the "strings" are often used in a const context which doesn't work if they are adresses of a global array in another dll
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/X11/StringDefs.h" "#define _XtStringDefs_h_" "#define _XtStringDefs_h_\n#define XTSTRINGDEFINES")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/X11/Shell.h" "#define _XtShell_h" "#define _XtShell_h\n#define XTSTRINGDEFINES")
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/xt.pc" " -lXt" " -lXt -lws2_32")
+ if(NOT VCPKG_BUILD_TYPE)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/xt.pc" " -lXt" " -lXt -lws2_32")
+ endif()
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+if(NOT VCPKG_CROSSCOMPILING)
+ file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/util/makestrs${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+endif()
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+endif()
diff --git a/vcpkg/ports/libxt/vcpkg.json b/vcpkg/ports/libxt/vcpkg.json new file mode 100644 index 0000000..1376103 --- /dev/null +++ b/vcpkg/ports/libxt/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "libxt", + "version": "1.3.0", + "description": "X Toolkit Intrinsics library", + "homepage": "https://gitlab.freedesktop.org/xorg/lib/libxt", + "license": null, + "dependencies": [ + "bzip2", + "glib", + "libice", + "libsm", + "libx11", + { + "name": "libxt", + "host": true + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true + }, + "xorg-macros", + "xproto" + ] +} diff --git a/vcpkg/ports/libxt/windows_build.patch b/vcpkg/ports/libxt/windows_build.patch new file mode 100644 index 0000000..9ee1a73 --- /dev/null +++ b/vcpkg/ports/libxt/windows_build.patch @@ -0,0 +1,178 @@ +diff --git a/include/X11/Intrinsic.h b/include/X11/Intrinsic.h +index cf8d3fe41..559697aa0 100644 +--- a/include/X11/Intrinsic.h ++++ b/include/X11/Intrinsic.h +@@ -50,6 +50,10 @@ in this Software without prior written authorization from The Open Group. + #ifndef _XtIntrinsic_h + #define _XtIntrinsic_h + ++#ifdef WIN32 ++#define _WILLWINSOCK_ ++#endif ++ + #include <X11/Xlib.h> + #include <X11/Xutil.h> + #include <X11/Xresource.h> +diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h +index a8b7f48cf..99c5349e7 100644 +--- a/include/X11/IntrinsicI.h ++++ b/include/X11/IntrinsicI.h +@@ -48,11 +48,12 @@ SOFTWARE. + #ifndef _XtintrinsicI_h + #define _XtintrinsicI_h + +-#include "Xtos.h" +-#include "IntrinsicP.h" + #ifdef WIN32 + #define _WILLWINSOCK_ + #endif ++ ++#include "Xtos.h" ++#include "IntrinsicP.h" + #include <X11/Xos.h> + + #include "Object.h" +diff --git a/src/Convert.c b/src/Convert.c +index 9b2d465b3..5c89850f1 100644 +--- a/src/Convert.c ++++ b/src/Convert.c +@@ -71,6 +71,9 @@ in this Software without prior written authorization from The Open Group. + #ifdef HAVE_CONFIG_H + #include <config.h> + #endif ++#ifdef _MSC_VER ++#include <direct.h> ++#endif + #include "IntrinsicI.h" + #include "StringDefs.h" + #include "Intrinsic.h" +diff --git a/src/Core.c b/src/Core.c +index d728a9286..5ee0d2fe8 100644 +--- a/src/Core.c ++++ b/src/Core.c +@@ -80,6 +80,9 @@ in this Software without prior written authorization from The Open Group. + #include "RectObjP.h" + #include "ThreadsI.h" + #include "StringDefs.h" ++#ifndef None ++#define None 0L ++#endif + + /****************************************************************** + * +diff --git a/src/Error.c b/src/Error.c +index 4bf4713e5..a64784a6f 100644 +--- a/src/Error.c ++++ b/src/Error.c +@@ -74,7 +74,9 @@ in this Software without prior written authorization from The Open Group. + #include "IntrinsicI.h" + #include <stdio.h> + #include <stdlib.h> +- ++#ifndef None ++#define None 0L ++#endif + /* The error handlers in the application context aren't used since we can't + come up with a uniform way of using them. If you can, define + GLOBALERRORS to be FALSE (or 0). */ +diff --git a/src/Event.c b/src/Event.c +index dadcedeb8..1eafc0143 100644 +--- a/src/Event.c ++++ b/src/Event.c +@@ -74,7 +74,9 @@ in this Software without prior written authorization from The Open Group. + #include "IntrinsicI.h" + #include "Shell.h" + #include "StringDefs.h" +- ++#ifndef None ++#define None 0L ++#endif + typedef struct _XtEventRecExt { + int type; + XtPointer select_data[1]; /* actual dimension is [mask] */ +diff --git a/src/GCManager.c b/src/GCManager.c +index 6031248e5..205f1cbe3 100644 +--- a/src/GCManager.c ++++ b/src/GCManager.c +@@ -72,7 +72,9 @@ in this Software without prior written authorization from The Open Group. + #include <config.h> + #endif + #include "IntrinsicI.h" +- ++#ifndef None ++#define None 0L ++#endif + typedef struct _GCrec { + unsigned char screen; /* Screen for GC */ + unsigned char depth; /* Depth for GC */ +diff --git a/src/Geometry.c b/src/Geometry.c +index 3704cb63d..2f00cdcca 100644 +--- a/src/Geometry.c ++++ b/src/Geometry.c +@@ -75,6 +75,10 @@ in this Software without prior written authorization from The Open Group. + #include "ShellP.h" + #include "ShellI.h" + ++#ifndef None ++#define None 0L ++#endif ++ + static void + ClearRectObjAreas(RectObj r, XWindowChanges *old) + { +diff --git a/src/Keyboard.c b/src/Keyboard.c +index da6fa11aa..7d9271f45 100644 +--- a/src/Keyboard.c ++++ b/src/Keyboard.c +@@ -80,6 +80,10 @@ in this Software without prior written authorization from The Open Group. + #include "PassivGraI.h" + #include "EventI.h" + ++#ifndef None ++#define None 0L ++#endif ++ + #define _GetWindowedAncestor(w) (XtIsWidget(w) ? w : _XtWindowedAncestor(w)) + + /* InActiveSubtree cache of the current focus source and its ancestors */ +diff --git a/util/makestrs.c b/util/makestrs.c +index 4d5c0a6b7..b64e42eea 100644 +--- a/util/makestrs.c ++++ b/util/makestrs.c +@@ -29,7 +29,9 @@ in this Software without prior written authorization from The Open Group. + #include <stdio.h> + #include <string.h> + #include <stdlib.h> ++#ifdef HAVE_UNISTD_H + #include <unistd.h> ++#endif + + typedef struct _TableEnt { + struct _TableEnt *next; +diff --git a/src/Initialize.c b/src/Initialize.c +index 8ae54b47c..765479603 100644 +--- a/src/Initialize.c ++++ b/src/Initialize.c +@@ -246,7 +246,7 @@ _XtInherit(void) + * cygwin-xfree: http://www.cygwin.com/ml/cygwin-xfree/2003-10/msg00000.html + */ + +-#ifdef __x86_64__ ++#if defined(__x86_64__) || defined(_M_X64) + asm(".section .trampoline, \"dwx\" \n\ + .globl _XtInherit \n\ + _XtInherit: \n\ +diff --git a/src/Shell.c b/src/Shell.c +index 07713cc25..fcf10a5e2 100644 +--- a/src/Shell.c ++++ b/src/Shell.c +@@ -87,7 +87,9 @@ in this Software without prior written authorization from The Open Group. + #include <X11/ICE/ICElib.h> + #include <stdio.h> + #include <stdlib.h> ++#ifdef HAVE_UNISTD_H + #include <unistd.h> ++#endif + + #ifdef EDITRES + #include <X11/Xmu/Editres.h> |