build 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/bash
  2. rm temp -rf
  3. mkdir temp
  4. cp theme temp -r
  5. cp options temp -r
  6. cp icon.png temp/theme
  7. cp icon.png temp/options
  8. cd temp
  9. cd theme/icons
  10. echo "Generating icon layers..."
  11. SIZES="16 22 24 48"
  12. for F in layer-*; do
  13. echo " $F"
  14. echo "/* This Source Code Form is subject to the terms of the Mozilla Public
  15. * License, v. 2.0. If a copy of the MPL was not distributed with this
  16. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  17. @import url(\"chrome://icons/skin/icon-theme-base.css\");
  18. :root {" > $F.css
  19. while read -r LINE; do
  20. LINE1=`echo $LINE | grep -Po "^[\w-]+"`
  21. LINE2=`echo $LINE | grep -Po "[\w-]+$"`
  22. for S in $SIZES; do
  23. echo " --icon-$LINE1-$S: url(\"moz-icon://stock/$LINE2?size=$S\");" >> $F.css
  24. echo " --icon-$LINE1-$S-dis: url(\"moz-icon://stock/$LINE2?size=$S&state=disabled\");" >> $F.css
  25. done
  26. echo "" >> $F.css
  27. done < $F
  28. echo "}" >> $F.css
  29. rm $F
  30. sed -E "s/(size=)16/\1menu/g;s/(size=)22/\1button/g;s/(size=)24/\1toolbar/g;s/(size=)48/\1dialog/g;" -i $F.css
  31. done
  32. echo "Generating icon themes..."
  33. SIZES="16 20 22 24 32 48"
  34. THEMES=`echo */ | sed -E "s/\///g"`
  35. mkdir -p dis
  36. for THEME in $THEMES; do
  37. echo " $THEME"
  38. cd $THEME
  39. BASE=`cat base`
  40. rm base
  41. FILES=""
  42. DIRS=`ls -v`
  43. for D in $SIZES; do
  44. if [ -d ${D}x$D ]; then
  45. cd ${D}x$D
  46. TMP_F=`find * -type f -name "*.png"`
  47. FILES="$FILES $TMP_F"
  48. cd ..
  49. fi
  50. done
  51. FILES=`echo $FILES | sed -E "s/\.png//g;s/\s+/\\n/g" | sort | uniq`
  52. cd ..
  53. cp -r $THEME dis
  54. touch icon-theme-$THEME.css
  55. echo "/* This Source Code Form is subject to the terms of the Mozilla Public
  56. * License, v. 2.0. If a copy of the MPL was not distributed with this
  57. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  58. @import url(\"chrome://icons/skin/icon-theme-$BASE.css\");
  59. :root {" > icon-theme-$THEME.css
  60. for F in $FILES; do
  61. D=`echo $F | grep -Po "^[\w\d-_\.]+"`
  62. N=`echo $F | grep -Po "[\w\d-_]+$"`
  63. for DD in $SIZES; do
  64. if [ -f $THEME/${DD}x$DD/$D/$N.png ]; then
  65. mogrify -alpha set -channel a -evaluate divide 3 dis/$THEME/${DD}x$DD/$D/$N.png
  66. echo " --icon-$N-$DD: url(\"chrome://icons/skin/$THEME/${DD}x$DD/$D/$N.png\");" >> icon-theme-$THEME.css
  67. echo " --icon-$N-$DD-dis: url(\"chrome://icons/skin/dis/$THEME/${DD}x$DD/$D/$N.png\");" >> icon-theme-$THEME.css
  68. fi
  69. done
  70. echo "" >> icon-theme-$THEME.css
  71. done
  72. echo '}' >> icon-theme-$THEME.css
  73. done
  74. cd ../..
  75. echo "Substituting variables..."
  76. FILES="theme/install.rdf options/install.rdf"
  77. while read LINE; do
  78. if [[ $LINE != [A-Z]* ]]; then
  79. continue
  80. fi
  81. LINE1=`echo $LINE | grep -oE "^[^=]+"`
  82. LINE2=`echo $LINE | grep -oE "[^=]+$"`
  83. sed "s|\$$LINE1|$LINE2|g" -i theme/install.rdf options/install.rdf
  84. eval "$LINE1=\"$LINE2\""
  85. done < "../config.txt"
  86. echo "Packaging..."
  87. cd theme
  88. zip ../../gnomerunner-$VERSION-sm-linux.xpi * -qr
  89. cd ../options
  90. zip ../../gnomerunner-options-$VERSION-sm-linux.xpi * -qr
  91. cd ../..