]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge branch 'master' of ssh://git.xonotic.org/xonotic
authorRudolf Polzer <divverent@alientrap.org>
Fri, 6 Aug 2010 06:37:15 +0000 (08:37 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 6 Aug 2010 06:37:15 +0000 (08:37 +0200)
misc/tools/rebrand-darkplaces-engine.sh [new file with mode: 0755]
misc/tools/xonotic.brand [new file with mode: 0644]

diff --git a/misc/tools/rebrand-darkplaces-engine.sh b/misc/tools/rebrand-darkplaces-engine.sh
new file mode 100755 (executable)
index 0000000..7ba4603
--- /dev/null
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+# all these shall be defined in a .brand file passed as first argument
+flags="-quake"
+name=DarkPlaces-Quake
+dirname1=id1
+dirname2=
+screenshotname=dp
+userdirname=darkplaces
+icon_icns=Darkplaces.app/Contents/Resources/Darkplaces.icns
+icon_ico=darkplaces.ico
+icon_xpm=darkplaces.xpm
+
+. "$1"; shift
+
+flags="$flags -customgamename \"$name\" -customgamedirname1 \"$dirname1\" -customgamedirname2 \"$dirname2\" -customgamescreenshotname \"$screenshotname\" -customuserdirname \"$userdirname\""
+echo "$flags" > darkplaces.opt
+
+for EXECUTABLE in "$@"; do
+       uses_xpm=false
+       uses_ico=false
+       uses_icns=false
+
+       # detect what the executable is
+       case "`file -b "$EXECUTABLE"`" in
+               *ELF*)
+                       case "$EXECUTABLE" in
+                               *-dedicated)
+                                       ;;
+                               *)
+                                       uses_xpm=true
+                                       ;;
+                       esac
+                       ;;
+               *Mach*)
+                       uses_icns=true
+                       case "$EXECUTABLE" in
+                               *-sdl)
+                                       uses_xpm=true
+                                       ;;
+                               *)
+                                       ;;
+                       esac
+                       ;;
+               *PE*)
+                       uses_ico=true
+                       ;;
+       esac
+
+       # add a selfpack
+       rm -f darkplaces.zip
+       zip -9r darkplaces.zip darkplaces.opt
+
+       if $uses_xpm; then
+               cp "$icon_xpm" darkplaces-icon.xpm
+               zip -9r darkplaces.zip darkplaces-icon.xpm
+               rm -f darkplaces-icon.xpm
+       fi
+
+       if $uses_ico; then
+               e=$EXECUTABLE \
+               i=$icon_ico \
+               n=$name \
+               perl <<'EOF'
+               use strict;
+               use warnings;
+               use Win32::Exe;
+
+               my $n = $ENV{n};
+               my $i = $ENV{i};
+               my $e = $ENV{e};
+
+               my $exe = Win32::Exe->new($e)
+                       or die "Win32::Exe->new: $!";
+               $exe = $exe->create_resource_section()
+                       unless $exe->has_resource_section();
+               $exe->update(icon => $i);
+               $exe->update(info => ["InternalName=$e"]);
+               $exe->update(info => ["OriginalFilename=$e"]);
+               $exe->update(info => ["ProductName=$n"]);
+               $exe->write($e)
+                       or die "Win32::Exe->write: $!";
+EOF
+       fi
+
+       if $uses_icns; then
+               # OS X is special here
+               case "$EXECUTABLE" in
+                       */*)
+                               pkgdir="${EXECUTABLE%/*}/.."
+                               ;;
+                       *)
+                               pkgdir=..
+                               ;;
+               esac
+               cp "$icon_icns" "$pkgdir/Resources/Darkplaces.icns"
+               cat <<EOF >"$pkgdir/Resources/English.lproj/InfoPlist.strings"
+/* Localized versions of Info.plist keys */
+
+CFBundleName = "$name";
+CFBundleShortVersionString = "$name";
+CFBundleGetInfoString = "Darkplaces by Forest 'LordHavoc' Hale";
+NSHumanReadableCopyright = "Copyright `date +%Y`";
+EOF
+       fi
+
+       cat darkplaces.zip >> "$EXECUTABLE"
+       rm -f darkplaces.zip
+done
+
+rm -f darkplaces.opt
diff --git a/misc/tools/xonotic.brand b/misc/tools/xonotic.brand
new file mode 100644 (file)
index 0000000..14ac4fc
--- /dev/null
@@ -0,0 +1,9 @@
+flags="-nexuiz"
+name=Xonotic
+dirname1=data
+dirname2=
+screenshotname=xonotic
+userdirname=xonotic
+icon_icns="$d0/misc/logos/icons_icns/xonotic.icns"
+icon_ico="$d0/misc/logos/icons_ico/xonotic_64.ico"
+icon_xpm="$d0/misc/logos/icons_xpm/xonotic_32.xpm"