makedist.sh
上传用户:market2
上传日期:2018-11-18
资源大小:18786k
文件大小:5k
源码类别:

外挂编程

开发平台:

Windows_Unix

  1. #!/bin/bash
  2. # This script creates a source tarball for OpenKore, confpack and tablepack.
  3. PACKAGE=openkore
  4. VERSION=2.0.6
  5. DIRS=(.
  6. src
  7. src/build
  8. src/scons-local-0.98.5
  9. src/scons-local-0.98.5/SCons
  10. src/scons-local-0.98.5/SCons/compat
  11. src/scons-local-0.98.5/SCons/Node
  12. src/scons-local-0.98.5/SCons/Options
  13. src/scons-local-0.98.5/SCons/Platform
  14. src/scons-local-0.98.5/SCons/Scanner
  15. src/scons-local-0.98.5/SCons/Script
  16. src/scons-local-0.98.5/SCons/Tool
  17. src/scons-local-0.98.5/SCons/Variables
  18. src/deps
  19. src/deps/Carp
  20. src/deps/Class
  21. src/deps/Class/Accessor
  22. src/deps/Class/Data
  23. src/deps/Devel
  24. src/deps/Exception
  25. src/deps/SVN
  26. src/deps/Data/YAML
  27. src/po
  28. src/test
  29. src/Actor
  30. src/AI
  31. src/AI/Slave
  32. src/Base
  33. src/Base/Server
  34. src/Base/Ragnarok
  35. src/Base/WebServer
  36. src/Bus
  37. src/Bus/Server
  38. src/Interface
  39. src/Interface/Console
  40. src/Interface/Wx
  41. src/Interface/Wx/DockNotebook
  42. src/Network
  43. src/Network/Receive
  44. src/Network/Send
  45. src/Network/XKore2
  46. src/Task
  47. src/Poseidon
  48. src/Utils
  49. src/Utils/StartupNotification
  50. src/auto/XSTools
  51. src/auto/XSTools/misc
  52. src/auto/XSTools/PathFinding
  53. src/auto/XSTools/unix
  54. src/auto/XSTools/win32
  55. src/auto/XSTools/Translation
  56. src/auto/XSTools/PaddedPackets
  57. src/auto/XSTools/PaddedPackets/Algorithms
  58. src/auto/XSTools/utils
  59. src/auto/XSTools/utils/win32
  60. src/auto/XSTools/utils/unix
  61. src/auto/XSTools/utils/c-bindings
  62. src/auto/XSTools/utils/perl
  63. )
  64. PACKAGEDIR=$PACKAGE-$VERSION
  65. if [[ "$1" == "--help" ]]; then
  66. echo "makedist.sh [--bin|--semibin DIR]"
  67. echo " --bin      Create a binary distribution archive, including the binaries,"
  68. echo "            confpack and tablepack."
  69. echo " --semibin  Create a binary distribution, excluding binaries, confpack and"
  70. echo "            tablepack. Files will be copied to DIR."
  71. exit 1
  72. elif [[ "$1" == "--bin" ]]; then
  73. BINDIST=1
  74. if [[ "$2" == "-o" ]]; then
  75. PACKAGEDIR="$3"
  76. fi
  77. elif [[ "$1" == "--semibin" ]]; then
  78. SEMIBINDIST=1
  79. PACKAGEDIR="$2"
  80. if [[ "$PACKAGEDIR" = "" ]]; then
  81. echo "No output folder given. See --help"
  82. exit 1
  83. elif [[ ! -d "$PACKAGEDIR" ]]; then
  84. echo "The output folder does not exist. See --help"
  85. exit 1
  86. fi
  87. fi
  88. if [[ "$BINDIST" == "1" ]]; then
  89. for F in start.exe wxstart.exe NetRedirect.dll XSTools.dll; do
  90. if [[ ! -f "$F" ]]; then
  91. echo "Please put $F in the current folder."
  92. exit 1
  93. fi
  94. done
  95. fi
  96. ADDITIONAL=()
  97. if [[ "$BINDIST" != "1" ]]; then
  98. ADDITIONAL[${#ADDITIONAL[@]}]=SConstruct
  99. ADDITIONAL[${#ADDITIONAL[@]}]=SConscript
  100. ADDITIONAL[${#ADDITIONAL[@]}]=Distfiles
  101. ADDITIONAL[${#ADDITIONAL[@]}]=makedist.sh
  102. fi
  103. export GZIP=--best
  104. export BZIP2=-9
  105. # Bail out on error
  106. err() {
  107. if [ "x$1" != "x" ]; then
  108. echo "*** Error: $1"
  109. else
  110. echo "*** Error"
  111. fi
  112. exit 1
  113. }
  114. # Preparation: create the dist folder
  115. rm -rf "$PACKAGEDIR" || err
  116. mkdir "$PACKAGEDIR"  || err
  117. # Copy the files to the dist folder
  118. process() {
  119. local TARGET="$PACKAGEDIR/$1/"
  120. local IFS=$'n'
  121. local FILES=`cat "$1/Distfiles" 2>/dev/null | sed 's/r//g'`
  122. echo "# Processing $1 :"
  123. if ! [ -d "$TARGET" ]; then
  124. mkdir -p "$TARGET" || err
  125. fi
  126. for F in "${ADDITIONAL[@]}"; do
  127. if [ -f "$1/$F" ]; then
  128. echo "Copying $1/$F"
  129. cp "$1/$F" "$TARGET" || err
  130. fi
  131. done
  132. for F in ${FILES[@]}; do
  133. echo "Copying $1/$F"
  134. cp "$1/$F" "$TARGET" || err
  135. done
  136. }
  137. for D in ${DIRS[@]}; do
  138. process "$D"
  139. done
  140. #######################################
  141. function findConfpackDir() {
  142. if [[ -d confpack ]]; then
  143. confpackDir=confpack
  144. elif [[ -d control/confpack ]]; then
  145. confpackDir=control/confpack
  146. elif [[ -d ../confpack ]]; then
  147. confpackDir=../confpack
  148. else
  149. err "Cannot find the confpack folder. Please put it in the current directory."
  150. fi
  151. }
  152. function findTablepackDir() {
  153. if [[ -d tablepack ]]; then
  154. tablepackDir=tablepack
  155. elif [[ -d tables/tablepack ]]; then
  156. tablepackDir=tables/tablepack
  157. elif [[ -d ../tablepack ]]; then
  158. tablepackDir=../tablepack
  159. else
  160. err "Cannot find the tablepack folder. Please put it in the current directory."
  161. fi
  162. }
  163. dir=`cd "$PACKAGEDIR"; pwd`
  164. # Copy the confpack and tablepack files to the distribution's folder
  165. if [[ "$SEMIBINDIST" != "1" ]]; then
  166. findConfpackDir
  167. findTablepackDir
  168. make -C "$confpackDir" distdir DISTDIR="$dir/control" || err
  169. make -C "$tablepackDir" distdir DISTDIR="$dir/tables" || err
  170. fi
  171. # Convert openkore.pl to Unix line format, otherwise Unix users can't
  172. # execute it directly.
  173. perl src/build/dos2unix.pl "$PACKAGEDIR/openkore.pl" || err
  174. perl src/build/unix2dos.pl "$PACKAGEDIR/README.txt" || err
  175. if [[ "$BINDIST" == "1" ]]; then
  176. # Create binary zipfile
  177. cp XSTools.dll NetRedirect.dll "$PACKAGEDIR/src/auto/XSTools/" || err
  178. # Win32 binary
  179. cp start.exe "$PACKAGEDIR/" || err
  180. zip -9r "$PACKAGE-$VERSION-win32.zip" "$PACKAGEDIR" || err
  181. # Win32 Wx binary
  182. cp wxstart.exe "$PACKAGEDIR/" || err
  183. rm -f "$PACKAGEDIR/start.exe"
  184. zip -9r "$PACKAGE-wx-$VERSION.zip" "$PACKAGEDIR" || err
  185. echo "$PACKAGE-$VERSION-win32.zip created"
  186. echo "$PACKAGE-wx-$VERSION.zip created"
  187. elif [[ "$SEMIBINDIST" != "1" ]]; then
  188. # Create tarball
  189. echo "Creating distribution archive..."
  190. tar --bzip2 -cf "$PACKAGEDIR.tar.bz2" "$PACKAGEDIR" || err
  191. echo "$PACKAGEDIR.tar.bz2"
  192. fi
  193. if [[ "$SEMIBINDIST" != "1" ]]; then
  194. rm -rf "$PACKAGEDIR"
  195. fi