make-package 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. echo
  3. echo "Packing LÖVE to go v1.2"
  4. echo
  5. arch="i386"
  6. if [ "`uname -m | grep -c -G x86_64`" != 0 ]; then
  7. arch="amd64"
  8. fi
  9. if [ -z "$2" ]; then
  10. echo "Syntax: ./make-package <package> <version>"
  11. echo "Example: ./make-package deb 0.3.0-1"
  12. echo "All files will be created in this folder."
  13. echo
  14. exit 0
  15. fi
  16. case "$1" in
  17. deb )
  18. strip ../../src/love
  19. mkdir deb
  20. mkdir deb/DEBIAN
  21. cat debian | sed "s/%VERSION%/$2/" | sed "s/%ARCHITECTURE%/$arch/g" > deb/DEBIAN/tmp
  22. cat deb/DEBIAN/tmp
  23. sed "s/%INSTALLSIZE%/`ls -l ../../src/love | awk '{ sum += $5 } END { printf "%.2f", sum / 1000 }'`/" < deb/DEBIAN/tmp > deb/DEBIAN/control
  24. rm deb/DEBIAN/tmp
  25. cp postinst deb/DEBIAN/postinst
  26. cp postrm deb/DEBIAN/postrm
  27. mkdir deb/usr
  28. mkdir deb/usr/bin
  29. cp ../../src/love deb/usr/bin/love
  30. mkdir deb/usr/share
  31. mkdir deb/usr/share/mime
  32. mkdir deb/usr/share/mime/packages
  33. cp love.xml deb/usr/share/mime/packages
  34. mkdir deb/usr/share/icons
  35. mkdir deb/usr/share/icons/gnome
  36. mkdir deb/usr/share/icons/gnome/scalable
  37. mkdir deb/usr/share/icons/gnome/scalable/apps
  38. cp app.svg deb/usr/share/icons/gnome/scalable/apps/love.svg
  39. mkdir deb/usr/share/icons/gnome/scalable/mimetypes
  40. cp game.svg deb/usr/share/icons/gnome/scalable/mimetypes/gnome-mime-application-love-game.svg
  41. mkdir deb/usr/share/applications
  42. cp love.desktop deb/usr/share/applications
  43. dpkg -b deb love-$2.deb && \
  44. echo " * love-$2.deb created"
  45. rm -rf deb
  46. ;;
  47. src )
  48. cd ../../../
  49. tar -czf love/platform/unix/love-$2-src.tar.gz --exclude=*.o --exclude=.* love/demos/* love/*.txt love/src/ && \
  50. echo " * love-$2-src.tar.gz created"
  51. tar -cjf love/platform/unix/love-$2-src.tar.bz2 --exclude=*.o --exclude=.* love/demos/* love/*.txt love/src/ && \
  52. echo " * love-$2-src.tar.bz2 created"
  53. zip -9q love/platform/unix/love-$2-src.zip love/*.txt love/demos/* `find love/src/* | grep -viE *.o` && \
  54. echo " * love-$2-src.zip created"
  55. ;;
  56. * )
  57. echo "Unknown package type: $1"
  58. echo "Valid types: deb src"
  59. esac
  60. echo