From f1ddc12b68b4e4c8087962de25260470e6df2bea Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Tue, 8 Sep 2026 18:27:39 -0700 Subject: Add tuxanci2 files --- scripts/clean.sh | 31 ----------------------------- scripts/dos2unix.sh | 5 ----- scripts/generate_gettext_pot.sh | 8 -------- scripts/kr.sh | 14 -------------- scripts/replace.sh | 25 ------------------------ scripts/webserver.py | 43 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 43 insertions(+), 83 deletions(-) delete mode 100755 scripts/clean.sh delete mode 100755 scripts/dos2unix.sh delete mode 100755 scripts/generate_gettext_pot.sh delete mode 100755 scripts/kr.sh delete mode 100755 scripts/replace.sh create mode 100755 scripts/webserver.py (limited to 'scripts') diff --git a/scripts/clean.sh b/scripts/clean.sh deleted file mode 100755 index 461b226..0000000 --- a/scripts/clean.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -PWD=$(pwd) -[[ ${PWD/*\//} = scripts ]] && pushd .. > /dev/null || pushd . > /dev/null -# remove compiled files -[ -e "[Mm]akefile" ] && make clean - -# remove folders -find ./ -type d -name CMakeFiles -print | xargs -i rm {} -rf -# some people build Tuxanci in speacial folder -rm -rf ./build - -# remove cmake files -find ./ \( -type f -name \*.so -print , -type f -name \*.cmake -print , -type f -name CMakeCache.txt -print , -type f -name Makefile -print \) | grep -v "./cmake" | xargs -i rm {} -f -find ./ \( -type f -name install_manifest.txt -print , -type f -name cmake_install.cmake -print \) | xargs -i rm {} -f - -# remove precompiled in files -find ./ -name \*.in -print | while read r; do rm -f ${r/\.in/}; done - -# remove compiled binaries -find ./src -name tuxanci -print | xargs -i rm {} -f -find ./src -name tuxanci-server -print | xargs -i rm {} -f - -# remove compiled gettext files -find ./ -name \*.gmo -print | xargs -i rm {} -f - -# remove temporary backup files -find ./ -type f -name \*~ -print | xargs -i rm {} -f - -# remove so libraries -find ./src/modules -type f -name mod\*.so\* | xargs -i rm {} -f -popd >> /dev/null diff --git a/scripts/dos2unix.sh b/scripts/dos2unix.sh deleted file mode 100755 index 70f9c77..0000000 --- a/scripts/dos2unix.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -for suffix in c h sh cmake txt in conf lang ebuild po pot 1 rc desktop; do - find . -name \*.$suffix -print | xargs -i sed -i -e 's@\r@@g' {} -done diff --git a/scripts/generate_gettext_pot.sh b/scripts/generate_gettext_pot.sh deleted file mode 100755 index dd97ff1..0000000 --- a/scripts/generate_gettext_pot.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -PWD=$(pwd) -[[ ${PWD/*\//} = scripts ]] && pushd .. > /dev/null || pushd . > /dev/null -xgettext --no-wrap --width 1 --default-domain=tuxanci --msgid-bugs-address=team@tuxanci.org --add-comments=/// -k_ `find ./ -name \*.c | grep -v .git | sort | uniq | tr '\n' ' '` -o ./po/tuxanci.pot -cd po/ -find ./ -name \*.po -print | xargs -i msgmerge --no-wrap --width 1 -U {} tuxanci.pot -rm -rf *~ -popd > /dev/null diff --git a/scripts/kr.sh b/scripts/kr.sh deleted file mode 100755 index 4977efc..0000000 --- a/scripts/kr.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -PWD=$(pwd) -[[ ${PWD/*\//} = scripts ]] && pushd .. > /dev/null || pushd . > /dev/null - -if [ ! "$1" ]; then - echo "Help: this script indents code according to the K&R standard" - echo "Usage: $0 path/to/file.c" - exit 1 -elif [ ! -e "$1" ]; then - echo "Error: file '$1' doesn't exist!" - exit 1 -fi - -indent -kr -l79 -ts4 -ip4 -ppi 4 "$1" diff --git a/scripts/replace.sh b/scripts/replace.sh deleted file mode 100755 index 7912c72..0000000 --- a/scripts/replace.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# '@' - this char is prohibited to use -oldtext="$1" -newtext="$2" - -GoThroughDir() { - for D in $1*; do - if [ -d $D ] && [ "$D" == "./.git" ]; then - continue - elif [ -d $D ] && [ "$D" == "./build" ]; then - continue - elif [ -d $D ]; then - GoThroughDir $D/ - elif [ "$D" == "$0" ]; then - continue - else - sed -i -e "s@$oldtext@$newtext@" $D - fi - done -} - -GoThroughDir ./ - -grep -iHr "$oldtext" ./ | grep -v .git/ diff --git a/scripts/webserver.py b/scripts/webserver.py new file mode 100755 index 0000000..b00ccff --- /dev/null +++ b/scripts/webserver.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +# Tuxanci 2 - A first person shooter +# Copyright (C) 2007-2011 Tuxánci Development Team +# Copyright (C) 2025-2026 Connor Thomson +# +# 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, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from http.server import HTTPServer, SimpleHTTPRequestHandler +import os + +addr = "127.0.0.1" +port = 8080 +path = "../build" +file = "tuxanci2.html" + +script_dir = os.path.dirname(os.path.abspath(__file__)) +serve_dir = os.path.join(script_dir, path) + +class HTTPServerHandler(SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=serve_dir, **kwargs) + + def do_GET(self): + if self.path in ("/", "/index.html"): + self.path = f"/{file}" + return super().do_GET() + +server = HTTPServer((addr, port), HTTPServerHandler) + +print(f"http://{addr}:{port}/") +server.serve_forever() -- cgit v1.2.3