diff --git a/polymer/eduke32/platform/osxbuild.sh b/polymer/eduke32/platform/osxbuild.sh
index 9169b3f01..2ddba064c 100755
--- a/polymer/eduke32/platform/osxbuild.sh
+++ b/polymer/eduke32/platform/osxbuild.sh
@@ -191,16 +191,15 @@ if [ `expr $darwinversion \> 10` == 1 ]; then
fi
# Detect versioning systems and pull the revision number:
-rev=$(svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
+export VC_REV=$(svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
vc=svn
-if [ -z "$rev" ]; then
+if [ -z "$VC_REV" ]; then
vc=git
- rev=$(git log | grep 'git-svn-id:' | head -n 1 | sed -E 's/.*\@([0-9]+).*/\1/')
- echo "Detected git repository, revision r$rev"
+ export VC_REV=$(git svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
fi
-if [ -z "$rev" ]; then
- rev=unknown
+if [ -z "$VC_REV" ]; then
+ export VC_REV=Unknown
vc=none
fi
@@ -410,7 +409,7 @@ if [ $success == 1 ]; then
# Output README.OSX:
let "darwinversion -= 4"
- echo "This archive was produced from revision $rev by the osxbuild.sh script." > README.OSX
+ echo "This archive was produced from revision ${VC_REV} by the osxbuild.sh script." > README.OSX
echo "Built on: Mac OS X 10.$darwinversion" >> README.OSX
echo "EDuke32 home: http://www.eduke32.com" >> README.OSX
echo "OS X build discussion on Duke4.net: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/" >> README.OSX
@@ -423,18 +422,18 @@ if [ $success == 1 ]; then
lastrevision=$(ls -A1 eduke32-osx* | tail -n1 | cut -d- -f3 | cut -d. -f1)
if [ -z $lastrevision ]; then
- let lastrevision=rev-1
- elif [ $lastrevision -lt $rev ]; then
+ let lastrevision=VC_REV-1
+ elif [ $lastrevision -lt $VC_REV ]; then
let lastrevision+=1
else
- let lastrevision=rev-1
+ let lastrevision=VC_REV-1
fi
fi
echo "Using r$lastrevision as last revision for change log"
if [ "$vc" == "svn" ]; then
- svn log -r $rev:$lastrevision > Changelog.txt
+ svn log -r $VC_REV:$lastrevision > Changelog.txt
elif [ "$vc" == "git" ]; then
commitid=$(git log --grep="git-svn-id: .*@$lastrevision" -n 1 | grep -E '^commit ' | head -n 1 | awk '{print $2}')
# Get the commit messages and strip the email addresses
@@ -443,7 +442,7 @@ if [ $success == 1 ]; then
# Package
if [ $pack == 1 ]; then
- arfilename="eduke32-osx-$rev.zip"
+ arfilename="eduke32-osx-${VC_REV}.zip"
echo "Packing distribution into $arfilename"
rm -f "$arfilename"
zip -r -y "$arfilename" * -x "*.svn*" "*.git*" "*.dll"
diff --git a/polymer/eduke32/platform/wiibuild.bat b/polymer/eduke32/platform/wiibuild.bat
deleted file mode 100644
index 6755b544d..000000000
--- a/polymer/eduke32/platform/wiibuild.bat
+++ /dev/null
@@ -1,49 +0,0 @@
-@echo off
-setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
-
-set targets=eduke32 mapster32
-set PATH=C:\devkitPro\devkitPPC\bin;C:\devkitPro\msys\bin;%PATH%
-set DEVKITPPC=C:/devkitPro/devkitPPC
-set DEVKITPRO=C:/devkitPro
-
-pushd "%~dp0.."
-set wiidir=platform\Wii
-
-:: Detect versioning systems and pull the revision number:
-for /f "delims=" %%G in ('svn info 2^>^&1 ^| grep Revision ^| cut -d " " -f 2') do @set rev=%%G
-if not "%rev%"=="" set vc=svn
-if "%rev%"=="" for /f "delims=" %%G in ('git svn info 2^>^&1 ^| grep Revision ^| cut -d " " -f 2') do @set rev=%%G
-if not "%rev%"=="" set vc=git
-if "%rev%"=="" set vc=none
-if "%rev%"=="" set rev=XXXX
-
-:: Get the current date:
-for /f "delims=" %%G in ('"C:\devkitPro\msys\bin\date.exe" +%%Y%%m%%d') do @set currentdate=%%G
-
-:: Build:
-set commandline=mingw32-make PLATFORM=WII %* STRIP=""
-echo %commandline%
-%commandline%
-
-for %%G in (%targets%) do if not exist "%%~G.dol" goto end
-
-:: Package data:
-if not exist apps mkdir apps
-for %%G in (%targets%) do xcopy /e /q /y %wiidir%\apps\%%~G apps\%%~G\
-for %%G in (%targets%) do for %%H in (.dol) do if exist "%%~G%%~H" move /y "%%~G%%~H" "apps\%%~G\boot%%~H"
-for %%G in (%targets%) do for %%H in (.elf.map) do if exist "%%~G%%~H" del /f /q "%%~G%%~H"
-for %%G in (%targets%) do "echo.exe" -e " r%rev%\n %currentdate%" | "cat.exe" "%wiidir%\%%~G_meta_1.xml" - "%wiidir%\%%~G_meta_2.xml" >"apps\%%~G\meta.xml"
-
-xcopy /e /q /y /EXCLUDE:%wiidir%\xcopy_exclude.txt package\common apps\eduke32\
-
-xcopy /e /q /y /EXCLUDE:%wiidir%\xcopy_exclude.txt package\common apps\mapster32\
-xcopy /e /q /y /EXCLUDE:%wiidir%\xcopy_exclude.txt package\sdk apps\mapster32\
-
-"ls.exe" -l -R apps
-7z.exe a -mx9 -ms=on -t7z eduke32-wii-r%rev%-debug-elf.7z *.elf -xr!*.svn*
-7z.exe a -mx9 -ms=on -t7z eduke32-wii-r%rev%.7z apps -xr!*.svn*
-
-:end
-
-endlocal
-goto :eof
diff --git a/polymer/eduke32/platform/wiibuild.sh b/polymer/eduke32/platform/wiibuild.sh
new file mode 100644
index 000000000..5c7416ef4
--- /dev/null
+++ b/polymer/eduke32/platform/wiibuild.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+get_abs_path()
+{
+ echo "$(cd "$1" && pwd)"
+}
+
+targets=( eduke32 mapster32 )
+extensions=( ".dol" )
+
+sourcedir="$(dirname "${BASH_SOURCE[0]}")"
+sourcedir="$(get_abs_path "$sourcedir/..")"
+
+pushd "${sourcedir}" >/dev/null
+
+# Detect versioning systems and pull the revision number:
+export VC_REV=$(svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
+vc=svn
+if [ -z "$VC_REV" ]; then
+ vc=git
+ export VC_REV=$(git svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
+fi
+if [ -z "$VC_REV" ]; then
+ export VC_REV=Unknown
+ vc=none
+fi
+
+date=$(date +%Y%m%d)
+
+make=( make PLATFORM=WII $* STRIP="" SDLCONFIG="" )
+
+echo "${make[@]}"
+"${make[@]}"
+
+for i in "${targets[@]}"; do
+ for j in "${extensions[@]}"; do
+ if [ ! -f "$i$j" ]; then
+ exit 1
+ fi
+ done
+done
+
+# Package data:
+mkdir -p apps
+
+for i in "${targets[@]}"; do
+ cp -R "platform/Wii/apps/$i" "apps/"
+ for j in "${extensions[@]}"; do
+ mv -f "$i$j" "apps/${i}/boot${j}"
+ done
+ for j in ".elf.map"; do
+ rm -f "$i$j"
+ done
+ echo -e " r${VC_REV}\n ${date}" | cat "platform/Wii/${i}_meta_1.xml" - "platform/Wii/${i}_meta_2.xml" >"apps/${i}/meta.xml"
+done
+
+if [ -d "apps/eduke32" ]; then
+ cp -R package/common/* apps/eduke32/
+ rm -f apps/eduke32/*.dll
+fi
+
+if [ -d "apps/mapster32" ]; then
+ cp -R package/common/* apps/mapster32/
+ cp -R package/sdk/* apps/mapster32/
+ rm -f apps/mapster32/*.dll
+fi
+
+ls -l -R apps
+
+rm -f "eduke32-wii-r${VC_REV}-debug-elf.7z"
+rm -f "eduke32-wii-r${VC_REV}.7z"
+7zr a -mx9 -ms=on -t7z "eduke32-wii-r${VC_REV}-debug-elf.7z" *.elf -xr!*.svn*
+7zr a -mx9 -ms=on -t7z "eduke32-wii-r${VC_REV}.7z" apps -xr!*.svn*
+
+popd >/dev/null