2
0

autobuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. #
  3. # This script gets all needed packages, builds LOVE, makes deb and tar.gz
  4. # and optionally uploads them to servers.
  5. #
  6. # Note: this script must be called in the same directory as the love
  7. # folder resides. It also assumes that love has been checked out previously.
  8. #
  9. # Usage:
  10. #
  11. # autobuild [action [revision [version]]]
  12. #
  13. # action:
  14. #
  15. # There are only two recognized actions:
  16. #
  17. # build -- Causes files to be uploaded to tehlol servers.
  18. # release -- Coming soon.
  19. #
  20. # All other actions will be ignored, so if you don not wish to upload
  21. # files (but still build LOVE), you can write "test", for instance.
  22. #
  23. # revision:
  24. #
  25. # The revision that should be built. Should be a valid revision
  26. # number or tip. If not specified, it defaults to tip.
  27. #
  28. # version:
  29. #
  30. # The display version that will appear in files, eg. love-version.tar.gz.
  31. # If not specified, the script defaults to use the SVN revision number.
  32. #
  33. # Examples:
  34. #
  35. # autobuild
  36. # (Builds HEAD, but does not upload)
  37. #
  38. # autobuild build
  39. # (Builds tip and uploads to tehlol server with the current rev. as
  40. # version number)
  41. #
  42. # autobuild build tip 1.0
  43. # (Builds tip and uploads it using the version 1.0)
  44. #
  45. #
  46. # Passwords for servers must be in these external files:
  47. #
  48. # tehlol.com: pwtehlol
  49. # sourceforge.net: pwsourceforge
  50. #
  51. cd ../..
  52. # Get required packages.
  53. #sudo apt-get -y install subversion build-essential liblua5.1-dev \
  54. #libopenal-dev libsdl1.2-dev libfreetype6-dev \
  55. #libphysfs-dev libdevil-dev libtiff4-dev libmng-dev \
  56. #liblcms1-dev ftp-upload libmpg123-dev libmodplug-dev libpng12-dev
  57. # Check which revision to build.
  58. if [ -z $2 ]; then
  59. buildrev="tip"
  60. else
  61. buildrev=$2
  62. fi
  63. # Upload to the appropriate revision.
  64. hg pull
  65. hg update $buildrev
  66. # Set the displayversion.
  67. if [ -z $3 ]; then
  68. if [ "$buildrev" == "tip" ]; then
  69. # Get the current SVN version, use sed to remove any non-numbers.
  70. currentversion=`hg log -l1 | grep changeset | sed 's/.*://g'`
  71. currentdate=`date +%Y%m%d`
  72. displayversion="$currentdate-$currentversion"
  73. else
  74. # The revision is already specified, so we'll use that as the
  75. # display version.
  76. displayversion="$buildrev"
  77. fi
  78. else
  79. # If the param is present, it overrides everything else.
  80. displayversion=$3
  81. fi
  82. # Update version in configure.
  83. # cat configure.in | sed "s/LOVE_VERSION/$displayversion/g" > configure.in
  84. head -c 15 configure.in > configure.in.tmp
  85. echo " [$displayversion])" >> configure.in.tmp
  86. tail -n +2 configure.in >> configure.in.tmp
  87. cp configure.in.tmp configure.in
  88. rm configure.in.tmp
  89. # Build ... BUILD!
  90. sh platform/unix/gen-makefile
  91. sh platform/unix/automagic
  92. ./configure
  93. make
  94. make dist
  95. # Move and rename the tar.
  96. tar="love-$displayversion-linux-src.tar.gz"
  97. mv "love-$displayversion.tar.gz" platform/unix/$tar
  98. # Create the deb.
  99. cd platform/unix
  100. sh make-package deb $displayversion
  101. # Move and rename the deb.
  102. deb="love-$displayversion-ubuntu-x86.deb"
  103. mv "love-$displayversion.deb" $deb
  104. # Copy and rename the binary.
  105. binary="love-$displayversion-linux-x86"
  106. cp ../../src/love $binary
  107. # Deal with uploading.
  108. if [ "$1" == "build" ]; then
  109. pass=`cat pwtehlol`
  110. ftp-upload -u tehloejc --password $pass -h tehlol.com -d public_html/love2d/builds/ $deb
  111. ftp-upload -u tehloejc --password $pass -h tehlol.com -d public_html/love2d/builds/ $tar
  112. ftp-upload -u tehloejc --password $pass -h tehlol.com -d public_html/love2d/builds/ $binary
  113. fi
  114. if [ "$1" == "release" ]; then
  115. echo "release"
  116. fi