[quake] 05/10: quake4.in: use the same source for ETQW

Simon McVittie smcv at debian.org
Mon Dec 28 00:24:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository quake.

commit a17b574fc5f9618988b9d199b7fb65c2cc2084ab
Author: Simon McVittie <smcv at debian.org>
Date:   Sun Dec 27 22:39:45 2015 +0000

    quake4.in: use the same source for ETQW
    
    The idTech4 engines are sufficiently similar that we only really need
    one script for them.
---
 Makefile  | 32 ++++++++++++++++++++++++--
 etqw.in   | 77 ---------------------------------------------------------------
 quake4.in | 58 ++++++++++++++++++++++++++++++++---------------
 3 files changed, 70 insertions(+), 97 deletions(-)

diff --git a/Makefile b/Makefile
index 48a4eff..1d00d40 100644
--- a/Makefile
+++ b/Makefile
@@ -76,18 +76,32 @@ build/quake3: quake3.in Makefile
 build/quake4: quake4.in Makefile
 	install -d build
 	sed \
+		-e 's!@id@!quake4!' \
+		-e 's!@longname@!Quake 4!' \
+		-e 's!@shortname@!Quake 4!' \
 		-e 's!@binary@!quake4.x86!' \
+		-e 's!@smpbinary@!quake4smp.x86!' \
 		-e 's!@self@!quake4!' \
 		-e 's!@role@!client!' \
+		-e 's!@pkglibdir@!/usr/lib/quake4!' \
+		-e 's!@paks@!pak001 pak021 pak022 zpak_english!' \
+		-e 's!@basegame@!q4base!' \
 		< $< > $@
 	chmod +x $@
 
-build/etqw: etqw.in Makefile
+build/etqw: quake4.in Makefile
 	install -d build
 	sed \
+		-e 's!@id@!etqw!' \
+		-e 's!@longname@!Enemy Territory: Quake Wars!' \
+		-e 's!@shortname@!ETQW!' \
 		-e 's!@binary@!etqw.x86!' \
+		-e 's!@smpbinary@!etqw-rthread.x86!' \
 		-e 's!@self@!etqw!' \
 		-e 's!@role@!client!' \
+		-e 's!@pkglibdir@!/usr/lib/etqw!' \
+		-e 's!@paks@!pak008 game000 pak000 zpak_english000!' \
+		-e 's!@basegame@!base!' \
 		< $< > $@
 	chmod +x $@
 
@@ -121,18 +135,32 @@ build/quake3-server: quake3.in Makefile
 build/quake4-dedicated: quake4.in Makefile
 	install -d build
 	sed \
+		-e 's!@id@!quake4!' \
+		-e 's!@longname@!Quake 4!' \
+		-e 's!@shortname@!Quake 4!' \
 		-e 's!@binary@!q4ded.x86!' \
+		-e 's!@smpbinary@!!' \
 		-e 's!@self@!quake4-dedicated!' \
 		-e 's!@role@!server!' \
+		-e 's!@pkglibdir@!/usr/lib/quake4!' \
+		-e 's!@paks@!pak001 pak021 pak022 zpak_english!' \
+		-e 's!@basegame@!q4base!' \
 		< $< > $@
 	chmod +x $@
 
-build/etqw-dedicated: etqw.in Makefile
+build/etqw-dedicated: quake4.in Makefile
 	install -d build
 	sed \
+		-e 's!@id@!etqw!' \
+		-e 's!@longname@!Enemy Territory: Quake Wars!' \
+		-e 's!@shortname@!ETQW!' \
 		-e 's!@binary@!etqwded.x86!' \
+		-e 's!@smpbinary@!!' \
 		-e 's!@self@!etqw-dedicated!' \
 		-e 's!@role@!server!' \
+		-e 's!@pkglibdir@!/usr/lib/etqw!' \
+		-e 's!@paks@!pak008 game000 pak000 zpak_english000!' \
+		-e 's!@basegame@!base!' \
 		< $< > $@
 	chmod +x $@
 
diff --git a/etqw.in b/etqw.in
deleted file mode 100644
index f973bd7..0000000
--- a/etqw.in
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-
-# etqw or etqw-dedicated
-self=@self@
-# client or server
-role=@role@
-# etqw.x86, etqw-rthread.x86 or etqwded.x86
-binary=@binary@
-
-pkglibdir="/usr/lib/etqw"
-
-help() {
-  cat <<EOF
-Enemy Territory: Quake Wars ${role} wrapper for Debian
-
-Usage: ${self} [OPTION]...
-
- -h, --help\t\tDisplay this help
-EOF
-
-  if [ "$role" = client ] && [ -x "$pkglibdir/etqw-rthread.x86" ]; then
-    cat <<EOF
- --smp\t\tUse the multi-threaded version of the client
-EOF
-  fi
-
-  cat <<EOF
- +<internal command>\tPass commands to the engine
-EOF
-}
-
-while [ "$1" != "" ]; do
-  case "$1" in
-    -h|--help)
-      help
-      exit 0
-      ;;
-    --smp)
-      if [ "$role" = client ] && [ -x "$pkglibdir/etqw-rthread.x86" ]; then
-        binary=etqw-rthread.x86
-      fi
-      ;;
-    *)
-      break
-      ;;
-  esac
-  shift
-done
-
-# sanity check: the engine doesn't cope well with missing data
-for i in pak008 game000 pak000 zpak_english000; do
-  if [ -f $pkglibdir/base/$i.pk4 ]; then
-    :
-  else
-    if [ "$role" = client ]; then
-      $pkglibdir/need-data.sh "Enemy Territory: Quake Wars" "$(cat $pkglibdir/README.etqw-data)"
-    else
-      echo "ETQW data missing, see /usr/share/doc/etqw-server/README.etqw-data"
-    fi
-    exit 72     # EX_OSFILE
-  fi
-done
-
-cvars="+set com_allowconsole 1"
-
-# ETQW expects to run in its installation directory
-cd "$pkglibdir"
-# The SMP binary needs a modified bundled copy of SDL.
-export LD_LIBRARY_PATH="${pkglibdir}${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}"
-
-if test -n "$QUAKE4_BACKTRACE"; then
-  exec gdb -return-child-result -batch -ex run -ex 'thread apply all bt full' -ex kill -ex quit --args "${pkglibdir}/${binary}" ${cvars} "$@"
-else
-  exec ${QUAKE4_DEBUGGER} "${pkglibdir}/${binary}" ${cvars} "$@"
-fi
-
-# vim:set sw=2 sts=2 et:
diff --git a/quake4.in b/quake4.in
index 1a6bf61..bad7886 100644
--- a/quake4.in
+++ b/quake4.in
@@ -1,31 +1,43 @@
 #!/bin/sh
 
