add emulators/wine (WIP)

This commit is contained in:
c0dev0id 2022-10-31 18:46:46 +01:00
commit 6ed82ef87d
11 changed files with 3758 additions and 0 deletions

78
emulators/wine/Makefile Normal file
View File

@ -0,0 +1,78 @@
V = 7.2
COMMENT = compatibility layer to run Windows applications
DISTNAME = wine-${V}
SHARED_LIBS += wine 1.0 # 1.0
CATEGORIES = emulators
HOMEPAGE = https://www.winehq.org/
MAINTAINER = Jan Klemkow <j.klemkow@wemelug.de>
# LGPL
PERMIT_PACKAGE = Yes
WANTLIB += ${COMPILER_LIBCXX} X11 Xau c c++abi m pthread xcb xcb-render
WANTLIB += xcb-shm Xdmcp
MASTER_SITES = https://dl.winehq.org/wine/source/7.x/
EXTRACT_SUFX = .tar.xz
#COMPILER = ports-gcc
#MODULES = ???
#BUILD_DEPENDS = devel/bison
#RUN_DEPENDS = ???
BUILD_DEPENDS = devel/bison
#TEST_DEPENDS = ???
#MAKE_FLAGS = ???
#MAKE_ENV = ???
#FAKE_FLAGS = ???
#TEST_FLAGS = ???
USE_GMAKE = Yes
CONFIGURE_STYLE = gnu
#CONFIGURE_SCRIPT = ??? (if other than configure)
CONFIGURE_ARGS = --verbose \
--disable-kerberos \
--enable-win64 \
--with-pthread \
--without-capi \
--without-coreaudio \
--without-dbus \
--without-gettext \
--without-gettextpo \
--without-gphoto \
--without-gssapi \
--without-gstreamer \
--without-inotify \
--without-krb5 \
--without-ldap \
--without-mingw \
--without-netapi \
--without-openal \
--without-opencl \
--without-osmesa \
--without-oss \
--without-pcap \
--without-pulse \
--without-sane \
--without-udev \
--without-usb \
--without-v4l2 \
--without-vkd3d \
--without-vulkan
EXTRALIBS = -lX11 -lXau -lc -lc++abi -lm -lpthread -lxcb -lxcb-render -lxcb-shm -lXdmcp
CONFIGURE_ENV = LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -L${X11BASE}/lib ${EXTRALIBS} -Wl" \
CPPFLAGS="${CFLAGS} -I${LOCALBASE}/include -I${X11BASE}/include" \
CFLAGS="${CFLAGS} -I${LOCALBASE}/include -I${X11BASE}/include" \
CPPBIN="$(CC)"
.include <bsd.port.mk>

2
emulators/wine/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (wine-7.2.tar.xz) = 38ZBUjyNvGZBaLYXREFjPZcSdUVr9n3i3KqZyNql7hU=
SIZE (wine-7.2.tar.xz) = 27191032

View File

@ -0,0 +1,11 @@
Index: dlls/nsiproxy.sys/ip.c
--- dlls/nsiproxy.sys/ip.c.orig
+++ dlls/nsiproxy.sys/ip.c
@@ -60,6 +60,7 @@
#endif
#ifdef HAVE_NETINET_IF_ETHER_H
+#include <net/if_arp.h>
#include <netinet/if_ether.h>
#endif

View File

@ -0,0 +1,21 @@
Index: dlls/nsiproxy.sys/tcp.c
--- dlls/nsiproxy.sys/tcp.c.orig
+++ dlls/nsiproxy.sys/tcp.c
@@ -43,6 +43,8 @@
#endif
#ifdef HAVE_NETINET_IN_PCB_H
+#include <net/route.h>
+#include <netinet/ip.h>
#include <netinet/in_pcb.h>
#endif
@@ -55,6 +57,8 @@
#endif
#ifdef HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp.h>
+#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#endif

View File

@ -0,0 +1,12 @@
Index: dlls/nsiproxy.sys/udp.c
--- dlls/nsiproxy.sys/udp.c.orig
+++ dlls/nsiproxy.sys/udp.c
@@ -53,6 +53,8 @@
#endif
#ifdef HAVE_NETINET_IN_PCB_H
+#include <net/route.h>
+#include <netinet/ip.h>
#include <netinet/in_pcb.h>
#endif

View File

@ -0,0 +1,16 @@
Force preloader to be built
Index: dlls/ntdll/unix/loader.c
--- dlls/ntdll/unix/loader.c.orig
+++ dlls/ntdll/unix/loader.c
@@ -367,11 +367,7 @@ SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4];
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
#endif
-#if defined(linux) || defined(__APPLE__)
static const BOOL use_preloader = TRUE;
-#else
-static const BOOL use_preloader = FALSE;
-#endif
static char *argv0;
static const char *bin_dir;

View File

