2021-03-10 19:34:10 +01:00
|
|
|
#!/usr/bin/env bash
|
2018-03-08 18:34:33 +01:00
|
|
|
|
2018-10-17 06:02:22 +02:00
|
|
|
set -e
|
|
|
|
|
2019-02-25 17:19:49 +01:00
|
|
|
shopt -s extglob
|
|
|
|
|
2018-03-08 18:34:33 +01:00
|
|
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
2020-04-20 17:30:57 +02:00
|
|
|
echo "Usage: $0 version destdir [--no-package] [--dev-build]"
|
2018-03-08 18:34:33 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
DXVK_VERSION="$1"
|
2022-12-16 17:15:50 +01:00
|
|
|
DXVK_SRC_DIR=$(readlink -f "$0")
|
|
|
|
DXVK_SRC_DIR=$(dirname "$DXVK_SRC_DIR")
|
2018-03-27 18:45:05 +02:00
|
|
|
DXVK_BUILD_DIR=$(realpath "$2")"/dxvk-$DXVK_VERSION"
|
2018-03-14 20:38:38 +01:00
|
|
|
DXVK_ARCHIVE_PATH=$(realpath "$2")"/dxvk-$DXVK_VERSION.tar.gz"
|
2018-03-08 18:34:33 +01:00
|
|
|
|
2018-08-17 11:30:32 +02:00
|
|
|
if [ -e "$DXVK_BUILD_DIR" ]; then
|
|
|
|
echo "Build directory $DXVK_BUILD_DIR already exists"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-02-25 17:19:49 +01:00
|
|
|
shift 2
|
|
|
|
|
|
|
|
opt_nopackage=0
|
|
|
|
opt_devbuild=0
|
2021-02-17 16:18:28 +01:00
|
|
|
opt_buildid=false
|
2019-02-25 17:19:49 +01:00
|
|
|
|
|
|
|
crossfile="build-win"
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
"--no-package")
|
|
|
|
opt_nopackage=1
|
|
|
|
;;
|
|
|
|
"--dev-build")
|
|
|
|
opt_nopackage=1
|
|
|
|
opt_devbuild=1
|
|
|
|
;;
|
2021-02-17 16:18:28 +01:00
|
|
|
"--build-id")
|
|
|
|
opt_buildid=true
|
|
|
|
;;
|
2019-02-25 17:19:49 +01:00
|
|
|
*)
|
|
|
|
echo "Unrecognized option: $1" >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2018-03-08 18:34:33 +01:00
|
|
|
function build_arch {
|
2018-04-20 17:28:45 +02:00
|
|
|
export WINEARCH="win$1"
|
|
|
|
export WINEPREFIX="$DXVK_BUILD_DIR/wine.$1"
|
|
|
|
|
2018-03-08 18:34:33 +01:00
|
|
|
cd "$DXVK_SRC_DIR"
|
|
|
|
|
2021-05-19 16:59:55 +02:00
|
|
|
opt_strip=
|
|
|
|
if [ $opt_devbuild -eq 0 ]; then
|
|
|
|
opt_strip=--strip
|
|
|
|
fi
|
|
|
|
|
2022-11-10 13:26:31 +01:00
|
|
|
meson setup --cross-file "$DXVK_SRC_DIR/$crossfile$1.txt" \
|
|
|
|
--buildtype "release" \
|
|
|
|
--prefix "$DXVK_BUILD_DIR" \
|
|
|
|
$opt_strip \
|
|
|
|
--bindir "x$1" \
|
|
|
|
--libdir "x$1" \
|
|
|
|
-Dbuild_id=$opt_buildid \
|
2018-03-27 18:45:05 +02:00
|
|
|
"$DXVK_BUILD_DIR/build.$1"
|
2018-03-08 18:34:33 +01:00
|
|
|
|
2018-03-27 18:45:05 +02:00
|
|
|
cd "$DXVK_BUILD_DIR/build.$1"
|
2018-03-08 18:34:33 +01:00
|
|
|
ninja install
|
|
|
|
|
2019-02-25 17:19:49 +01:00
|
|
|
if [ $opt_devbuild -eq 0 ]; then
|
2020-04-22 05:26:11 +02:00
|
|
|
# get rid of some useless .a files
|
|
|
|
rm "$DXVK_BUILD_DIR/x$1/"*.!(dll)
|
2019-02-25 17:19:49 +01:00
|
|
|
rm -R "$DXVK_BUILD_DIR/build.$1"
|
|
|
|
fi
|
2018-03-08 18:34:33 +01:00
|
|
|
}
|
|
|
|
|
2018-08-18 07:47:42 +02:00
|
|
|
function package {
|
2018-03-27 18:45:05 +02:00
|
|
|
cd "$DXVK_BUILD_DIR/.."
|
2018-03-08 18:34:33 +01:00
|
|
|
tar -czf "$DXVK_ARCHIVE_PATH" "dxvk-$DXVK_VERSION"
|
|
|
|
rm -R "dxvk-$DXVK_VERSION"
|
|
|
|
}
|
|
|
|
|
|
|
|
build_arch 64
|
|
|
|
build_arch 32
|
2018-03-27 18:45:05 +02:00
|
|
|
|
2019-02-25 17:19:49 +01:00
|
|
|
if [ $opt_nopackage -eq 0 ]; then
|
2018-03-27 18:45:05 +02:00
|
|
|
package
|
2018-05-07 20:01:10 +02:00
|
|
|
fi
|