diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0de363c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Release artifacts +gallium-nine-standalone.tar.gz diff --git a/d3d9-nine/meson.build b/d3d9-nine/meson.build index a5e7f63..c861451 100644 --- a/d3d9-nine/meson.build +++ b/d3d9-nine/meson.build @@ -44,17 +44,32 @@ d3d9_dll = shared_library( dep_user32, ], install : true, + install_dir : so_dir, vs_module_defs : 'd3d9.spec', objects : 'd3d9.spec', ) d3d9_fake = shared_library( 'd3d9-nine', - objects : d3d9_dll.extract_all_objects(), + [ + d3d9_res, + ], name_prefix : '', name_suffix : 'dll.fake', - link_with : [ - libd3d9common, - ], + 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 47ee51a..a0ca6c4 100644 --- a/meson.build +++ b/meson.build @@ -4,10 +4,11 @@ project( 'Gallium Nine Standalone', ['c'], version : run_command( - find_program('tools/get_version.sh', native : true) + find_program('tools/get_version.sh', native : true), + check : true, ).stdout(), license : 'LGPL2.1+', - meson_version : '>= 0.46', + meson_version : '>= 0.49', default_options : [ 'buildtype=debugoptimized', 'b_ndebug=if-release', @@ -128,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 a4a3228..5bdfc1e 100644 --- a/ninewinecfg/meson.build +++ b/ninewinecfg/meson.build @@ -31,16 +31,31 @@ ninewinecfg_exe = executable( dep_comctl32, dep_ole32, ], - install : true + install : true, + install_dir : so_dir, ) ninewinecfg_fake = executable( 'ninewinecfg', - objects : ninewinecfg_exe.extract_all_objects(), + [ + ninewinecfg_res, + ], name_prefix : '', name_suffix : 'exe.fake', - link_with : [ - libd3d9common, - ], + 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 f5417c9..f079640 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # SPDX-License-Identifier: LGPL-2.1-or-later -SRC=`dirname $(readlink -f $0)` +SRC=$(dirname "$(readlink -f "$0")") OUT=$PWD/gallium-nine-standalone.tar.gz while getopts "o:h" opt; do @@ -10,7 +10,7 @@ while getopts "o:h" opt; do OUT=$OPTARG ;; h|\?) - printf "$0 [OPTION] [-- MESONARGS]\n" + printf "%s [OPTION] [-- MESONARGS]\n" "$0" printf "\t-o FILE\t\tcreate release as FILE\n" printf "\t-h\t\tprint this help\n" printf "\t-- MESONARGS\tpass MESONARGS to meson\n" @@ -19,24 +19,22 @@ while getopts "o:h" opt; do esac done -shift $(($OPTIND - 1)) -MESONARGS="$@" +shift $((OPTIND - 1)) echo "creating $OUT" -echo "additional meson args: $MESONARGS" +echo "additional meson args: $*" -$SRC/bootstrap.sh +"$SRC"/bootstrap.sh -TMP=`mktemp -d` +TMP=$(mktemp -d) PREFIX="$TMP/gallium-nine-standalone" meson \ --cross-file "$SRC/tools/cross-wine64" \ --buildtype "release" \ --prefix "$PREFIX" \ - --bindir bin64 \ - --libdir lib64 \ - $MESONARGS \ + --libdir '' \ + "$@" \ "$TMP/build64" ninja -C "$TMP/build64" install @@ -45,18 +43,28 @@ meson \ --cross-file "$SRC/tools/cross-wine32" \ --buildtype "release" \ --prefix "$PREFIX" \ - --bindir bin32 \ - --libdir lib32 \ - $MESONARGS \ + --libdir '' \ + "$@" \ "$TMP/build32" ninja -C "$TMP/build32" install +# winetricks backwards compatibility +# Hard links should be safe here, and avoid bloating up the archive size. +install -d "$PREFIX/lib64" +ln "$PREFIX/wine/x86_64-unix/d3d9-nine.dll.so" "$PREFIX/lib64/d3d9-nine.dll.so" +install -d "$PREFIX/bin64" +ln "$PREFIX/wine/x86_64-unix/ninewinecfg.exe.so" "$PREFIX/bin64/ninewinecfg.exe.so" +install -d "$PREFIX/lib32" +ln "$PREFIX/wine/i386-unix/d3d9-nine.dll.so" "$PREFIX/lib32/d3d9-nine.dll.so" +install -d "$PREFIX/bin32" +ln "$PREFIX/wine/i386-unix/ninewinecfg.exe.so" "$PREFIX/bin32/ninewinecfg.exe.so" + install -m 644 "$SRC/LICENSE" "$PREFIX/" install -m 644 "$SRC/README.rst" "$PREFIX/" install -m 755 "$SRC/tools/nine-install.sh" "$PREFIX/" tar --owner=nine:1000 --group=nine:1000 -C "$TMP" -czf "$OUT" gallium-nine-standalone -printf "\nenjoy your release: $OUT\n" +printf "\nenjoy your release: %s\n" "$OUT" exit 0 diff --git a/tools/cross-wine32.in b/tools/cross-wine32.in index a057127..070832d 100644 --- a/tools/cross-wine32.in +++ b/tools/cross-wine32.in @@ -4,10 +4,13 @@ ar = 'ar' strip = 'strip' pkgconfig = '@PKG_CONFIG@' +# This throws a deprecation warning, but fixing that breaks CI [properties] 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 40fbb84..33e37b2 100644 --- a/tools/cross-wine64.in +++ b/tools/cross-wine64.in @@ -4,10 +4,13 @@ ar = 'ar' strip = 'strip' pkgconfig = '@PKG_CONFIG@' +# This throws a deprecation warning, but fixing that breaks CI [properties] 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/get_version.sh b/tools/get_version.sh index 1d40d22..01b1157 100755 --- a/tools/get_version.sh +++ b/tools/get_version.sh @@ -3,9 +3,9 @@ MAJOR=0 MINOR=10 BUILD=0 -REVISION=`git rev-list --count HEAD 2>/dev/null || echo "0"` +REVISION=$(git rev-list --count HEAD 2>/dev/null || echo "0") STAGE="devel" -printf "$MAJOR.$MINOR.$BUILD.$REVISION-$STAGE" +printf "%s.%s.%s.%s-%s" "$MAJOR" "$MINOR" "$BUILD" "$REVISION" "$STAGE" exit 0 diff --git a/tools/nine-install.sh b/tools/nine-install.sh index ae4b047..d5a1d7d 100644 --- a/tools/nine-install.sh +++ b/tools/nine-install.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -BASE="`dirname "$(readlink -f "$0")"`" +BASE=$(dirname "$(readlink -f "$0")") die() { echo "$*" @@ -8,11 +8,13 @@ die() { } wine --version >/dev/null 2>&1 || die "wine not found" -DST=`wine winepath -u 'c:\windows\system32'` +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 @@ -24,11 +26,13 @@ if test -z "$HAVE_WINE64"; then exit 0 fi -DST=`wine64 winepath -u 'c:\windows\system32'` +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