rebrand: also add TGA icons (possibly converted from png)
[xonotic/xonotic.git] / misc / tools / rebrand-darkplaces-engine.sh
index 3ac3cbd844afd1c7e8f3c9ab0df9269e2528efbf..0e911bb37ecf750b2f0160e9d8c0faf854827bc4 100755 (executable)
@@ -10,7 +10,12 @@ userdirname=darkplaces
 icon_icns=Darkplaces.app/Contents/Resources/Darkplaces.icns
 icon_ico=darkplaces.ico
 icon_xpm=darkplaces.xpm
+icons_tga=
 
+if [ -z "$1" ] || [ x"$1" = x"--help" ]; then
+       echo "Usage: $0 brandfile binaries..."
+       exit
+fi
 . "$1"; shift
 
 d=`pwd`
@@ -60,8 +65,17 @@ for EXECUTABLE in "$@"; do
 
        if $uses_xpm; then
                cp "$icon_xpm" "$t/darkplaces-icon.xpm"
+               cnt=
+               for i in $icons_tga; do
+                       convert "$i" "$t/darkplaces-icon$cnt.tga"
+                       if [ -z "$cnt" ]; then
+                               cnt=2
+                       else
+                               cnt=$(($cnt+1))
+                       fi
+               done
                cd "$t"
-               zip -9r darkplaces-this.zip darkplaces-icon.xpm
+               zip -9r darkplaces-this.zip darkplaces-icon*
                cd "$d"
        fi
 
@@ -111,8 +125,9 @@ EOF
                                pkgdir=..
                                ;;
                esac
-               cp "$icon_icns" "$pkgdir/Resources/Darkplaces.icns"
-               cat <<EOF >"$pkgdir/Resources/English.lproj/InfoPlist.strings"
+               if [ -d "$pkgdir/Resources" ]; then
+                       cp "$icon_icns" "$pkgdir/Resources/Darkplaces.icns"
+                       cat <<EOF >"$pkgdir/Resources/English.lproj/InfoPlist.strings"
 /* Localized versions of Info.plist keys */
 
 CFBundleName = "$name";
@@ -120,9 +135,10 @@ CFBundleShortVersionString = "$name";
 CFBundleGetInfoString = "Darkplaces by Forest 'LordHavoc' Hale";
 NSHumanReadableCopyright = "Copyright `date +%Y`";
 EOF
+               fi
        fi
 
        cat "$t/darkplaces-this.zip" >> "$EXECUTABLE"
 done
 
-rm -f "$t"
+rm -rf "$t"