File indexing completed on 2024-05-05 04:00:57

0001 #!/bin/sh
0002 
0003 if [ $# -ne 3 -a $# -ne 4 ]; then
0004   echo "You need to supply three mandatory arguments, e.g.:"
0005   echo "$0 apps/internet-mail apps/kmail ../../../../kdepim/kmail/icons/"
0006   echo "...and optionally the namespace (e.g. \"ox\" or \"hi\") as fourth argument."
0007   exit
0008 fi
0009 
0010 # Split the two arguments into their category and icon name parts.
0011 src="$1"
0012 src_category=${src%/*}
0013 src_icon=${src#*/}
0014 
0015 dest="$2"
0016 dest_category=${dest%/*}
0017 dest_icon=${dest#*/}
0018 
0019 destdir="$3"
0020 
0021 ns="ox"
0022 if [ $# -eq 4 ]; then
0023   ns="$4"
0024 fi
0025 
0026 svn add $destdir
0027 
0028 # Copy the scalable icon.
0029 if [ -f scalable/$src.svgz ]; then
0030   echo "Copying scalable/$src.svgz to $destdir/${ns}sc-$dest_category-$dest_icon.svgz..."
0031   svn cp scalable/$src.svgz $destdir/${ns}sc-$dest_category-$dest_icon.svgz
0032   echo
0033 fi
0034 
0035 # Copy the optimized small versions of the icon.
0036 for size in 8 16 22 32 48 64 128 256; do
0037   dir="${size}x${size}"
0038 
0039   if [ -f scalable/$src_category/small/$dir/$src_icon.svgz ]; then
0040     echo "Copying scalable/$src_category/small/$dir/$src_icon.svgz"
0041     echo "     to $destdir/${ns}$size-$dest_category-$dest_icon.svgz..."
0042 
0043     # Generate the size dir for smaller SVGs (e.g. icons/22x22/) if necessary.
0044     if [ ! -d $destdir/small ]; then
0045       svn mkdir $destdir/small
0046     fi
0047 
0048     svn cp scalable/$src_category/small/$dir/$src_icon.svgz $destdir/small/${ns}$size-$dest_category-$dest_icon.svgz
0049     echo
0050   fi
0051 done
0052 
0053 # Copy the rendered PNGs.
0054 for size in 8 16 22 32 48 64 128 256; do
0055   dir="${size}x${size}"
0056 
0057   if [ -f $dir/$src.png ]; then
0058     echo "Copying $dir/$src.png to $destdir/${ns}$size-$dest_category-$dest_icon.png..."
0059     svn cp $dir/$src.png $destdir/${ns}$size-$dest_category-$dest_icon.png
0060     echo
0061   fi
0062 done