more release build stuff
authorRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 18:01:27 +0000 (20:01 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 18:01:27 +0000 (20:01 +0200)
all
misc/tools/cached-converter.sh

diff --git a/all b/all
index cebe6e70b858879183a5897029813d8b9aab9553..6c5018d8148ee86d1f1a4f2e9315102e09fc2d0b 100755 (executable)
--- a/all
+++ b/all
@@ -862,6 +862,7 @@ case "$cmd" in
                #"$SELF" each git clean -fxd
                rm -rf Xonotic
                mkdir -p Xonotic
+               date +%Y%m%d > Xonotic/stamp.txt
                git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles | {
                        cd Xonotic
                        mkdir data fteqcc darkplaces-src fteqcc-src
@@ -966,7 +967,7 @@ case "$cmd" in
                "$SELF" update-maps
                ;;
        release-finish)
-               # version numnber and stuff like that
+               # version number and stuff like that
                ;;
        release-qc)
                verbose make -C data/xonotic-data.pk3dir FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" FTEQCCFLAGS_WATERMARK=
@@ -984,7 +985,8 @@ case "$cmd" in
                export do_dds=true
                export dds_flags=
                export do_ogg=false
-               find models textures maps/*/ -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
+               export del_src=true
+               find . -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
                ;;
        release-buildpk3-transform-low)
                dir=$1
@@ -992,12 +994,13 @@ case "$cmd" in
                # texture: convert to jpeg and dds
                # music: reduce bitrate
                export do_jpeg=true
-               export jpeg_qual_rgb=85
+               export jpeg_qual_rgb=80
                export jpeg_qual_a=95
                export do_dds=false
                export do_ogg=true
                export ogg_qual=1
-               find models textures maps/*/ sound -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
+               export del_src=true
+               find . -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
                ;;
        release-buildpk3-transform-lowdds)
                dir=$1
@@ -1010,7 +1013,10 @@ case "$cmd" in
                export do_ogg=true
                export ogg_qual=1
                export del_src=true
-               find models textures maps/*/ sound -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
+               find . -type f -print0 | xargs -0 "$d0"/misc/tools/cached-converter.sh
+               if [ -f "quake.rc" ]; then
+                       echo "r_texture_dds_load 1" >> quake.rc
+               fi
                ;;
        release-buildpk3)
                src=$1
@@ -1054,10 +1060,20 @@ case "$cmd" in
                rm -rf Xonotic/temp
                ;;
        release-buildpk3s)
+               stamp=`cat Xonotic/stamp.txt`
                src=$1
                shift
+               dst=${src%.pk3dir}
+               case "$dst" in
+                       data/xonotic-*)
+                               dst="xonotic-$stamp-${dst#data/xonotic-}"
+                               ;;
+                       *)
+                               dst="$dst-$stamp"
+                               ;;
+               esac
                while [ "$#" -gt 1 ]; do
-                       "$SELF" release-buildpk3 "$src" "Xonotic/${src%.pk3dir}$2.pk3" "$1"
+                       "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
                        shift
                        shift
                done
@@ -1067,7 +1083,7 @@ case "$cmd" in
                "$SELF" release-buildpk3s data/xonotic-data.pk3dir       normal '' raw '-raw' low '-low' lowdds '-lowdds'
                "$SELF" release-buildpk3s data/xonotic-maps.pk3dir       normal '' raw '-raw' low '-low' lowdds '-lowdds'
                "$SELF" release-buildpk3s data/xonotic-music.pk3dir                raw ''     low '-low'
-               "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                       low ''     lowdds '-lowdds'
+               "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                       low ''
                ;;
        release-pack-needsx11)
                case "$DISPLAY" in
@@ -1079,6 +1095,44 @@ case "$cmd" in
                                ;;
                esac
                ;;
+       release-zip)
+               zip -9r Xonotic-common.zip \
+                       Xonotic/*.dll \
+                       Xonotic/darkplaces-src \
+                       Xonotic/Docs \
+                       Xonotic/fteqcc-src \
+                       Xonotic/misc \
+                       Xonotic/fteqcc \
+                       Xonotic/server \
+                       Xonotic/*.app \
+                       Xonotic/xonotic-* \
+                       Xonotic/data/font-nimbussansl.pk3
+               cp Xonotic-common.zip Xonotic.zip
+               zip -0r Xonotic.zip \
+                       Xonotic/data/xonotic-data.pk3 \
+                       Xonotic/data/xonotic-maps.pk3 \
+                       Xonotic/data/xonotic-music.pk3 \
+                       Xonotic/data/xonotic-nexcompat.pk3
+               cp Xonotic-common.zip Xonotic-low.zip
+               zip -0r Xonotic-low.zip \
+                       Xonotic/data/xonotic-data-low.pk3 \
+                       Xonotic/data/xonotic-maps-low.pk3 \
+                       Xonotic/data/xonotic-music-low.pk3 \
+                       Xonotic/data/xonotic-nexcompat.pk3
+               cp Xonotic-common.zip Xonotic-lowdds.zip
+               zip -0r Xonotic-lowdds.zip \
+                       Xonotic/data/xonotic-data-lowdds.pk3 \
+                       Xonotic/data/xonotic-maps-lowdds.pk3 \
+                       Xonotic/data/xonotic-music-low.pk3 \
+                       Xonotic/data/xonotic-nexcompat.pk3
+               cp Xonotic-common.zip Xonotic-high.zip
+               zip -0r Xonotic-high.zip \
+                       Xonotic/data/xonotic-data-raw.pk3 \
+                       Xonotic/data/xonotic-maps-raw.pk3 \
+                       Xonotic/data/xonotic-music.pk3 \
+                       Xonotic/data/xonotic-nexcompat.pk3
+               rm -f Xonotic-common.zip
+               ;;
        release)
                "$SELF" release-prepare
                "$SELF" release-maps &
@@ -1087,6 +1141,7 @@ case "$cmd" in
                "$SELF" release-qc &
                wait
                "$SELF" release-pack-needsx11
+               "$SELF" release-zip
                ;;
 
        *)
index 7cd23ff70e4ddc762db89d29cf60df121fe9630a..e3b2d802cc845fb83b97fbe6d239c1b0a1e8b145 100755 (executable)
@@ -163,39 +163,53 @@ has_alpha()
        fi
 }
 
+to_delete=
 for F in "$@"; do
        echo >&2 "Handling $F..."
        conv=false
        keep=false
+       will_jpeg=$do_jpeg
+       will_dds=$do_dds
+       case "$F" in
+               textures/*) ;;
+               models/*) ;;
+               maps/*/*) ;;
+                       ;;
+               *)
+                       # we can't DDS compress the 2D textures, sorry
+                       # but JPEG is still fine
+                       will_dds=false
+                       ;;
+       esac
        case "$F" in
                *_alpha.jpg)
                        # handle in *.jpg case
 
                        # they always got converted, I assume