-# quake4 or quake4-dedicated
-self=@self@
+# Quake 4 or Enemy Territory: Quake Wars
+longname="@longname@"
+# Quake 4 or ETQW
+shortname="@shortname@"
+# quake4 or etqw
+id="@id@"
+# quake4, etqw or *-dedicated
+self="@self@"
 # client or server
-role=@role@
-# quake4.x86, quake4smp.x86 or q4ded.x86
-binary=@binary@
+role="@role@"
+# *.x86 (not SMP)
+binary="@binary@"
+# quake4smp.x86 or etqw-rthread.x86
+smpbinary="@smpbinary@"
+# q4base or base
+basegame="@basegame@"
+# required packages
+paks="@paks@"
 
-pkglibdir="/usr/lib/quake4"
+pkglibdir="/usr/lib/${id}"
 
 help() {
   cat <<EOF
-Quake 4 ${role} wrapper for Debian
+${longname} ${role} wrapper for Debian
 
 Usage: ${self} [OPTION]...
 
  -h, --help\t\tDisplay this help
 EOF
 
-  if [ "$role" = client ] && [ -x "$pkglibdir/quake4smp.x86" ]; then
+  if [ -n "${smpbinary}" ] && [ -x "${pkglibdir}/${smpbinary}" ]; then
     cat <<EOF
  --smp\t\tUse the multi-threaded version of the client
 EOF
   fi
 
   cat <<EOF
- +<internal command>\tPass commands to the engine
+ +<internal command>\tPass idTech4 console commands to the engine
 EOF
 }
 
@@ -36,8 +48,8 @@ while [ "$1" != "" ]; do
       exit 0
       ;;
     --smp)
-      if [ "$role" = client ] && [ -x "$pkglibdir/quake4smp.x86" ]; then
-        binary=quake4smp.x86
+      if [ -n "${smpbinary}" ] && [ -x "${pkglibdir}/${smpbinary}" ]; then
+        binary="${smpbinary}"
       fi
       ;;
     *)
@@ -48,14 +60,14 @@ while [ "$1" != "" ]; do
 done
 
 # sanity check: the engine doesn't cope well with missing data
-for i in pak001 pak021 pak022 zpak_english; do
-  if [ -f $pkglibdir/q4base/$i.pk4 ]; then
+for i in ${paks}; do
+  if [ -f $pkglibdir/$basegame/$i.pk4 ]; then
     :
   else
     if [ "$role" = client ]; then
-      $pkglibdir/need-data.sh "Quake 4" "$(cat $pkglibdir/README.quake4-data)"
+      $pkglibdir/need-data.sh "${longname}" "$(cat $pkglibdir/README.${id}-data)"
     else
-      echo "Quake 4 data missing, see /usr/share/doc/quake4-server/README.quake4-data"
+      echo "${shortname} data missing, see /usr/share/doc/${id}-server/README.${id}-data"
     fi
     exit 72     # EX_OSFILE
   fi
@@ -66,12 +78,22 @@ cvars="+set com_allowconsole 1"
 # Quake 4 expects to run in its installation directory
 cd "$pkglibdir"
 # The SMP binary needs a modified bundled copy of SDL.
-export LD_LIBRARY_PATH="${pkglibdir}${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}"
+set \
+  env LD_LIBRARY_PATH="${pkglibdir}${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}" \
+  "$@"
+shift
 
 if test -n "$QUAKE4_BACKTRACE"; then
-  exec gdb -return-child-result -batch -ex run -ex 'thread apply all bt full' -ex kill -ex quit --args "${pkglibdir}/${binary}" ${cvars} "$@"
+  set gdb -return-child-result -batch \
+    -ex run -ex 'thread apply all bt full' -ex kill -ex quit \
+    --args "${pkglibdir}/${binary}" ${cvars} \
+    "$@"
+  shift
 else
-  exec ${QUAKE4_DEBUGGER} "${pkglibdir}/${binary}" ${cvars} "$@"
+  set _ ${QUAKE4_DEBUGGER} "${pkglibdir}/${binary}" ${cvars} "$@"
+  shift
 fi
 
+exec "$@"
+
 # vim:set sw=2 sts=2 et:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/quake.git



More information about the Pkg-games-commits mailing list