From: Rudolf Polzer Date: Fri, 6 Aug 2010 06:33:34 +0000 (+0200) Subject: add a rebranding script X-Git-Tag: xonotic-v0.1.0preview~326 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=8e78fb405cd6e13a3c9187b3c3748769e66815ad;ds=sidebyside add a rebranding script --- diff --git a/misc/tools/rebrand-darkplaces-engine.sh b/misc/tools/rebrand-darkplaces-engine.sh new file mode 100755 index 00000000..7ba4603a --- /dev/null +++ b/misc/tools/rebrand-darkplaces-engine.sh @@ -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 <"$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 index 00000000..14ac4fc2 --- /dev/null +++ b/misc/tools/xonotic.brand @@ -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"