makesrcdist 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #!/bin/sh
  2. #
  3. # makesrcdist - make a distribution of FLTK.
  4. #
  5. # There are 3 different modes of operation, dependent on commandline arguments:
  6. #
  7. # (1) Create snapshot:
  8. #
  9. # makesrcdist [snapshot]
  10. #
  11. # Use no arguments or "snapshot" (verbatim).
  12. #
  13. # (2) Create distribution tarballs for test and verification:
  14. #
  15. # makesrcdist <version>
  16. #
  17. # Use a version number as argument, e.g. "1.3.3" or "1.3.4rc2".
  18. # This can be used for local testing.
  19. #
  20. # (3) Create distribution tarballs (final):
  21. #
  22. # makesrcdist <version> tag
  23. #
  24. # Same as (2), but create subversion tag with version number.
  25. # Enter "tag" (verbatim) as 2nd argument.
  26. # This will create the subversion tag "release-<version>" for the
  27. # current revision in the FLTK subversion repository and export the
  28. # FLTK sources from this tag for creation of distribution files.
  29. #
  30. # Note: define FLTK_TAR if you want to use a different compatible tar
  31. # command than "tar", e.g. to use "gtar" (bash syntax):
  32. # $ export FLTK_TAR="gtar"
  33. #
  34. TAR="tar"
  35. if test "x$FLTK_TAR" != "x"; then
  36. TAR="$FLTK_TAR"
  37. fi
  38. # these are the subversion and snapshot/download URL's currently in use:
  39. SVN='http://seriss.com/public/fltk/fltk'
  40. DOWNLOAD='http://fltk.org/pub/fltk'
  41. SNAPSHOT='http://fltk.org/pub/fltk/snapshots'
  42. VS=`cat VERSION | sed -e's/\([0-9]*\.[0-9]*\).*/\1/'`
  43. echo "Getting distribution..."
  44. if test $# = 0 -o "x$1" = "xsnapshot"; then
  45. echo Updating for snapshot...
  46. svn up
  47. rev=`svnversion . | sed -e '1,$s/[a-zA-Z]//g'`
  48. version="${VS}svn"
  49. fileversion="${VS}.x-r$rev"
  50. fileurl="$SNAPSHOT/fltk-$fileversion.tar.gz"
  51. echo "fileversion = $fileversion"
  52. echo "fileurl = $fileurl"
  53. url="."
  54. else
  55. if test ! -e "documentation/html/"; then
  56. echo "ERROR: Please generate the HTML documentation before distributing:"
  57. echo " autoconf"
  58. echo " ./configure"
  59. echo " cd documentation; make dist"
  60. exit
  61. fi
  62. if test ! -e "documentation/fltk.pdf"; then
  63. echo "ERROR: Please generate the PDF documentation before distributing:"
  64. echo " autoconf"
  65. echo " ./configure"
  66. echo " cd documentation; make dist"
  67. exit
  68. fi
  69. rev="1"
  70. version=$1
  71. fileversion=$1
  72. fileurl="$DOWNLOAD/$version/fltk-$fileversion-source.tar.gz"
  73. if test "x$2" != "xtag"; then
  74. url="."
  75. else
  76. echo "Creating subversion tag 'release-$version' ..."
  77. url="$SVN/tags/release-$version"
  78. svn copy $SVN/branches/branch-${VS} "$url" \
  79. -m "Tag $version" || exit 1
  80. fi
  81. fi
  82. echo Exporting $version...
  83. rm -rf /tmp/fltk-$version
  84. svn export $url /tmp/fltk-$version
  85. if test $# != 0 -a "x$1" != "xsnapshot"; then
  86. echo "Copying HTML and PDF documentation..."
  87. cp -r documentation/html /tmp/fltk-$version/documentation/
  88. cp documentation/fltk.pdf /tmp/fltk-$version/documentation/
  89. fi
  90. echo Applying version number...
  91. cd /tmp/fltk-$version
  92. fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
  93. sed -e '1,$s/@VERSION@/'$version'/' \
  94. -e '1,$s/@RELEASE@/'$rev'/' \
  95. -e '1,$s/^Source:.*/Source: '$fileurl'/' \
  96. <fltk.spec.in >fltk.spec
  97. echo Creating configure script...
  98. autoconf -f
  99. echo Creating config.guess and config.sub \(ignore any other errors\)...
  100. automake --add-missing --copy
  101. echo Cleaning developer files...
  102. rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
  103. rm -f makesrcdist
  104. cd ..
  105. if test $# != 0 -a "x$1" != "xsnapshot"; then
  106. echo "Making HTML docs distribution..."
  107. $TAR czf fltk-$fileversion-docs-html.tar.gz fltk-$version/documentation/html/
  108. echo "Making PDF docs distribution..."
  109. $TAR czf fltk-$fileversion-docs-pdf.tar.gz fltk-$version/documentation/fltk.pdf
  110. fi
  111. echo "Removing documentation..."
  112. rm -rf fltk-$version/documentation/html/
  113. rm -f fltk-$version/documentation/fltk.pdf
  114. echo "Making UNIX distribution..."
  115. $TAR czf fltk-$fileversion-source.tar.gz fltk-$version
  116. #echo "Making BZ2 distribution..."
  117. #$TAR cjf fltk-$fileversion-source.tar.bz2 fltk-$version
  118. #echo "Making Windows distribution..."
  119. #rm -f fltk-$fileversion-source.zip
  120. #zip -r9 fltk-$fileversion-source.zip fltk-$version
  121. echo "Removing distribution directory..."
  122. rm -rf fltk-$version
  123. echo "Done!"