@ -0,0 +1,66 @@
Index: dlls/ntdll/unix/signal_x86_64.c
--- dlls/ntdll/unix/signal_x86_64.c.orig
+++ dlls/ntdll/unix/signal_x86_64.c
@@ -206,6 +206,39 @@ __ASM_GLOBAL_FUNC( alloc_fs_sel,
#define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->uc_mcontext.__fpregs))
#define XState_sig(context) NULL
+#elif defined(__OpenBSD__)
+
+#include <amd64/trap.h>
+
+#define RAX_sig(context) ((context)->sc_rax)
+#define RBX_sig(context) ((context)->sc_rbx)
+#define RCX_sig(context) ((context)->sc_rcx)
+#define RDX_sig(context) ((context)->sc_rdx)
+#define RSI_sig(context) ((context)->sc_rsi)
+#define RDI_sig(context) ((context)->sc_rdi)
+#define RBP_sig(context) ((context)->sc_rbp)
+#define R8_sig(context) ((context)->sc_r8)
+#define R9_sig(context) ((context)->sc_r9)
+#define R10_sig(context) ((context)->sc_r10)
+#define R11_sig(context) ((context)->sc_r11)
+#define R12_sig(context) ((context)->sc_r12)
+#define R13_sig(context) ((context)->sc_r13)
+#define R14_sig(context) ((context)->sc_r14)
+#define R15_sig(context) ((context)->sc_r15)
+#define CS_sig(context) ((context)->sc_cs)
+#define DS_sig(context) ((context)->sc_ds)
+#define ES_sig(context) ((context)->sc_es)
+#define FS_sig(context) ((context)->sc_fs)
+#define GS_sig(context) ((context)->sc_gs)
+#define SS_sig(context) ((context)->sc_ss)
+#define EFL_sig(context) ((context)->sc_rflags)
+#define RIP_sig(context) ((context)->sc_rip)
+#define RSP_sig(context) ((context)->sc_rsp)
+#define TRAP_sig(context) ((context)->sc_trapno)
+#define ERROR_sig(context) ((context)->sc_err)
+#define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->sc_fpstate))
+#define XState_sig(context) NULL
+
#elif defined (__APPLE__)
#define RAX_sig(context) ((context)->uc_mcontext->__ss.__rax)
@@ -258,8 +291,13 @@ enum i386_trap_code
TRAP_x86_PAGEFLT = T_PAGEFLT, /* Page fault */
TRAP_x86_ARITHTRAP = T_ARITHTRAP, /* Floating point exception */
TRAP_x86_ALIGNFLT = T_ALIGNFLT, /* Alignment check exception */
+#if defined(__OpenBSD__)
+ TRAP_x86_MCHK = T_MCA, /* Machine check exception */
+ TRAP_x86_CACHEFLT = T_XMM /* Cache flush exception */
+#else
TRAP_x86_MCHK = T_MCHK, /* Machine check exception */
TRAP_x86_CACHEFLT = T_XMMFLT /* Cache flush exception */
+#endif
#else
TRAP_x86_DIVIDE = 0, /* Division by zero exception */
TRAP_x86_TRCTRAP = 1, /* Single-step exception */
@@ -2931,6 +2969,8 @@ void signal_init_thread( TEB *teb )
amd64_set_gsbase( teb );
#elif defined(__NetBSD__)
sysarch( X86_64_SET_GSBASE, &teb );
+#elif defined(__OpenBSD__)
+ sysarch( 0, &teb ); /* XXX: TODO */
#elif defined (__APPLE__)
__asm__ volatile (".byte 0x65\n\tmovq %0,%c1"
:

View File

@ -0,0 +1,47 @@
Index: dlls/ntdll/unix/socket.c
--- dlls/ntdll/unix/socket.c.orig
+++ dlls/ntdll/unix/socket.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <stdint.h>
#include <unistd.h>
#ifdef HAVE_IFADDRS_H
# include <ifaddrs.h>
@@ -1696,11 +1697,13 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_
case IOCTL_AFD_WINE_SET_IP_ADD_MEMBERSHIP:
return do_setsockopt( handle, io, IPPROTO_IP, IP_ADD_MEMBERSHIP, in_buffer, in_size );
+#ifndef __OpenBSD__
case IOCTL_AFD_WINE_SET_IP_ADD_SOURCE_MEMBERSHIP:
return do_setsockopt( handle, io, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, in_buffer, in_size );
case IOCTL_AFD_WINE_SET_IP_BLOCK_SOURCE:
return do_setsockopt( handle, io, IPPROTO_IP, IP_BLOCK_SOURCE, in_buffer, in_size );
+#endif
case IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT:
{
@@ -1764,8 +1767,10 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_
case IOCTL_AFD_WINE_SET_IP_DROP_MEMBERSHIP:
return do_setsockopt( handle, io, IPPROTO_IP, IP_DROP_MEMBERSHIP, in_buffer, in_size );
+#ifndef __OpenBSD__
case IOCTL_AFD_WINE_SET_IP_DROP_SOURCE_MEMBERSHIP:
return do_setsockopt( handle, io, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP, in_buffer, in_size );
+#endif
#ifdef IP_HDRINCL
case IOCTL_AFD_WINE_GET_IP_HDRINCL:
@@ -1899,8 +1904,10 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_
case IOCTL_AFD_WINE_SET_IP_TTL:
return do_setsockopt( handle, io, IPPROTO_IP, IP_TTL, in_buffer, in_size );
+#ifndef __OpenBSD__
case IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE:
return do_setsockopt( handle, io, IPPROTO_IP, IP_UNBLOCK_SOURCE, in_buffer, in_size );
+#endif
#ifdef IP_UNICAST_IF
case IOCTL_AFD_WINE_GET_IP_UNICAST_IF:

View File

@ -0,0 +1,12 @@
Index: dlls/ws2_32/unixlib.c
--- dlls/ws2_32/unixlib.c.orig
+++ dlls/ws2_32/unixlib.c
@@ -109,6 +109,8 @@ static pthread_mutex_t host_mutex = PTHREAD_MUTEX_INIT
#define MAP(x) {WS_ ## x, x}
+#define AI_ALL 0x00000100 /* XXX Why do we need this here? */
+
static const int addrinfo_flag_map[][2] =
{
MAP( AI_PASSIVE ),

1
emulators/wine/pkg/DESCR Normal file
View File

@ -0,0 +1 @@
Run windows stuff on OpenBSD

3492
emulators/wine/pkg/PLIST Normal file

File diff suppressed because it is too large Load Diff