From dea89dc53228462b33a56a0acb1f4eb08c8c3da7 Mon Sep 17 00:00:00 2001 From: novenary Date: Sat, 18 Mar 2023 17:17:34 +0200 Subject: [PATCH] Follow Wine's libdir structure Not only is this friendlier to packagers, but it enables usage via WINEDLLPATH. Fixes #123 --- d3d9-nine/meson.build | 16 ++++++++++++++++ meson.build | 5 ++++- ninewinecfg/meson.build | 18 +++++++++++++++++- release.sh | 6 ++---- tools/cross-wine32.in | 2 ++ tools/cross-wine64.in | 2 ++ tools/nine-install.sh | 12 ++++++++---- 7 files changed, 51 insertions(+), 10 deletions(-) diff --git a/d3d9-nine/meson.build b/d3d9-nine/meson.build index 8757542..c861451 100644 --- a/d3d9-nine/meson.build +++ b/d3d9-nine/meson.build @@ -44,6 +44,7 @@ d3d9_dll = shared_library( dep_user32, ], install : true, + install_dir : so_dir, vs_module_defs : 'd3d9.spec', objects : 'd3d9.spec', ) @@ -55,5 +56,20 @@ d3d9_fake = shared_library( ], name_prefix : '', name_suffix : 'dll.fake', + install : false, +) + +# Hack to rename the installed file +# Starting with Wine 6.22, winegcc recognizes -Wb,--fake-module which should be preferred. +custom_target( + 'd3d9-nine.dll', + input : d3d9_fake, + output : 'd3d9-nine.dll', install : true, + install_dir : pe_dir, + command : [ + 'cp', + '@INPUT@', + '@OUTPUT@', + ], ) diff --git a/meson.build b/meson.build index 153dbe9..a0ca6c4 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ project( check : true, ).stdout(), license : 'LGPL2.1+', - meson_version : '>= 0.46', + meson_version : '>= 0.49', default_options : [ 'buildtype=debugoptimized', 'b_ndebug=if-release', @@ -129,6 +129,9 @@ foreach arg : pp_args add_project_arguments(arg, language : ['c']) endforeach +pe_dir = get_option('libdir') / 'wine' / meson.get_cross_property('pe_dir') +so_dir = get_option('libdir') / 'wine' / meson.get_cross_property('so_dir') + subdir('common') subdir('d3d9-nine') subdir('ninewinecfg') diff --git a/ninewinecfg/meson.build b/ninewinecfg/meson.build index 5a1a3dc..5bdfc1e 100644 --- a/ninewinecfg/meson.build +++ b/ninewinecfg/meson.build @@ -31,7 +31,8 @@ ninewinecfg_exe = executable( dep_comctl32, dep_ole32, ], - install : true + install : true, + install_dir : so_dir, ) ninewinecfg_fake = executable( @@ -41,5 +42,20 @@ ninewinecfg_fake = executable( ], name_prefix : '', name_suffix : 'exe.fake', + install : false, +) + +# Hack to rename the installed file +# Starting with Wine 6.22, winegcc recognizes -Wb,--fake-module which should be preferred. +custom_target( + 'ninewinecfg.exe', + input : ninewinecfg_fake, + output : 'ninewinecfg.exe', install : true, + install_dir : pe_dir, + command : [ + 'cp', + '@INPUT@', + '@OUTPUT@', + ], ) diff --git a/release.sh b/release.sh index 55ef316..7e34e34 100755 --- a/release.sh +++ b/release.sh @@ -33,8 +33,7 @@ meson \ --cross-file "$SRC/tools/cross-wine64" \ --buildtype "release" \ --prefix "$PREFIX" \ - --bindir bin64 \ - --libdir lib64 \ + --libdir '' \ "$@" \ "$TMP/build64" @@ -44,8 +43,7 @@ meson \ --cross-file "$SRC/tools/cross-wine32" \ --buildtype "release" \ --prefix "$PREFIX" \ - --bindir bin32 \ - --libdir lib32 \ + --libdir '' \ "$@" \ "$TMP/build32" diff --git a/tools/cross-wine32.in b/tools/cross-wine32.in index 5115dc7..070832d 100644 --- a/tools/cross-wine32.in +++ b/tools/cross-wine32.in @@ -9,6 +9,8 @@ pkgconfig = '@PKG_CONFIG@' c_args = ['-m32'] c_link_args = ['-m32', '-mwindows', '-L@WINE32_LIBDIR@'] needs_exe_wrapper = true +pe_dir = 'i386-windows' +so_dir = 'i386-unix' [host_machine] system = 'linux' diff --git a/tools/cross-wine64.in b/tools/cross-wine64.in index 183847b..33e37b2 100644 --- a/tools/cross-wine64.in +++ b/tools/cross-wine64.in @@ -9,6 +9,8 @@ pkgconfig = '@PKG_CONFIG@' c_args = ['-m64'] c_link_args = ['-m64', '-mwindows', '-L@WINE64_LIBDIR@'] needs_exe_wrapper = true +pe_dir = 'x86_64-windows' +so_dir = 'x86_64-unix' [host_machine] system = 'linux' diff --git a/tools/nine-install.sh b/tools/nine-install.sh index 86127cd..d5a1d7d 100644 --- a/tools/nine-install.sh +++ b/tools/nine-install.sh @@ -11,8 +11,10 @@ wine --version >/dev/null 2>&1 || die "wine not found" DST=$(wine winepath -u 'c:\windows\system32') echo "installing 32bit binaries to $DST" -ln -sf "$BASE/lib32/d3d9-nine.dll.so" "$DST/d3d9-nine.dll" -ln -sf "$BASE/bin32/ninewinecfg.exe.so" "$DST/ninewinecfg.exe" +pe_dir='i386-windows' +so_dir='i386-unix' +ln -sf "$BASE/wine/$so_dir/d3d9-nine.dll.so" "$DST/d3d9-nine.dll" +ln -sf "$BASE/wine/$so_dir/ninewinecfg.exe.so" "$DST/ninewinecfg.exe" unset HAVE_WINE64 wine64 winepath >/dev/null 2>&1 && HAVE_WINE64=1 @@ -27,8 +29,10 @@ fi DST=$(wine64 winepath -u 'c:\windows\system32') echo "installing 64bit binaries to $DST" -ln -sf "$BASE/lib64/d3d9-nine.dll.so" "$DST/d3d9-nine.dll" -ln -sf "$BASE/bin64/ninewinecfg.exe.so" "$DST/ninewinecfg.exe" +pe_dir='x86_64-windows' +so_dir='x86_64-unix' +ln -sf "$BASE/wine/$so_dir/d3d9-nine.dll.so" "$DST/d3d9-nine.dll" +ln -sf "$BASE/wine/$so_dir/ninewinecfg.exe.so" "$DST/ninewinecfg.exe" echo "enabling gallium nine" wine64 ninewinecfg.exe -e