1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
{ lib, multiStdenv, pkgsi686Linux
, writeShellScript
, fetchFromGitHub, ed
, hl2sdk, ambuild, metamod-source, libfinite
, mysql_5_5
}: let
inherit (pkgsi686Linux) zlib;
owner = "alliedmodders";
buildno = "6968";
in multiStdenv.mkDerivation rec {
pname = "sourcemod";
version = "1.11_${buildno}";
src = fetchFromGitHub rec {
inherit owner;
repo = pname;
rev = "13510eab809a98b6a62354fc9848641";
fetchSubmodules = true;
hash = "sha256-leV0Q7g5bnJljzQxv3z6t5p/1d9TxILPvIuSYuq8LmE=";
};
nativeBuildInputs = [ ambuild ed ];
buildInputs = [ zlib mysql_5_5 ];
hardeningDisable = [ "all" ];
CXXFLAGS="-Wno-error=sign-compare -Wno-error=ignored-attributes";
postPatch = ''
mkdir .git
echo "ref: refs/heads/main" > .git/HEAD
ed tools/buildbot/generate_headers.py <<EOF
/^def get_git_version/;/return/a
def get_git_version():
return '${buildno}', '${builtins.substring 0 7 src.rev}', '${src.rev}'
.
w
EOF
for i in sdktools dhooks sdkhooks; do
sed -i '/invalid-offsetof/s,no-,no-error=,' extensions/$i/AMBuilder
done
ed AMBuildScript <<EOF
/'mathlib.a'/s|$|, '${libfinite}',|
w
EOF
'';
configurePhase = ''
ln -s ${hl2sdk} ${hl2sdk.name}
ln -s ${metamod-source}/include metamod-source
mkdir -p build
cd build
python ../configure.py --sdks present --mysql-path ${mysql_5_5}
'';
buildPhase = ''
ambuild
'';
installPhase = ''
mkdir $out
mv package $out/share
cd $out/share/addons/sourcemod/plugins
mv *.smx disabled/
mkdir -p $out/bin
cd $out/bin
cp ${writeShellScript "spcomp" ''
echo OUT/share/addons/sourcemod/scripting/spcomp $SPCOMPFLAGS "$@"
OUT/share/addons/sourcemod/scripting/spcomp $SPCOMPFLAGS "$@"
''} ./spcomp
substituteInPlace ./spcomp --replace OUT "$out"
'';
setupHook = ./setup-hook.sh;
meta = with lib; {
description = "Source Engine scripting and administration";
homepage = "https://github.com/${owner}/${pname}";
platforms = platforms.unix;
license = licenses.gpl3;
};
}
|