diff --git a/bootstrap.d/app-emulation.y4.yml b/bootstrap.d/app-emulation.y4.yml index c731ac983..97319b2e1 100644 --- a/bootstrap.d/app-emulation.y4.yml +++ b/bootstrap.d/app-emulation.y4.yml @@ -5,6 +5,18 @@ sources: tag: 'v9.2.3' version: '9.2.3' + - name: wine + subdir: 'ports' + git: 'https://gitlab.winehq.org/wine/wine.git' + tag: 'wine-10.12' + version: '10.12' + tools_required: + - host-automake-v1.15 + regenerate: + - args: ['cp', + '@BUILD_ROOT@/tools/host-automake-v1.15/share/automake-1.15/config.sub', + '@THIS_SOURCE_DIR@/tools/'] + tools: - name: host-qemu labels: [aarch64, riscv64, not-on-xbbs] @@ -31,6 +43,64 @@ tools: install: - args: ['ninja', 'install'] + - name: host-wine-tools + architecture: noarch + from_source: wine + tools_required: + - host-freetype + - host-pkg-config + - virtual: pkgconfig-for-host + program_name: host-pkg-config + configure: + - args: + - '@THIS_SOURCE_DIR@/configure' + - '--prefix=@PREFIX@' + - '--enable-win64' + - '--disable-tests' + - '--disable-win16' + - '--without-alsa' + - '--without-capi' + - '--without-cups' + - '--without-dbus' + - '--without-gettext' + - '--without-gphoto' + - '--without-gssapi' + - '--without-gstreamer' + - '--without-krb5' + - '--without-mingw' + - '--without-netapi' + - '--without-opencl' + - '--without-osmesa' + - '--without-oss' + - '--without-pcap' + - '--without-pulse' + - '--without-sane' + - '--without-sdl' + - '--without-unwind' + - '--without-usb' + - '--without-v4l2' + - '--without-vulkan' + - '--without-xcomposite' + - '--without-xinerama' + - '--without-xinput2' + - '--without-xshape' + - '--without-xcursor' + - '--without-xinput' + - '--without-xfixes' + - '--without-xrandr' + - '--without-xrender' + - '--without-xxf86vm' + - '--without-xshm' + - '--without-gnutls' + - '--without-opengl' + - '--without-udev' + environ: + PKG_CONFIG_LIBDIR: '@BUILD_ROOT@/tools/host-freetype/lib/pkgconfig' + compile: + - args: ['make', '-j@PARALLELISM@'] + install: + - args: ['make', 'install', '-j@PARALLELISM@'] + packages: - name: qemu architecture: '@OPTION:arch@' @@ -85,3 +155,81 @@ packages: DESTDIR: '@THIS_COLLECT_DIR@' quiet: true + - name: wine + architecture: '@OPTION:arch@' + metadata: + summary: Free implementation of Windows(tm) on Unix, without external patchsets + description: Free implementation of Windows(tm) on Unix, without external patchsets + spdx: 'LGPL-2.1-or-later BSD-2 IJG MIT OPENLDAP ZLIB gsm libpng2 libtiff' + website: 'https://www.winehq.org' + maintainer: 'Qwinci ' + categories: ['app-emulation'] + from_source: wine + tools_required: + - host-pkg-config + - system-gcc + - host-llvm-toolchain + - virtual: pkgconfig-for-target + triple: '@OPTION:arch-triple@' + - host-wine-tools + pkgs_required: + - mlibc + - libxcursor + - libxfixes + - libxi + - libxrandr + - libxrender + - libxxf86vm + - libxshmfence + - libx11 + - libxext + - mesa + - fontconfig + - sdl2 + - gnutls + - freetype + - glib + - gst-plugins-base + - gstreamer + - systemd + - xorg-proto + - managarm-system + configure: + - args: + - '@THIS_SOURCE_DIR@/configure' + - '--host=@OPTION:arch-triple@' + - '--prefix=/usr' + - '--disable-tests' + - '--enable-archs=@OPTION:arch@' + - '--enable-tools=yes' + - '--enable-win64' # We want 64 bit after all + - '--disable-win16' # Don't care about 16 bit + - '--without-alsa' + - '--without-capi' + - '--without-cups' + - '--without-dbus' + - '--without-gettext' + - '--without-gphoto' + - '--without-gssapi' + - '--without-krb5' + - '--without-mingw' # Might want this later, but for now we don't have it + - '--without-netapi' + - '--without-opencl' + - '--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=@BUILD_ROOT@/tool-builds/host-wine-tools/' + build: + - args: ['make', '-j@PARALLELISM@'] + - args: ['make', 'install', '-j@PARALLELISM@'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + quiet: true diff --git a/bootstrap.d/media-libs.y4.yml b/bootstrap.d/media-libs.y4.yml index 39ea2de77..9fb582a19 100644 --- a/bootstrap.d/media-libs.y4.yml +++ b/bootstrap.d/media-libs.y4.yml @@ -2,6 +2,50 @@ import: - !managarm --- +sources: + - name: freetype + subdir: 'ports' + git: 'https://gitlab.freedesktop.org/freetype/freetype.git' + tag: 'VER-2-13-3' + version: '2.13.3' + tools_required: + - host-autoconf-v2.69 + - host-automake-v1.15 + - host-libtool + - host-pkg-config + regenerate: + - args: ['./autogen.sh'] + isolate_network: false + environ: + NOCONFIGURE: '1' + - args: ['cp', + '@BUILD_ROOT@/tools/host-automake-v1.15/share/automake-1.15/config.sub', + '@THIS_SOURCE_DIR@/builds/unix/'] + # Enable GX/AAT and OpenType table validation + - args: | + sed -ri "s:.*(AUX_MODULES.*valid):\1:" @THIS_SOURCE_DIR@/modules.cfg + # Enable subpixel rendering + - args: | + sed -r "s:.*(#.*SUBPIXEL_RENDERING) .*:\1:" -i @THIS_SOURCE_DIR@/include/freetype/config/ftoption.h + +tools: + - name: host-freetype + architecture: noarch + from_source: freetype + configure: + - args: + - '@THIS_SOURCE_DIR@/configure' + - '--prefix=@PREFIX@' + - '--disable-static' + - '--with-harfbuzz=no' + - '--with-zlib=no' + - '--with-png=no' + - '--with-bzip2=no' + compile: + - args: ['make', '-j@PARALLELISM@'] + install: + - args: ['make', 'install'] + packages: - name: alsa-lib architecture: '@OPTION:arch@' @@ -187,30 +231,7 @@ packages: website: 'https://www.freetype.org/' maintainer: "Dennis Bonke " categories: ['media-libs'] - source: - subdir: 'ports' - git: 'https://gitlab.freedesktop.org/freetype/freetype.git' - tag: 'VER-2-13-3' - version: '2.13.3' - tools_required: - - host-autoconf-v2.69 - - host-automake-v1.15 - - host-libtool - - host-pkg-config - regenerate: - - args: ['./autogen.sh'] - isolate_network: false - environ: - NOCONFIGURE: '1' - - args: ['cp', - '@BUILD_ROOT@/tools/host-automake-v1.15/share/automake-1.15/config.sub', - '@THIS_SOURCE_DIR@/builds/unix/'] - # Enable GX/AAT and OpenType table validation - - args: | - sed -ri "s:.*(AUX_MODULES.*valid):\1:" @THIS_SOURCE_DIR@/modules.cfg - # Enable subpixel rendering - - args: | - sed -r "s:.*(#.*SUBPIXEL_RENDERING) .*:\1:" -i @THIS_SOURCE_DIR@/include/freetype/config/ftoption.h + from_source: freetype tools_required: - system-gcc pkgs_required: diff --git a/patches/wine/0001-Add-managarm-support.patch b/patches/wine/0001-Add-managarm-support.patch new file mode 100644 index 000000000..20e58519f --- /dev/null +++ b/patches/wine/0001-Add-managarm-support.patch @@ -0,0 +1,140 @@ +From 30c3167cf5793331ea1479483073a44aff7d079a Mon Sep 17 00:00:00 2001 +From: Qwinci +Date: Sat, 2 Aug 2025 17:26:21 +0300 +Subject: [PATCH] Add managarm support + +--- + dlls/ntdll/unix/signal_x86_64.c | 39 +++++++++++++++++++++++++++++++++ + dlls/ntdll/unix/system.c | 2 +- + dlls/ntdll/unix/virtual.c | 2 +- + server/change.c | 4 ++-- + tools/wrc/parser.l | 1 + + 5 files changed, 44 insertions(+), 4 deletions(-) + +diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c +index 6ec662b..a36a1bc 100644 +--- a/dlls/ntdll/unix/signal_x86_64.c ++++ b/dlls/ntdll/unix/signal_x86_64.c +@@ -83,6 +83,11 @@ extern void _thread_set_tsd_base(uint64_t); + #include "unix_private.h" + #include "wine/debug.h" + ++#ifdef __managarm__ ++#include ++#include ++#endif ++ + WINE_DEFAULT_DEBUG_CHANNEL(unwind); + WINE_DECLARE_DEBUG_CHANNEL(seh); + +@@ -300,6 +305,38 @@ static inline XMM_SAVE_AREA32 *FPU_sig( const ucontext_t *context ) + + #define XState_sig(context) NULL + ++#elif defined(__managarm__) ++ ++#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 +@@ -2609,6 +2646,8 @@ void init_syscall_frame( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, + sysarch( X86_64_SET_GSBASE, &teb ); + #elif defined (__APPLE__) + thread_data->pthread_teb = mac_thread_gsbase(); ++#elif defined(__managarm__) ++ helWriteGsBase(teb); + #else + # error Please define setting %gs for your architecture + #endif +diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c +index e486da4..6d4f1ff 100644 +--- a/dlls/ntdll/unix/system.c ++++ b/dlls/ntdll/unix/system.c +@@ -1889,7 +1889,7 @@ static void create_smbios_processors( struct smbios_buffer *buf ) + + #undef ADD_STR + +-#ifdef linux ++#if defined(linux) || defined(__managarm) + + static const char *get_smbios_string( const char *path, char *str, size_t size ) + { +diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c +index e733e3f..bef4bf5 100644 +--- a/dlls/ntdll/unix/virtual.c ++++ b/dlls/ntdll/unix/virtual.c +@@ -73,7 +73,7 @@ + #undef host_page_size + #endif + +-#if defined(HAVE_LINUX_USERFAULTFD_H) && defined(HAVE_LINUX_FS_H) ++#if defined(HAVE_LINUX_USERFAULTFD_H) && defined(HAVE_LINUX_FS_H) && !defined(__managarm__) + # include + # include + #if defined(UFFD_FEATURE_WP_ASYNC) && defined(PM_SCAN_WP_MATCHING) +diff --git a/server/change.c b/server/change.c +index 5bcd067..0679ae4 100644 +--- a/server/change.c ++++ b/server/change.c +@@ -51,7 +51,7 @@ + + /* dnotify support */ + +-#ifdef linux ++#if defined(linux) && !defined(__managarm__) + #ifndef F_NOTIFY + #define F_NOTIFY 1026 + #define DN_ACCESS 0x00000001 /* File accessed */ +@@ -232,7 +232,7 @@ static void release_dir_cache_entry( struct dir *dir ) + + static void dnotify_adjust_changes( struct dir *dir ) + { +-#if defined(F_SETSIG) && defined(F_NOTIFY) ++#if defined(F_SETSIG) && defined(F_NOTIFY) && !defined(__managarm__) + int fd = get_unix_fd( dir->fd ); + unsigned int filter = dir->filter; + unsigned int val; +diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l +index 3c3cf97..3730678 100644 +--- a/tools/wrc/parser.l ++++ b/tools/wrc/parser.l +@@ -100,6 +100,7 @@ ws [ \f\t\r] + #include + #include + #include ++#include + #include + #include + #include +-- +2.49.0 +