Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc cleanups #154

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Release artifacts
gallium-nine-standalone.tar.gz
23 changes: 19 additions & 4 deletions d3d9-nine/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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@',
],
)
8 changes: 6 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
25 changes: 20 additions & 5 deletions ninewinecfg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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@',
],
)
36 changes: 22 additions & 14 deletions release.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
3 changes: 3 additions & 0 deletions tools/cross-wine32.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions tools/cross-wine64.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions tools/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 11 additions & 7 deletions tools/nine-install.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/bin/sh -e

BASE="`dirname "$(readlink -f "$0")"`"
BASE=$(dirname "$(readlink -f "$0")")

die() {
echo "$*"
exit 1
}

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
Expand All @@ -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
Expand Down