autobuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. echo $buildrev
  64. # Upload to the appropriate revision.
  65. hg pull
  66. hg update -r $buildrev
  67. # Set the displayversion.
  68. if [ -z $3 ]; then
  69. if [ "$buildrev" == "tip" ]; then
  70. # Get the current SVN version, use sed to remove any non-numbers.
  71. currentversion=`hg log -l1 --template "{node|short}"`
  72. currentdate=`date +%Y%m%d`
  73. displayversion="$currentdate-$currentversion"
  74. else
  75. # The revision is already specified, so we'll use that as the
  76. # display version.
  77. displayversion="$buildrev"
  78. fi
  79. else
  80. # If the param is present, it overrides everything else.
  81. displayversion=$3
  82. fi
  83. echo $displayversion
  84. # Update version in configure.
  85. # cat configure.in | sed "s/LOVE_VERSION/$displayversion/g" > configure.in
  86. head -c 15 configure.in > configure.in.tmp
  87. echo " [$displayversion])" >> configure.in.tmp
  88. tail -n +2 configure.in >> configure.in.tmp
  89. cp configure.in.tmp configure.in
  90. rm configure.in.tmp
  91. # Build ... BUILD!
  92. #sh platform/unix/gen-makefile
  93. sh platform/unix/automagic
  94. ./configure
  95. make
  96. make dist
  97. # Move and rename the tar.
  98. tar="love-$displayversion-linux-src.tar.gz"
  99. mv "love-$displayversion.tar.gz" platform/unix/$tar
  100. # Create the deb.
  101. cd platform/unix
  102. sh make-package deb $displayversion
  103. machine=`uname -m`
  104. # Move and rename the deb.
  105. deb="love-$displayversion-ubuntu-$machine.deb"
  106. mv "love-$displayversion.deb" $deb
  107. # Copy and rename the binary.
  108. binary="love-$displayversion-linux-$machine"
  109. cp ../../src/love $binary
  110. # Deal with uploading.
  111. #if [ "$1" == "build" ]; then
  112. # curl -F build=@$deb -F press=ok http://love2d.org/builds/upload.php?upload
  113. # curl -F build=@$tar -F press=ok http://love2d.org/builds/upload.php?upload
  114. # curl -F build=@$binary -F press=ok http://love2d.org/builds/upload.php?upload
  115. #fi
  116. if [ "$1" == "release" ]; then
  117. echo "release"
  118. fi