Skip to content

Commit

Permalink
Follow Wine's libdir structure
Browse files Browse the repository at this point in the history
Not only is this friendlier to packagers, but it enables usage via
WINEDLLPATH.

Fixes #123
  • Loading branch information
9ary committed Mar 27, 2023
1 parent 97e8016 commit 577ab62
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 10 deletions.
16 changes: 16 additions & 0 deletions d3d9-nine/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ d3d9_dll = shared_library(
dep_user32,
],
install : true,
install_dir : so_dir,
vs_module_defs : 'd3d9.spec',
objects : 'd3d9.spec',
)
Expand All @@ -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@',
],
)
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
18 changes: 17 additions & 1 deletion ninewinecfg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ ninewinecfg_exe = executable(
dep_comctl32,
dep_ole32,
],
install : true
install : true,
install_dir : so_dir,
)

ninewinecfg_fake = executable(
Expand All @@ -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@',
],
)
6 changes: 2 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ meson \
--cross-file "$SRC/tools/cross-wine64" \
--buildtype "release" \
--prefix "$PREFIX" \
--bindir bin64 \
--libdir lib64 \
--libdir '' \
"$@" \
"$TMP/build64"

Expand All @@ -44,8 +43,7 @@ meson \
--cross-file "$SRC/tools/cross-wine32" \
--buildtype "release" \
--prefix "$PREFIX" \
--bindir bin32 \
--libdir lib32 \
--libdir '' \
"$@" \
"$TMP/build32"

Expand Down
2 changes: 2 additions & 0 deletions tools/cross-wine32.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions tools/cross-wine64.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 8 additions & 4 deletions tools/nine-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 577ab62

Please sign in to comment.