nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 39 lines 1.5 kB view raw
1#! /usr/bin/env nix-shell 2#! nix-shell -i bash -p steam-run unzip wget 3 4# This script updates the hard-coded glue_version in: 5# 6# patches/gen_cs_glue_version.py/hardcodeGlueVersionFor{version}.patch 7# 8# It does so by pulling it from the official build. 9 10set -e 11 12[ -z "$1" ] && echo "Godot version not specified. Exiting." && exit 1 13 14gdversion=$1 15 16# Download and extract the official stable 64-bit X11 mono build of Godot. 17gddir="$(mktemp -d)" 18trap 'rm -rf -- "$gddir"' EXIT 19wget -P "$gddir" https://downloads.tuxfamily.org/godotengine/$gdversion/mono/Godot_v$gdversion-stable_mono_x11_64.zip 20unzip "$gddir"/Godot_v$gdversion-stable_mono_x11_64.zip -d "$gddir" 21 22# Generate the mono glue from the official build. 23gluedir="$(mktemp -d)" 24trap 'rm -rf -- "$gluedir"' EXIT 25steam-run "$gddir"/Godot_v$gdversion-stable_mono_x11_64/Godot_v$gdversion-stable_mono_x11.64 --generate-mono-glue "$gluedir" 26 27# Extract the glue version. 28glueversion=$(grep -Po '(?<=get_cs_glue_version\(\) \{ return )[0-9]+(?=; \})' "$gluedir"/mono_glue.gen.cpp) 29 30patchdir=./patches/gen_cs_glue_version.py/ 31patchprefix=hardcodeGlueVersion_ 32newpatchname=$patchprefix$gdversion.patch 33 34# Update the patch with the obtained glue version. 35sed -i "s/^+ glue_version = [0-9]\+$/+ glue_version = $glueversion/" $patchdir/$patchprefix*.patch 36 37mv $patchdir/$patchprefix*.patch $patchdir/$patchprefix$gdversion.patch 38 39echo "Updated $patchdir/$patchprefix$gdversion.patch with glue_version: $glueversion"