-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
diff -uNr a/dlls/crypt32/unixlib.c b/dlls/crypt32/unixlib.c | ||
--- a/dlls/crypt32/unixlib.c | ||
+++ b/dlls/crypt32/unixlib.c | ||
@@ -619,6 +619,7 @@ | ||
"/usr/local/share/certs/", | ||
"/etc/sfw/openssl/certs", | ||
"/etc/security/cacerts", /* Android */ | ||
+ "@TERMUX_PREFIX@/etc/tls" /* Termux */ | ||
}; | ||
|
||
static void load_root_certs(void) | ||
diff -uNr a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c | ||
--- a/dlls/dbghelp/macho_module.c | ||
+++ b/dlls/dbghelp/macho_module.c | ||
@@ -1578,7 +1578,7 @@ | ||
{ | ||
const WCHAR* fallback = process_getenv(pcs, L"DYLD_FALLBACK_LIBRARY_PATH"); | ||
if (!fallback) | ||
- fallback = L"/usr/local/lib:/lib:/usr/lib"; | ||
+ fallback = L"@TERMUX_PREFIX@/lib:/usr/local/lib:/lib:/usr/lib"; | ||
ret = search_unix_path(p, fallback, macho_load_file_cb, &load_params); | ||
} | ||
if (!ret && p == filename) | ||
diff -uNr a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c | ||
--- a/dlls/dbghelp/module.c | ||
+++ b/dlls/dbghelp/module.c | ||
@@ -701,7 +701,7 @@ | ||
if (!ret) | ||
{ | ||
dst = HeapAlloc(GetProcessHeap(), 0, | ||
- sizeof(L"/usr/lib/debug/.build-id/") + (3 + filename_len + idlen * 2) * sizeof(WCHAR)); | ||
+ sizeof(L"@TERMUX_PREFIX@/lib/debug/.build-id/") + (3 + filename_len + idlen * 2) * sizeof(WCHAR)); | ||
if (dst) | ||
{ | ||
WCHAR* p; | ||
@@ -711,7 +711,7 @@ | ||
* where the alternate file is... | ||
* so try both | ||
*/ | ||
- p = memcpy(dst, L"/usr/lib/debug/.build-id/", sizeof(L"/usr/lib/debug/.build-id/")); | ||
+ p = memcpy(dst, L"@TERMUX_PREFIX@/lib/debug/.build-id/", sizeof(L"@TERMUX_PREFIX@/lib/debug/.build-id/")); | ||
p += wcslen(dst); | ||
MultiByteToWideChar(CP_UNIXCP, 0, data, -1, p, filename_len); | ||
ret = image_check_debug_link_gnu_id(dst, fmap_link, id, idlen); | ||
@@ -753,9 +753,9 @@ | ||
fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link)); | ||
if (!fmap_link) return FALSE; | ||
|
||
- p = malloc(sizeof(L"/usr/lib/debug/.build-id/") + | ||
+ p = malloc(sizeof(L"@TERMUX_PREFIX@/lib/debug/.build-id/") + | ||
(idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug")); | ||
- wcscpy(p, L"/usr/lib/debug/.build-id/"); | ||
+ wcscpy(p, L"@TERMUX_PREFIX@/lib/debug/.build-id/"); | ||
z = p + wcslen(p); | ||
if (idlen) | ||
{ | ||
diff -uNr a/dlls/msvcrt/tests/environ.c b/dlls/msvcrt/tests/environ.c | ||
--- a/dlls/msvcrt/tests/environ.c | ||
+++ b/dlls/msvcrt/tests/environ.c | ||
@@ -41,7 +41,8 @@ | ||
"/lib/mingw32/3.4.2/;" | ||
"/lib/;" | ||
"/usr/lib/mingw32/3.4.2/;" | ||
- "/usr/lib/"; | ||
+ "/usr/lib/;" | ||
+ "@TERMUX_PREFIX@/lib/"; | ||
|
||
static char ***(__cdecl *p__p__environ)(void); | ||
static WCHAR ***(__cdecl *p__p__wenviron)(void); | ||
diff -uNr a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c | ||
--- a/dlls/ntdll/unix/server.c | ||
+++ b/dlls/ntdll/unix/server.c | ||
@@ -1113,15 +1113,15 @@ | ||
char *p, *dir; | ||
size_t len = sizeof("/server-") + 2 * sizeof(dev) + 2 * sizeof(ino) + 2; | ||
|
||
-#ifdef __ANDROID__ /* there's no /tmp dir on Android */ | ||
+#if defined(__ANDROID__) && ! defined(__TERMUX__) /* there's no /tmp dir on Android */ | ||
len += strlen( config_dir ) + sizeof("/.wineserver"); | ||
dir = malloc( len ); | ||
strcpy( dir, config_dir ); | ||
strcat( dir, "/.wineserver/server-" ); | ||
#else | ||
- len += sizeof("/tmp/.wine-") + 12; | ||
+ len += sizeof("@TERMUX_PREFIX@/tmp/.wine-") + 12; | ||
dir = malloc( len ); | ||
- sprintf( dir, "/tmp/.wine-%u/server-", getuid() ); | ||
+ sprintf( dir, "@TERMUX_PREFIX@/tmp/.wine-%u/server-", getuid() ); | ||
#endif | ||
p = dir + strlen( dir ); | ||
if (dev != (unsigned long)dev) | ||
diff -uNr a/libs/wine/config.c b/libs/wine/config.c | ||
--- a/libs/wine/config.c | ||
+++ b/libs/wine/config.c | ||
@@ -342,7 +342,7 @@ | ||
} | ||
|
||
static const char server_config_dir[] = "/.wine"; /* config dir relative to $HOME */ | ||
-static const char server_root_prefix[] = "/tmp/.wine"; /* prefix for server root dir */ | ||
+static const char server_root_prefix[] = "@TERMUX_PREFIX@/tmp/.wine"; /* prefix for server root dir */ | ||
static const char server_dir_prefix[] = "/server-"; /* prefix for server dir */ | ||
|
||
static char *config_dir; | ||
@@ -382,7 +382,7 @@ | ||
{ | ||
char *p, *root; | ||
|
||
-#ifdef __ANDROID__ /* there's no /tmp dir on Android */ | ||
+#if defined(__ANDROID__) && ! defined(__TERMUX__) /* there's no /tmp dir on Android */ | ||
root = build_path( config_dir, ".wineserver" ); | ||
#else | ||
root = xmalloc( sizeof(server_root_prefix) + 12 ); | ||
diff -uNr a/programs/winebrowser/main.c b/programs/winebrowser/main.c | ||
--- a/programs/winebrowser/main.c | ||
+++ b/programs/winebrowser/main.c | ||
@@ -116,6 +116,7 @@ | ||
{ | ||
static const WCHAR defaultbrowsers[] = | ||
L"xdg-open\0" | ||
+ "@TERMUX_PREFIX@/bin/open\0" | ||
"/usr/bin/open\0" | ||
"firefox\0" | ||
"konqueror\0" | ||
@@ -141,7 +142,8 @@ | ||
static int open_mailto_url( const WCHAR *url ) | ||
{ | ||
static const WCHAR defaultmailers[] = | ||
- L"/usr/bin/open\0" | ||
+ L"@TERMUX_PREFIX@/bin/open" | ||
+ "/usr/bin/open\0" | ||
"xdg-email\0" | ||
"mozilla-thunderbird\0" | ||
"thunderbird\0" | ||
diff -uNr a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c | ||
--- a/programs/winemenubuilder/winemenubuilder.c | ||
+++ b/programs/winemenubuilder/winemenubuilder.c | ||
@@ -1708,7 +1708,7 @@ | ||
if (_wgetenv( L"XDG_DATA_DIRS" )) | ||
dirs = xwcsdup( _wgetenv( L"XDG_DATA_DIRS" )); | ||
else | ||
- dirs = xwcsdup( L"/usr/local/share/:/usr/share/" ); | ||
+ dirs = xwcsdup( L"@TERMUX_PREFIX@/share:/usr/local/share/:/usr/share/" ); | ||
|
||
ret = add_mimes(xdg_data_dir, mime_types); | ||
if (ret) | ||
diff -uNr a/server/request.c b/server/request.c | ||
--- a/server/request.c | ||
+++ b/server/request.c | ||
@@ -657,15 +657,15 @@ | ||
|
||
/* create the base directory if needed */ | ||
|
||
-#ifdef __ANDROID__ /* there's no /tmp dir on Android */ | ||
+#if defined(__ANDROID__) && ! defined(__TERMUX__) /* there's no /tmp dir on Android */ | ||
len += strlen( config_dir ) + sizeof("/.wineserver"); | ||
if (!(server_dir = malloc( len ))) fatal_error( "out of memory\n" ); | ||
strcpy( server_dir, config_dir ); | ||
strcat( server_dir, "/.wineserver" ); | ||
#else | ||
- len += sizeof("/tmp/.wine-") + 12; | ||
+ len += sizeof("@TERMUX_PREFIX@/tmp/.wine-") + 12; | ||
if (!(server_dir = malloc( len ))) fatal_error( "out of memory\n" ); | ||
- sprintf( server_dir, "/tmp/.wine-%u", getuid() ); | ||
+ sprintf( server_dir, "@TERMUX_PREFIX@/tmp/.wine-%u", getuid() ); | ||
#endif | ||
create_dir( server_dir, &st2 ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff -uNr a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c | ||
--- a/dlls/ntdll/unix/loader.c | ||
+++ b/dlls/ntdll/unix/loader.c | ||
@@ -74,7 +74,7 @@ | ||
# define _POSIX_SPAWN_DISABLE_ASLR 0x0100 | ||
# endif | ||
#endif | ||
-#ifdef __ANDROID__ | ||
+#if defined(__ANDROID__) && ! defined(__TERMUX__) | ||
# include <jni.h> | ||
#endif | ||
|
||
@@ -622,7 +622,7 @@ | ||
if (!(build_dir = remove_tail( ntdll_dir, "/dlls/ntdll" ))) | ||
{ | ||
if (!(dll_dir = remove_tail( ntdll_dir, so_dir ))) dll_dir = ntdll_dir; | ||
-#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) | ||
+#if (defined(__linux__) && !(defined(__ANDROID__) && ! defined(__TERMUX__))) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) | ||
bin_dir = realpath_dirname( "/proc/self/exe" ); | ||
#elif defined (__FreeBSD__) || defined(__DragonFly__) | ||
{ | ||
@@ -2108,7 +2108,7 @@ | ||
server_init_process_done(); | ||
} | ||
|
||
-#ifdef __ANDROID__ | ||
+#if defined(__ANDROID__) && ! defined(__TERMUX__) | ||
|
||
#ifndef WINE_JAVA_CLASS | ||
#define WINE_JAVA_CLASS "org/winehq/wine/WineActivity" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- a/dlls/ntdll/unix/socket.c | ||
+++ b/dlls/ntdll/unix/socket.c | ||
@@ -53,7 +53,7 @@ | ||
# endif | ||
# include <linux/ipx.h> | ||
#endif | ||
-#if defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS) | ||
+#if (defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS)) && !defined(__ANDROID__) | ||
# define HAS_IPX | ||
#endif | ||
|
||
@@ -2104,6 +2104,7 @@ | ||
break; | ||
} | ||
|
||
+#ifdef HAS_IPX | ||
#ifdef SOL_IPX | ||
case IOCTL_AFD_WINE_GET_IPX_PTYPE: | ||
return do_getsockopt( handle, io, SOL_IPX, IPX_TYPE, out_buffer, out_size ); | ||
@@ -2142,6 +2143,7 @@ | ||
return do_setsockopt( handle, io, 0, SO_DEFAULT_HEADERS, &value, sizeof(value) ); | ||
} | ||
#endif | ||
+#endif | ||
|
||
#ifdef HAS_IRDA | ||
#define MAX_IRDA_DEVICES 10 | ||
--- a/dlls/ws2_32/unixlib.c | ||
+++ b/dlls/ws2_32/unixlib.c | ||
@@ -75,7 +75,7 @@ | ||
# endif | ||
# include <linux/ipx.h> | ||
#endif | ||
-#if defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS) | ||
+#if (defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS)) && !defined(__ANDROID__) | ||
# define HAS_IPX | ||
#endif | ||
|
||
--- a/server/sock.c | ||
+++ b/server/sock.c | ||
@@ -68,7 +68,7 @@ | ||
# endif | ||
# include <linux/ipx.h> | ||
#endif | ||
-#if defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS) | ||
+#if (defined(SOL_IPX) || defined(SO_DEFAULT_HEADERS)) && !defined(__ANDROID__) | ||
# define HAS_IPX | ||
#endif | ||
|
21 changes: 21 additions & 0 deletions
21
tur-multilib/wine-stable/9998-fix-winegcc-build-target.patch.beforehostbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- a/tools/winegcc/winegcc.c.orig | ||
+++ b/tools/winegcc/winegcc.c | ||
@@ -325,8 +325,17 @@ | ||
{ | ||
if (opts->target_alias) | ||
{ | ||
+ if (strstr(opts->target_alias, "android")) { | ||
+ if (strstr(opts->target_alias, "arm")) { | ||
+ str = strmake( "%s24", "armv7a-linux-androideabi" ); | ||
+ } else { | ||
+ str = strmake( "%s24", opts->target_alias ); | ||
+ } | ||
+ } else { | ||
+ str = strmake( "%s", opts->target_alias ); | ||
+ } | ||
strarray_add( &ret, "-target" ); | ||
- strarray_add( &ret, opts->target_alias ); | ||
+ strarray_add( &ret, str ); | ||
} | ||
strarray_add( &ret, "-Wno-unused-command-line-argument" ); | ||
strarray_add( &ret, "-fuse-ld=lld" ); |
27 changes: 27 additions & 0 deletions
27
tur-multilib/wine-stable/9999-fix-winegcc-flags-for-arm.patch.beforehostbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Link flag `--no-wchar-size-warning` is not supported by ld.lld until lld-16. | ||
--- a/tools/winegcc/winegcc.c.orig | ||
+++ b/tools/winegcc/winegcc.c | ||
@@ -528,8 +528,8 @@ | ||
|
||
strarray_add( &link_args, "-shared" ); | ||
strarray_add( &link_args, "-Wl,-Bsymbolic" ); | ||
- if (!opts->noshortwchar && opts->target.cpu == CPU_ARM) | ||
- strarray_add( &flags, "-Wl,--no-wchar-size-warning" ); | ||
+ // if (!opts->noshortwchar && opts->target.cpu == CPU_ARM) | ||
+ // strarray_add( &flags, "-Wl,--no-wchar-size-warning" ); | ||
if (!try_link( opts->prefix, link_args, "-Wl,-z,defs" )) | ||
strarray_add( &flags, "-Wl,-z,defs" ); | ||
|
||
--- a/tools/winebuild/utils.c.orig | ||
+++ b/tools/winebuild/utils.c | ||
@@ -386,8 +386,8 @@ | ||
} | ||
} | ||
|
||
- if (target.cpu == CPU_ARM && !is_pe()) | ||
- strarray_add( &args, "--no-wchar-size-warning" ); | ||
+ // if (target.cpu == CPU_ARM && !is_pe()) | ||
+ // strarray_add( &args, "--no-wchar-size-warning" ); | ||
|
||
return args; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
TERMUX_PKG_HOMEPAGE=https://www.winehq.org/ | ||
TERMUX_PKG_DESCRIPTION="A compatibility layer for running Windows programs" | ||
TERMUX_PKG_LICENSE="LGPL-2.1" | ||
TERMUX_PKG_LICENSE_FILE="\ | ||
LICENSE | ||
LICENSE.OLD | ||
COPYING.LIB" | ||
TERMUX_PKG_MAINTAINER="@termux-user-repository" | ||
TERMUX_PKG_VERSION=7.0.1 | ||
TERMUX_PKG_SRCURL=https://dl.winehq.org/wine/source/${TERMUX_PKG_VERSION:0:3}/wine-$TERMUX_PKG_VERSION.tar.xz | ||
TERMUX_PKG_SHA256=807caa78121b16250f240d2828a07ca4e3c609739e5524ef0f4cf89ae49a816c | ||
TERMUX_PKG_DEPENDS="libc++, libgmp, libgnutls" | ||
TERMUX_PKG_NO_STATICSPLIT=true | ||
TERMUX_PKG_HOSTBUILD=true | ||
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS=" | ||
--without-x | ||
--disable-tests | ||
" | ||
|
||
# TODO: Enable X | ||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" | ||
enable_wineandroid_drv=no | ||
exec_prefix=$TERMUX_PREFIX | ||
--without-x | ||
--without-vulkan | ||
--with-wine-tools=$TERMUX_PKG_HOSTBUILD_DIR | ||
--enable-nls | ||
--disable-tests | ||
" | ||
|
||
_setup_llvm_mingw_toolchain() { | ||
# LLVM-mingw's version number must not be the same as the NDK's. | ||
local _llvm_mingw_version=13 | ||
local _version="20211002" | ||
local _url="https://github.com/mstorsjo/llvm-mingw/releases/download/$_version/llvm-mingw-$_version-ucrt-ubuntu-18.04-x86_64.tar.xz" | ||
local _path="$TERMUX_PKG_CACHEDIR/$(basename $_url)" | ||
local _sha256sum=30e9400783652091d9278ce21e5c170d01a5f44e4f1a25717b63cd9ad9fbe13b | ||
termux_download $_url $_path $_sha256sum | ||
local _extract_path="$TERMUX_PKG_CACHEDIR/llvm-mingw-toolchain-$_llvm_mingw_version" | ||
if [ ! -d "$_extract_path" ]; then | ||
mkdir -p "$_extract_path"-tmp | ||
tar -C "$_extract_path"-tmp --strip-component=1 -xf "$_path" | ||
mv "$_extract_path"-tmp "$_extract_path" | ||
fi | ||
export PATH="$PATH:$_extract_path/bin" | ||
} | ||
|
||
termux_step_host_build() { | ||
# Setup llvm-mingw toolchain | ||
_setup_llvm_mingw_toolchain | ||
|
||
# Make host wine-tools | ||
# TODO: Find out how to make wine-tools only | ||
(unset sudo; sudo apt update; sudo apt install libfreetype-dev:i386 -yqq) | ||
"$TERMUX_PKG_SRCDIR/configure" ${TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS} | ||
make -j "$TERMUX_MAKE_PROCESSES" | ||
} | ||
|
||
termux_step_pre_configure() { | ||
# Setup llvm-mingw toolchain | ||
_setup_llvm_mingw_toolchain | ||
|
||
# Fix overoptimization | ||
CFLAGS="${CFLAGS/-Oz/}" | ||
CXXFLAGS="${CFLAGS/-Oz/}" | ||
|
||
# Enable win64 on 64-bit arches. | ||
# TODO: Enable win32 after TUR has full support for mutilib | ||
if [ "$TERMUX_ARCH_BITS" = 64 ]; then | ||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-win64" | ||
fi | ||
} |
3b58177
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@licy183
https://gist.github.com/iamahuman/1d8db9637c314b9af47db7b7238f6ebc#file-wine-6-20-termux-patch-L23264
termux/termux-packages#1423
Maybe this will be helpful? Someone runs Wine 6.20 on Termux with X11
3b58177
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emmm... I could compile it with x11 enabled, but I'd like to enabled 32-bit libraries support first. Wine32 needs multilib support on Linux, but Termux doesn't have it. I'm working on it these days.
3b58177
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello
Did you do something about Wine running on Termux?
Is there any new news thing about it?