add vkquake build

This commit is contained in:
willemml 2023-03-24 09:18:35 -07:00
parent 4539d38714
commit c806b5cc27
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
6 changed files with 110 additions and 0 deletions

View file

@ -29,6 +29,7 @@
pinentry-touchid
qbittorrent-mac
spotify-mac
vkquake
vlc-mac
;
};

View file

@ -9,5 +9,6 @@ _final: prev: {
pinentry-touchid = prev.callPackage ./pinentry-touchid.nix {};
qbittorrent-mac = prev.callPackage ./qbittorrent-mac.nix {};
spotify-mac = prev.callPackage ./spotify-mac.nix {};
vkquake = prev.callPackage ./vkquake {};
vlc-mac = prev.callPackage ./vlc-mac.nix {};
}

View file

@ -0,0 +1,76 @@
{
pkgs,
fetchFromGitHub,
lib,
stdenv,
...
}:
stdenv.mkDerivation {
pname = "vkquake";
name = "vkQuake";
src = fetchFromGitHub {
owner = "Novum";
repo = "vkQuake";
rev = "98e9e1c76e4ea57d6960c8b4c67a72f7f50f45ea";
sha256 = "sha256-XMsvc9886eYI+CzBMckop7WCAulm2qlKdNu+3qDK7zY=";
};
nativeBuildInputs = with pkgs; [
meson
pkgconfig
python3
cmake
ninja
darwin.binutils
ripgrep
];
buildInputs = with pkgs; [
vulkan-headers
glslang
spirv-tools
SDL2
libvorbis
flac
libopus
opusfile
flac
libmad
darwin.moltenvk
];
macApp = ./vkQuake.app;
buildPhase = ''
# -*-sh-*-
cp -r $src/* .
meson build && ninja -C build
cp -r $macApp vkQuake.app
chmod -R a+rw vkQuake.app
ls
cp build/vkquake vkQuake.app/Contents/Resources/vkquake
mkdir vkQuake.app/Contents/Frameworks
otool -L build/vkquake |
rg nix |
cut -f1 -d' ' |
awk '{$1=$1};1' |
sort |
uniq |
xargs -I {} cp {} vkQuake.app/Contents/Frameworks/.
otool -L vkQuake.app/Contents/Frameworks/* |
rg nix |
cut -f1 -d' ' |
awk '{$1=$1};1' |
sort |
uniq |
xargs -I {} cp -u {} vkQuake.app/Contents/Frameworks/.
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/Applications
mv build/vkquake $out/bin/vkquake
mv vkQuake.app $out/Applications/.
'';
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>q1-launcher.sh</string>
<key>CFBundleName</key>
<string>vkQuake</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIconFile</key>
<string>vkquake.icns</string>
<key>CFBundleShortVersionString</key>
<string>5.00</string>
<key>NSHumanReadableCopyright</key>
<string>id Software</string>
</dict>
</plist>

View file

@ -0,0 +1,14 @@
#!/bin/bash
# setting the right directories
BASEDIR="$( cd "$(dirname "$0")" || exit; pwd )"
RESOURCESDIR="$( cd "$BASEDIR/../Resources" || exit; pwd )"
FRAMEWORKSDIR="$( cd "$BASEDIR/../Frameworks" || exit; pwd )"
BIN="$RESOURCESDIR/vkquake"
export DYLD_FALLBACK_LIBRARY_PATH="$FRAMEWORKSDIR"
QUAKEDIR="$(if [[ -e "$RESOURCESDIR/id1" ]]; then echo "$RESOURCESDIR"; else echo "$HOME/.baseq1"; fi)"
$BIN -basedir $QUAKEDIR