From ee197319b8dcbc0ca83586c716fd35f9aa6bea54 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 8 Feb 2025 20:26:45 -0300 Subject: [PATCH] ports: wine --- host-recipes/freetype | 17 +++ host-recipes/wine | 22 ++++ patches/wine/jinx-working-patch.patch | 146 ++++++++++++++++++++++++++ recipes/wine | 47 +++++++++ source-recipes/wine | 11 ++ 5 files changed, 243 insertions(+) create mode 100644 host-recipes/freetype create mode 100644 host-recipes/wine create mode 100644 patches/wine/jinx-working-patch.patch create mode 100644 recipes/wine create mode 100644 source-recipes/wine diff --git a/host-recipes/freetype b/host-recipes/freetype new file mode 100644 index 00000000..9416e512 --- /dev/null +++ b/host-recipes/freetype @@ -0,0 +1,17 @@ +name=freetype +revision=1 +from_source=freetype +imagedeps="gcc build-essential" +hostdeps="pkgconfig" + +configure() { + ${source_dir}/configure --prefix=${prefix} --enable-shared --disable-static +} + +build() { + make -j${parallelism} +} + +package() { + make install DESTDIR=${dest_dir} +} diff --git a/host-recipes/wine b/host-recipes/wine new file mode 100644 index 00000000..e7e3dad8 --- /dev/null +++ b/host-recipes/wine @@ -0,0 +1,22 @@ +name=wine +revision=1 +from_source=wine +imagedeps="build-essential" +hostdeps="freetype pkgconfig" + +configure() { + ${source_dir}/configure \ + --prefix=/usr \ + --disable-tests \ + --enable-win64 \ + --disable-win16 \ + --without-x +} + +build() { + make -j ${parallelism} +} + +package() { + make install DESTDIR=${dest_dir} +} diff --git a/patches/wine/jinx-working-patch.patch b/patches/wine/jinx-working-patch.patch new file mode 100644 index 00000000..28569811 --- /dev/null +++ b/patches/wine/jinx-working-patch.patch @@ -0,0 +1,146 @@ +diff --git wine-clean/configure wine-workdir/configure +index fe7464a..02f7a89 100755 +--- wine-clean/configure ++++ wine-workdir/configure +@@ -7891,12 +7891,14 @@ then : + printf "%s\n" "#define HAVE_SYS_CDIO_H 1" >>confdefs.h + + fi +-ac_fn_c_check_header_compile "$LINENO" "sys/epoll.h" "ac_cv_header_sys_epoll_h" "$ac_includes_default" +-if test "x$ac_cv_header_sys_epoll_h" = xyes +-then : +- printf "%s\n" "#define HAVE_SYS_EPOLL_H 1" >>confdefs.h + +-fi ++#ac_fn_c_check_header_compile "$LINENO" "sys/epoll.h" "ac_cv_header_sys_epoll_h" "$ac_includes_default" ++#if test "x$ac_cv_header_sys_epoll_h" = xyes ++#then : ++# printf "%s\n" "#define HAVE_SYS_EPOLL_H 1" >>confdefs.h ++# ++#fi ++ + ac_fn_c_check_header_compile "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default" + if test "x$ac_cv_header_sys_event_h" = xyes + then : +@@ -8059,12 +8061,12 @@ then : + printf "%s\n" "#define HAVE_SYS_VNODE_H 1" >>confdefs.h + + fi +-ac_fn_c_check_header_compile "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default" +-if test "x$ac_cv_header_sys_xattr_h" = xyes +-then : +- printf "%s\n" "#define HAVE_SYS_XATTR_H 1" >>confdefs.h ++#ac_fn_c_check_header_compile "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default" ++#if test "x$ac_cv_header_sys_xattr_h" = xyes ++#then : ++# printf "%s\n" "#define HAVE_SYS_XATTR_H 1" >>confdefs.h + +-fi ++#fi + ac_fn_c_check_header_compile "$LINENO" "syscall.h" "ac_cv_header_syscall_h" "$ac_includes_default" + if test "x$ac_cv_header_syscall_h" = xyes + then : +@@ -21003,12 +21005,12 @@ then : + printf "%s\n" "#define HAVE_DLINFO 1" >>confdefs.h + + fi +-ac_fn_c_check_func "$LINENO" "epoll_create" "ac_cv_func_epoll_create" +-if test "x$ac_cv_func_epoll_create" = xyes +-then : +- printf "%s\n" "#define HAVE_EPOLL_CREATE 1" >>confdefs.h +- +-fi ++#ac_fn_c_check_func "$LINENO" "epoll_create" "ac_cv_func_epoll_create" ++#if test "x$ac_cv_func_epoll_create" = xyes ++#then : ++# printf "%s\n" "#define HAVE_EPOLL_CREATE 1" >>confdefs.h ++# ++#fi + ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" + if test "x$ac_cv_func_fstatfs" = xyes + then : +diff --git wine-clean/dlls/ntdll/unix/signal_x86_64.c wine-workdir/dlls/ntdll/unix/signal_x86_64.c +index caa8524..9f4448d 100644 +--- wine-clean/dlls/ntdll/unix/signal_x86_64.c ++++ wine-workdir/dlls/ntdll/unix/signal_x86_64.c +@@ -75,6 +75,10 @@ + #include "unix_private.h" + #include "wine/debug.h" + ++#ifdef __astral__ ++#include ++#endif ++ + WINE_DEFAULT_DEBUG_CHANNEL(unwind); + WINE_DECLARE_DEBUG_CHANNEL(seh); + +@@ -292,6 +296,38 @@ static inline XMM_SAVE_AREA32 *FPU_sig( const ucontext_t *context ) + + #define XState_sig(context) NULL + ++#elif defined(__astral__) ++ ++#ifndef FP_XSTATE_MAGIC1 ++#define FP_XSTATE_MAGIC1 0x46505853 ++#endif ++ ++#define RAX_sig(context) ((context)->uc_mcontext.gregs[REG_RAX]) ++#define RBX_sig(context) ((context)->uc_mcontext.gregs[REG_RBX]) ++#define RCX_sig(context) ((context)->uc_mcontext.gregs[REG_RCX]) ++#define RDX_sig(context) ((context)->uc_mcontext.gregs[REG_RDX]) ++#define RSI_sig(context) ((context)->uc_mcontext.gregs[REG_RSI]) ++#define RDI_sig(context) ((context)->uc_mcontext.gregs[REG_RDI]) ++#define RBP_sig(context) ((context)->uc_mcontext.gregs[REG_RBP]) ++#define R8_sig(context) ((context)->uc_mcontext.gregs[REG_R8]) ++#define R9_sig(context) ((context)->uc_mcontext.gregs[REG_R9]) ++#define R10_sig(context) ((context)->uc_mcontext.gregs[REG_R10]) ++#define R11_sig(context) ((context)->uc_mcontext.gregs[REG_R11]) ++#define R12_sig(context) ((context)->uc_mcontext.gregs[REG_R12]) ++#define R13_sig(context) ((context)->uc_mcontext.gregs[REG_R13]) ++#define R14_sig(context) ((context)->uc_mcontext.gregs[REG_R14]) ++#define R15_sig(context) ((context)->uc_mcontext.gregs[REG_R15]) ++#define CS_sig(context) (*((WORD *)&(context)->uc_mcontext.gregs[REG_CSGSFS] + 0)) ++#define GS_sig(context) (*((WORD *)&(context)->uc_mcontext.gregs[REG_CSGSFS] + 1)) ++#define FS_sig(context) (*((WORD *)&(context)->uc_mcontext.gregs[REG_CSGSFS] + 2)) ++#define RSP_sig(context) ((context)->uc_mcontext.gregs[REG_RSP]) ++#define RIP_sig(context) ((context)->uc_mcontext.gregs[REG_RIP]) ++#define EFL_sig(context) ((context)->uc_mcontext.gregs[REG_EFL]) ++#define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) ++#define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) ++#define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->uc_mcontext.fpregs)) ++#define XState_sig(fpu) (((unsigned int *)fpu->Reserved4)[12] == FP_XSTATE_MAGIC1 ? (XSAVE_AREA_HEADER *)(fpu + 1) : NULL) ++ + #else + #error You must define the signal context functions for your platform + #endif +@@ -2604,6 +2640,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB + thread's gsbase. Have each thread record its gsbase pointer into its + TEB so alloc_tls_slot() can find it. */ + teb->Instrumentation[0] = thread_data->pthread_teb; ++ ++#elif defined(__astral__) ++ arch_ctl(ARCH_CTL_SET_GSBASE, teb); ++ arch_ctl(ARCH_CTL_GET_FSBASE, &thread_data->pthread_teb); ++ if (fs32_sel) alloc_fs_sel( fs32_sel >> 3, get_wow_teb( teb )); + #else + # error Please define setting %gs for your architecture + #endif +diff --git wine-clean/server/sock.c wine-workdir/server/sock.c +index 32d622a..539d5e3 100644 +--- wine-clean/server/sock.c ++++ wine-workdir/server/sock.c +@@ -4174,12 +4174,12 @@ static MIB_TCP_STATE get_tcp_socket_state( int fd ) + #define TCP_INFO TCP_CONNECTION_INFO + #define tcp_info tcp_connection_info + #endif +- ++/* + struct tcp_info info; + socklen_t info_len = sizeof(info); + if (getsockopt( fd, IPPROTO_TCP, TCP_INFO, &info, &info_len ) == 0) + return tcp_state_to_mib_state( info.tcpi_state ); +- ++*/ + if (debug_level) + fprintf( stderr, "getsockopt TCP_INFO failed: %s\n", strerror( errno ) ); + diff --git a/recipes/wine b/recipes/wine new file mode 100644 index 00000000..5c7a84b6 --- /dev/null +++ b/recipes/wine @@ -0,0 +1,47 @@ +name=wine +revision=1 +from_source=wine +imagedeps="build-essential" +hostdeps="xgcc xbinutils pkgconfig wine freetype" +deps="base libxcursor libxfixes libxi libxrandr libxrender libxxf86vm libx11 libxext mesa fontconfig sdl2 freetype glib xorgproto openssl" + +configure() { + ${source_dir}/configure \ + --host=x86_64-astral \ + --prefix=/usr \ + --disable-tests \ + --enable-win64 \ + --disable-win16 \ + --without-alsa \ + --without-capi \ + --without-cups \ + --without-dbus \ + --without-gettext \ + --without-gphoto \ + --without-gssapi \ + --without-krb5 \ + --without-mingw \ + --without-netapi \ + --without-opencl \ + --without-osmesa \ + --without-oss \ + --without-pcap \ + --without-pulse \ + --without-sane \ + --without-unwind \ + --without-usb \ + --without-v4l2 \ + --without-vulkan \ + --without-xcomposite \ + --without-xinerama \ + --with-x \ + --with-wine-tools="${base_dir}/host-builds/wine/" +} + +build() { + make -j ${parallelism} +} + +package() { + make install DESTDIR=${dest_dir} +} diff --git a/source-recipes/wine b/source-recipes/wine new file mode 100644 index 00000000..5b72a170 --- /dev/null +++ b/source-recipes/wine @@ -0,0 +1,11 @@ +name=wine +version=10.0 +source_method=tarball +tarball_url="https://dl.winehq.org/wine/source/${version}/wine-${version}.tar.xz" +tarball_sha512="effb41c5641993e2e52eaa825cc19b7d9846e084992c5a5b066ead2339b24384d320898a9cee347a9a87106bcb3b0f54c8cd2c8d4de3a887a658052ddd5168d6" +hostdeps="autoconf automake pkgconfig libtool autoconf-archive" +prepare() { + cp -v $(find /usr/local/share/automake* -name config.sub) tools/ + cp -v $(find /usr/local/share/automake* -name config.guess) tools/ + chmod +x configure +}