# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../nexuiz/nexuiz.conf
# Copyright (C) 2006 - 2008 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

nex_install () {
	cp darkplaces-dedicated $root$bindir/nexuiz-dedicated
	for x in glx sdl ; do
		cp darkplaces-$x $root$bindir/nexuiz-$x-bin
		cat > $root$bindir/nexuiz-$x <<-EOT
#!/bin/sh

exec \$0-bin -basedir $datadir/nexuiz $*
EOT
		chmod +x $root$bindir/nexuiz-$x
	done
	cd ../..

	mkdir -p $root$datadir/nexuiz/data/
	cp -rv data/*.pk* $root$datadir/nexuiz/data/
}

var_append makeopt ' ' release
makeinstopt=
var_append zipopt ' ' -d$pkg-$ver

hook_add prepatch 1 'cd Nexuiz; cd sources/ ; unzip gamesource*.zip ; unzip enginesource*.zip ; cd darkplaces'
hook_add postmake 5 'nex_install'