metamod-source-dev-src
LOW
maintainer ChrisTX
0 votes
base
metamod-source-dev
scanned 2026-11-03 14:04:44.822193
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: Christian Pfeiffer <cpfeiffer at rev-crew dot info>
2
# shellcheck disable=SC2034,SC2154
3
# shellcheck shell=bash
4
5
pkgbase=metamod-source-dev
6
pkgname=(metamod-source-dev metamod-source-dev-src)
7
_name=metamod-source
8
# Metamod:Source's development builds: the tags of master's builds (2.0, released by upstream as
9
# prereleases), <version>.<build>, the build being the number of commits, which its versioning
10
# counts with git
11
pkgver=2.0.0.1483
12
pkgrel=1
13
pkgdesc="Metamod:Source, a plugin loader for Source engine game servers (development builds)"
14
arch=(x86_64)
15
url="https://www.metamodsource.net"
16
license=(Zlib)
17
# The SDKs of the games, with their static libraries
18
makedepends=(ambuild clang git hl2sdk python)
19
# The Zydis release KHook's SafetyHook's amalgamated copy (4.0.0) is generated from again, as for
20
# SourceMod's SafetyHook: the 4.1 decoder fixes, the API SafetyHook uses is the same
21
_zydisver=4.1.1
22
# The full history of Metamod:Source, its versioning counts the commits. The submodules at the
23
# commits the tag pins, KHook's SafetyHook too (not its googletest and gtest-parallel, only for its
24
# tests).
25
source=("git+https://github.com/alliedmodders/metamod-source.git#tag=$pkgver"
26
"git+https://github.com/alliedmodders/amtl.git"
27
"git+https://github.com/alliedmodders/hl2sdk-manifests.git"
28
"git+https://github.com/Kenzzer/KHook.git"
29
"git+https://github.com/alliedmodders/safetyhook.git"
30
"git+https://github.com/zyantific/zydis.git#tag=v$_zydisver"
31
"git+https://github.com/zyantific/zycore-c.git"
32
loader-test-khook.patch
33
source-sdk.txt)
34
sha512sums=('5740bf3beb8494f156ef93fe0b84511a1e31388871b5f34af71e637b63ebbcd819d54bc5276182ec153dca964e814b615dc63d2f56ff07f1e0aaf6af77e65422'
35
'SKIP'
36
'SKIP'
37
'SKIP'
38
'SKIP'
39
'7ca4fc08ad5074f7ae7115f8eb511ad53b84edcf6770395d43512bee73e38ffad0e1b59850e7732454abdf880266307cf5fd396ac516ef1f9489d4fb592a455b'
40
'SKIP'
41
'8d5076afcf484875f9c990b17117e19452d5a301a3d4c5275a879ea21ade60286bf9b4ca90ee99a381750cf09c0842c23bbf028e1c69169c3639f8f36b64e54a'
42
'f427709e7137dd0249070ffa3aedaf9c04b434172d56d8d453ada2d0c439c2b31a9c82551da5c993468fc286edba756d86073268894394ba5190fc1475ca09b3')
43
b2sums=('40ab8c2bd0bf247e4f131cfad93801b4f7d8a4c878d07fae071751f3ba70bdb5bc3794b29b7b92e637fc963d8c3850ead7a0c6e3279adf8a9b0bd5b6b781c611'
44
'SKIP'
45
'SKIP'
46
'SKIP'
47
'SKIP'
48
'a596fe2649f4f9d5644b3abe7df3fa1d921ec378324691f04e17df60e3ebec39f3877ecb68519b71fde1a0a8144e48b35556febb241fa3cc631794c7e866f8d5'
49
'SKIP'
50
'9d19b3f89340e85170c3471cfc696530a149d2d166fdd32b5fc1d8db7f8ec07a801cd2a676df8eb3fe7cd64367116d56c737e2ab0a21ee5f92f0f590143997fe'
51
'b856088fc19f7c921a5e2b3320a776e27b10a8d3d77c21041cb59348b2efde62491163c57227080c0091eb77e74c0d1fc2c0b72a01e0770df27777dc077ad600')
52
53
# Clang, like upstream's builds: the code builds with -Werror
54
_compilers() {
55
export CC=clang CXX=clang++
56
}
57
58
prepare() {
59
cd "$_name" || exit
60
local _submodule
61
local -A _submodules=(["third_party/amtl"]=amtl ["hl2sdk-manifests"]=hl2sdk-manifests
62
["third_party/khook"]=KHook)
63
for _submodule in "${!_submodules[@]}"; do
64
git submodule init "$_submodule"
65
git config "submodule.$_submodule.url" "$srcdir/${_submodules[$_submodule]}"
66
done
67
git -c protocol.file.allow=always submodule update "${!_submodules[@]}"
68
git -C third_party/khook submodule init third_party/safetyhook
69
git -C third_party/khook config submodule.third_party/safetyhook.url "$srcdir/safetyhook"
70
git -C third_party/khook -c protocol.file.allow=always submodule update third_party/safetyhook
71
72
# The loader's tests with KHook's headers, which the loader's sources include, like the loader
73
patch -Np1 -i "$srcdir/loader-test-khook.patch"
74
75
# SafetyHook's Zydis, amalgamated from Zydis and Zycore at the release's commits by Zydis's
76
# script, with the static build defines SafetyHook's copy starts with (without them, Zydis
77
# declares its functions as imported from a shared library)
78
cd "$srcdir/zydis" || exit
79
git submodule init dependencies/zycore
80
git config submodule.dependencies/zycore.url "$srcdir/zycore-c"
81
git -c protocol.file.allow=always submodule update dependencies/zycore
82
python assets/amalgamate.py >/dev/null
83
local _zydis="$srcdir/$_name/third_party/khook/third_party/safetyhook/zydis"
84
grep -q '^#define ZYDIS_STATIC_BUILD$' "$_zydis/Zydis.h" || exit
85
printf '#define ZYCORE_STATIC_BUILD\n#define ZYDIS_STATIC_BUILD\n' |
86
cat - amalgamated-dist/Zydis.h >"$_zydis/Zydis.h"
87
cp amalgamated-dist/Zydis.c "$_zydis/Zydis.c"
88
}
89
90
build() {
91
_compilers
92
mkdir -p "$_name/build"
93
cd "$_name/build" || exit
94
# Position-independent code for the SDKs' tier1 and mathlib, which the build compiles into the
95
# plugins: l4d2's manifest doesn't add -fPIC like the others, which leaves text relocations
96
CXXFLAGS+=" -fPIC"
97
# Every game of hl2sdk, for its servers' architectures: its Source 1 games, the Source 2 ones
98
# (cs2, dota, deadlock) need SDKs hl2sdk doesn't have. The SDKs' shared libraries (tier0,
99
# vstdlib) are only linked against, the games bring their own.
100
python ../configure.py --enable-optimize --enable-tests --sdks=present --targets=x86,x86_64 \
101
--hl2sdk-root=/usr/lib/hl2sdk
102
ambuild
103
}
104
105
check() {
106
cd "$_name/build" || exit
107
# The loader's tests, 32 and 64-bit
108
local _test
109
for _test in loader/test/test_loader/linux-*/test_loader; do
110
"$_test"
111
done
112
}
113
114
_package_amtl_license() {
115
# AMTL has no licence file, its licence is in each of its files
116
sed -n 3,28p "$srcdir/$_name/third_party/amtl/amtl/am-string.h" | sed 's|^// \?||' |
117
install -Dm644 /dev/stdin "$pkgdir/usr/share/licenses/${FUNCNAME[1]#package_}/AMTL.txt"
118
}
119
120
_package_hook_licenses() {
121
# KHook, the hooking library of Metamod:Source 2.0, and its SafetyHook with Zydis and Zycore
122
local _licenses="$pkgdir/usr/share/licenses/${FUNCNAME[1]#package_}"
123
install -Dm644 "$srcdir/$_name/third_party/khook/LICENSE" "$_licenses/KHook.txt"
124
install -Dm644 "$srcdir/safetyhook/LICENSE" "$_licenses/SafetyHook.txt"
125
install -Dm644 "$srcdir/zydis/LICENSE" "$_licenses/Zydis.txt"
126
install -Dm644 "$srcdir/zycore-c/LICENSE" "$_licenses/Zycore.txt"
127
}
128
129
package_metamod-source-dev() {
130
pkgdesc="Metamod:Source, a plugin loader for Source engine game servers, for the Source 1 games of hl2sdk with Linux servers (development builds)"
131
# Metamod:Source and KHook (zlib licence), SafetyHook (Boost), Zydis and Zycore (MIT), AMTL (BSD
132
# 3-clause), the Source SDK's libraries it links (source-sdk.txt)
133
license=(Zlib BSL-1.0 MIT BSD-3-Clause LicenseRef-Source-SDK)
134
# The games' 32-bit and 64-bit servers
135
depends=(gcc-libs glibc lib32-gcc-libs lib32-glibc)
136
# Not a metamod-source for SourceMod, which builds against Metamod:Source 1.12 (with SourceHook,
137
# which 2.0 replaces with KHook), as SourceMod's own builds do
138
conflicts=(metamod-source)
139
140
cd "$_name/build/package" || exit
141
142
# The addons folder of a game (e.g. doi/addons), with metamod.vdf, which loads Metamod:Source, to
143
# copy into a server: the same for each game, with the binaries of every game (metamod.2.<game>.so,
144
# bin/linux64 for the 64-bit servers). In /usr/lib, as it's mostly libraries.
145
install -d "$pkgdir/usr/lib/metamod"
146
cp -r --no-preserve=ownership addons "$pkgdir/usr/lib/metamod/"
147
148
local _licenses="$pkgdir/usr/share/licenses/${FUNCNAME[0]#package_}"
149
install -Dm644 "$srcdir/$_name/LICENSE.txt" -t "$_licenses"
150
install -Dm644 "$srcdir/source-sdk.txt" -t "$_licenses"
151
_package_amtl_license
152
_package_hook_licenses
153
}
154
155
package_metamod-source-dev-src() {
156
pkgdesc="Metamod:Source's sources the metamod-source-dev package is built from, for building plugins against it (--mms-path=/usr/src/metamod-source)"
157
arch=(any)
158
# As metamod-source-dev's, without the Source SDK's libraries
159
license=(Zlib BSL-1.0 MIT BSD-3-Clause)
160
# In the place of metamod-source-src, which SourceMod builds against
161
conflicts=(metamod-source-src)
162
163
# The tree of the build with its submodules (AMTL, the SDK manifests, KHook with SafetyHook and
164
# the regenerated Zydis), without the build and git's files, read-only: builds against it write
165
# into their own build folders. Without the Windows installer of cruft/, prebuilt, and the empty
166
# submodules: AMTL's googletest, KHook's googletest and gtest-parallel.
167
install -d "$pkgdir/usr/src/metamod-source"
168
tar -C "$srcdir/$_name" --exclude=.git --exclude=./build --exclude=__pycache__ --exclude=./cruft \
169
--exclude=./third_party/amtl/third_party --exclude=./third_party/khook/third_party/googletest \
170
--exclude=./third_party/khook/third_party/gtest-parallel -c . |
171
tar -C "$pkgdir/usr/src/metamod-source" -x --no-same-owner
172
173
install -Dm644 "$srcdir/$_name/LICENSE.txt" -t "$pkgdir/usr/share/licenses/${FUNCNAME[0]#package_}"
174
_package_amtl_license
175
_package_hook_licenses
176
}
177
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-11-03 14:04:44 | Low | 1 |