-                       if $do_dds || $do_jpeg; then
+                       if $will_dds || $will_jpeg; then
                                conv=true
                        fi
-                       keep=$do_jpeg
+                       keep=$will_jpeg
                        ;;
                *.jpg)
                        if [ -f "${F%.jpg}_alpha.jpg" ]; then
-                               cached "$do_dds"  reduce_jpeg2_dds   "$F" "${F%.*}_alpha.jpg" "dds/${F%.*}.dds" ""                  "$dds_flags"
-                               cached "$do_jpeg" reduce_jpeg2_jpeg2 "$F" "${F%.*}_alpha.jpg" "$F"              "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
+                               cached "$will_dds"  reduce_jpeg2_dds   "$F" "${F%.*}_alpha.jpg" "dds/${F%.*}.dds" ""                  "$dds_flags"
+                               cached "$will_jpeg" reduce_jpeg2_jpeg2 "$F" "${F%.*}_alpha.jpg" "$F"              "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
                        else                                   
-                               cached "$do_dds"  reduce_rgb_dds     "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
-                               cached "$do_jpeg" reduce_jpeg_jpeg   "$F" ""                  "$F"              ""                  "$jpeg_qual_rgb"
+                               cached "$will_dds"  reduce_rgb_dds     "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
+                               cached "$will_jpeg" reduce_jpeg_jpeg   "$F" ""                  "$F"              ""                  "$jpeg_qual_rgb"
                        fi
                        ;;
                *.png|*.tga)
                        cached true has_alpha "$F" "" "$F.hasalpha" ""
                        conv=false
                        if [ -s "$F.hasalpha" ]; then
-                               cached "$do_dds"  reduce_rgba_dds    "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
-                               cached "$do_jpeg" reduce_rgba_jpeg2  "$F" ""                  "${F%.*}.jpg"     "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
+                               cached "$will_dds"  reduce_rgba_dds    "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
+                               cached "$will_jpeg" reduce_rgba_jpeg2  "$F" ""                  "${F%.*}.jpg"     "${F%.*}_alpha.jpg" "$jpeg_qual_rgb" "$jpeg_qual_a"
                                rm -f "$F" # TGA becomes useless after JPEGging
                        else                                                             
-                               cached "$do_dds"  reduce_rgb_dds     "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
-                               cached "$do_jpeg" reduce_rgb_jpeg    "$F" ""                  "${F%.*}.jpg"     ""                  "$jpeg_qual_rgb"
+                               cached "$will_dds"  reduce_rgb_dds     "$F" ""                  "dds/${F%.*}.dds" ""                  "$dds_flags"
+                               cached "$will_jpeg" reduce_rgb_jpeg    "$F" ""                  "${F%.*}.jpg"     ""                  "$jpeg_qual_rgb"
                                rm -f "$F" # TGA becomes useless after JPEGging
                        fi
                        rm -f "$F.hasalpha"
@@ -210,8 +224,12 @@ for F in "$@"; do
        if $del_src; then
                if $conv; then
                        if ! $keep; then
-                               rm -f "$F"
+                               # FIXME can't have spaces in filenames that way
+                               to_delete="$to_delete $F"
                        fi
                fi
        fi
 done
+for F in $to_delete; do
+       rm -f "$F"
+done