build 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #!/bin/sh
  2. # Awk out the version from source
  3. ver="?.?.?"
  4. ver=`grep "char" src/main.c | awk '/egg_version/ {print $4}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
  5. numver=`grep "int" src/main.c | awk '/egg_numver =/ {print $4}' | sed -e 's/\;//g'`
  6. PACKNAME=`grep "PACKNAME " pack/pack.cfg | awk '/PACKNAME/ {print $2}'`
  7. clear
  8. case $[(`date '+%s'` % 3)] in
  9. 0) echo "@@@ @@@ @@@ @@@@@@@ @@@@@@ @@@ @@@@@@@ @@@ @@@"
  10. echo "@@@ @@@ @@@ @@@@@@@@ @@@@@@@@ @@@ @@@@@@@ @@@ @@@"
  11. echo "@@! @@! @@! @@! @@@ @@! @@@ @@! @@! @@! @@@"
  12. echo "!@! !@! !@! !@! @!@ !@! @!@ !@! !@! !@! @!@"
  13. echo "@!! !!@ @!@ @!@!!@! @!@!@!@! !!@ @!! @!@!@!@!"
  14. echo "!@! !!! !@! !!@!@! !!!@!!!! !!! !!! !!!@!!!!"
  15. echo "!!: !!: !!: !!: :!! !!: !!! !!: !!: !!: !!!"
  16. echo ":!: :!: :!: :!: !:! :!: !:! :!: :!: :!: !:!"
  17. echo " :::: :: ::: :: ::: :: ::: :: :: :: :::"
  18. echo " :: : : : : : : : : : : : : : :" ;;
  19. 1) echo " *"
  20. echo " * * **"
  21. echo "** *** ** **"
  22. echo "** * ** **"
  23. echo " ** *** **** *** **** ******** **"
  24. echo " ** *** *** * **** **** * **** *** ******** ** ***"
  25. echo " ** *** **** ** **** * *** * *** ** ** * ***"
  26. echo " ** ** ** ** * **** ** ** *** ***"
  27. echo " ** ** ** ** ** ** ** ** ** **"
  28. echo " ** ** ** ** ** ** ** ** ** **"
  29. echo " ** ** ** ** ** ** ** ** ** **"
  30. echo " ** ** * ** ** ** ** ** ** **"
  31. echo " ******* ******* *** ** ** ** ** ** **"
  32. echo " ***** ***** *** ***** ** *** * ** ** **"
  33. echo " *** ** *** ** **"
  34. echo " *"
  35. echo " *"
  36. echo " *"
  37. echo " *" ;;
  38. 2) echo " ::: === === :::==== :::==== ::: :::==== ::: ==="
  39. echo " ::: === === ::: === ::: === ::: :::==== ::: ==="
  40. echo " === === === ======= ======== === === ========"
  41. echo " =========== === === === === === === === ==="
  42. echo " ==== ==== === === === === === === === ===" ;;
  43. esac
  44. usage()
  45. {
  46. echo "Usage: $0 [-d] [-c] [-T] [-t dir] type"
  47. echo " -c - Cleans up old binaries/files before compile (default: off)"
  48. echo " -d - Builds a debug package. (default: off)"
  49. echo " -t dir - Where to search for TCL libraries. (usually not needed)"
  50. echo " -T - Builds TCL if it is not on the system (default: off)"
  51. echo " type - One of the following: all, leaf, hub."
  52. }
  53. debug=0
  54. all=0
  55. hub=0
  56. leaf=0
  57. clean=0
  58. type=
  59. tcldir=
  60. buildtcl=0
  61. while getopts t:Tcdh opt ; do
  62. case "$opt" in
  63. c) clean=1 ;;
  64. d) debug=1 ;;
  65. t) tcldir="$OPTARG" ;;
  66. h) usage; exit 0 ;;
  67. T) buildtcl=1 ;;
  68. *) usage; exit 1 ;;
  69. esac
  70. done
  71. shift $(($OPTIND - 1))
  72. if [ $buildtcl = "1" ]; then
  73. echo "Hold tight"
  74. misc/maketcl
  75. rm -rf tcl8.4.4*
  76. echo "Done. (You must run ./build again with normal parameters)"
  77. exit 0
  78. fi
  79. if test -z "$1"; then
  80. usage
  81. exit 1
  82. else
  83. if [ $1 = "all" ]; then
  84. all=1
  85. elif [ $1 = "leaf" ]; then
  86. leaf=1
  87. type="leaf"
  88. elif [ $1 = "hub" ]; then
  89. hub=1
  90. type="hub"
  91. else
  92. all=1
  93. # usage
  94. # exit 1
  95. fi
  96. fi
  97. if [ $debug = "1" ]; then
  98. d="d"
  99. else
  100. d=""
  101. fi
  102. if [ $all = "1" ]; then
  103. type="all"
  104. leaf=1
  105. hub=1
  106. fi
  107. ############# CHECK FOR pack/ FILES #################
  108. # Figure what bins we're making
  109. case `uname` in
  110. Linux) os=Linux;;
  111. FreeBSD) case `uname -r` in
  112. 5*) os=FreeBSD5;;
  113. 4*) os=FreeBSD4;;
  114. 3*) os=FreeBSD3;;
  115. esac;;
  116. OpenBSD) os=OpenBSD;;
  117. esac
  118. if test -z $os
  119. then
  120. echo "[!] Automated packaging disabled, `uname` isn't recognized"
  121. fi
  122. echo "[*] Building ${PACKNAME}::${type} for $os"
  123. # Run ./configure, then verify it's ok
  124. echo "[*] Configuring..."
  125. umask 077 >/dev/null
  126. if test -z "$tcldir"; then
  127. echo "[*] Searching for TCL in default paths (use '-t dir' to change)"
  128. ./configure --silent --disable-tcl-threads
  129. else
  130. echo "[*] Searching for TCL in: $tcldir"
  131. ./configure --silent --disable-tcl-threads --with-tcllib=${tcldir}/lib/libtcl8.4.a --with-tclinc=${tcldir}/include/tcl.h
  132. fi
  133. MAKE="`which gmake`"
  134. if test -z "${MAKE}"; then
  135. MAKE="`which make`"
  136. fi
  137. echo "[*] Using '${MAKE}'"
  138. # make clean, just in case
  139. if [ $clean = "1" ]; then
  140. echo "[*] Cleaning up old binaries/files..."
  141. ${MAKE} clean > /dev/null
  142. fi
  143. _leaf()
  144. {
  145. if [ $leaf = "1" ]; then
  146. # Build leaf and check
  147. echo "[*] Building ${d}leaf..."
  148. ${MAKE} ${d}leaf -s
  149. if ! test -f leaf
  150. then
  151. echo "[!] ${d}leaf build failed"
  152. exit 1
  153. fi
  154. fi
  155. }
  156. _hub()
  157. {
  158. if [ $hub = "1" ]; then
  159. # Build hub and check
  160. echo "[*] Building ${d}hub..."
  161. ${MAKE} ${d}hub -s
  162. if ! test -f hub
  163. then
  164. echo "[!] ${d}hub build failed"
  165. exit 1
  166. fi
  167. fi
  168. }
  169. if [ -f stamp.hub ]; then
  170. _hub
  171. _leaf
  172. else
  173. _leaf
  174. _hub
  175. fi
  176. # Wrap it nicely up into an archive
  177. echo "[*] Packaging..."
  178. if [ $all = "1" ]; then
  179. fls="leaf hub"
  180. elif [ $leaf = "1" ]; then
  181. fls="leaf"
  182. elif [ $hub = "1" ]; then
  183. fls="hub"
  184. fi
  185. if test -n "$d"; then
  186. d="-debug"
  187. fi
  188. for bin in $fls
  189. do
  190. mv -f $bin $bin.$os.$numver${d}
  191. done
  192. tar -zcf ${PACKNAME}.$os.$numver${d}.tgz *.$os.$numver${d}
  193. rm -f *$os.$numver${d}
  194. echo "Binaries are now in '${PACKNAME}.$os.$numver${d}.tgz'."
  195. exit 0