You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

release.sh 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. #!/bin/sh
  2. # Jar names of plugins to add to ALL installers. (* means all)
  3. plugins="dns.jar identd.jar lagdisplay.jar logging.jar systray.jar timeplugin.jar osdplugin.jar"
  4. # Additional Jar names of plugins to add to only Windows installers. (* means all)
  5. plugins_windows=""
  6. # Additional Jar names of plugins to add to only linux installers. (* means all)
  7. plugins_linux=""
  8. showHelp() {
  9. echo "This will generate the different DMDirc installers."
  10. echo "Usage: ${0} [params] <release>"
  11. echo "Release can be either 'trunk', 'this', a valid tag, or a branch (if -b is passed)"
  12. echo "The following params are known:"
  13. echo "---------------------"
  14. echo "-b, --branch <release> is a branch"
  15. echo "-p, --plugins <plugins> Plugins to add to all the jars."
  16. echo "-pl, --plugins-linux <plugins> Plugins to linux installer."
  17. echo "-pw, --plugins-windows <plugins> Plugins to linux installer."
  18. echo "-h, --help Help information"
  19. echo "-o, --opt <options> Additional options to pass to the make*Installer.sh files"
  20. echo "---------------------"
  21. exit 0;
  22. }
  23. # Check for some CLI params
  24. LAST=""
  25. OPT=""
  26. BRANCH=""
  27. while test -n "$1"; do
  28. LAST=${1}
  29. case "$1" in
  30. --plugins|-p)
  31. shift
  32. plugins="${1}"
  33. ;;
  34. --plugins-linux|-pl)
  35. shift
  36. plugins_linux="${1}"
  37. ;;
  38. --plugins-windows|-pw)
  39. shift
  40. plugins_windows="${1}"
  41. ;;
  42. --opt|-o)
  43. shift
  44. OPT="${1} "
  45. ;;
  46. --help|-h)
  47. showHelp;
  48. ;;
  49. --branch|-b)
  50. BRANCH="-b "
  51. ;;
  52. esac
  53. shift
  54. done
  55. if [ "${plugins}" = "*" -o "${plugins_linux}" = "*" -o "${plugins_windows}" = "*" ]; then
  56. echo "Something is all.";
  57. allPlugins=""
  58. for thisfile in `ls -1 ../plugins/*.jar`; do
  59. allPlugins=${allPlugins}" ${thisfile##*/}"
  60. done
  61. if [ "${plugins}" = "*" ]; then plugins=${allPlugins}; fi
  62. if [ "${plugins_linux}" = "*" ]; then plugins_linux=${allPlugins}; fi
  63. if [ "${plugins_windows}" = "*" ]; then plugins_windows=${allPlugins}; fi
  64. fi;
  65. if [ "${LAST}" != "" ]; then
  66. if [ "${LAST}" = "trunk" ]; then
  67. RELEASE=""
  68. elif [ "${LAST}" = "this" ]; then
  69. # Work out what type of build this is!
  70. thisDIR=${PWD}
  71. cd ..
  72. tempDIR=${PWD##*/}
  73. if [ "${tempDIR}" = "trunk" ]; then
  74. echo "This is a trunk release.";
  75. else
  76. echo "This is not a trunk release.";
  77. version=${tempDIR}
  78. cd ..
  79. tempDIR=${PWD##*/}
  80. if [ "${tempDIR}" = "tags" ]; then
  81. echo "Release of tag "${version}
  82. elif [ "${tempDIR}" = "branches" ]; then
  83. echo "Release of branch "${version}
  84. BRANCH="-b "
  85. else
  86. echo "Unknown release target."
  87. exit 0;
  88. fi
  89. RELEASE="-r "${version}
  90. fi;
  91. cd ${thisDIR}
  92. elif [ "${BRANCH}" != "" -a ! -e "../../branches/"${LAST} ]; then
  93. echo "Branch '"${LAST}"' not found."
  94. exit 1;
  95. elif [ "${BRANCH}" = "" -a ! -e "../../tags/"${LAST} ]; then
  96. echo "Tag '"${LAST}"' not found."
  97. exit 1;
  98. else
  99. RELEASE="-r "${LAST}
  100. fi
  101. else
  102. echo "Usage: ${0} [params] <release>"
  103. echo "Release can be either 'this', 'trunk' or a valid tag. (see ${0} --help for further information)"
  104. exit 1;
  105. fi
  106. JAR=/usr/bin/jar
  107. JAVAC=/usr/bin/javac
  108. THISDIR=${PWD}
  109. echo "================================================================"
  110. echo "Removing existing releases from output directory"
  111. echo "================================================================"
  112. rm -Rf output/*.run output/*.exe
  113. echo "================================================================"
  114. echo "Building Installer JAR "
  115. echo "================================================================"
  116. mkdir -p installer_temp/build
  117. cd installer_temp
  118. ln -s ../../src/com
  119. ln -s ../../src/net
  120. # I don't know why, but -d doesn't nicely put ALL generated class files here,
  121. # just those that were in the dir of the java file that was requested for compile
  122. # So we specify each of the different ones we want built into the jar file here.
  123. ${JAVAC} -d ./build com/dmdirc/installer/*.java
  124. ${JAVAC} -d ./build com/dmdirc/installer/cliparser/*.java
  125. ${JAVAC} -d ./build com/dmdirc/ui/swing/dialogs/wizard/*.java
  126. ${JAVAC} -d ./build com/dmdirc/ui/interfaces/MainWindow.java
  127. ${JAVAC} -d ./build com/dmdirc/ui/swing/MainFrame.java
  128. ${JAVAC} -d ./build com/dmdirc/ui/swing/UIUtilities.java
  129. ${JAVAC} -d ./build com/dmdirc/ui/swing/UIUtilities.java
  130. ${JAVAC} -d ./build com/dmdirc/ui/swing/components/StandardDialog.java
  131. ${JAVAC} -d ./build com/dmdirc/util/ListenerList.java
  132. ${JAVAC} -d ./build com/dmdirc/util/WeakMapList.java
  133. ${JAVAC} -d ./build com/dmdirc/util/WeakList.java
  134. ${JAVAC} -d ./build net/miginfocom/layout/*.java
  135. ${JAVAC} -d ./build net/miginfocom/swing/*.java
  136. if [ $? -ne 0 ]; then
  137. echo "================================================================"
  138. echo "Building installer failed."
  139. echo "================================================================"
  140. cd ${THISDIR}
  141. rm -Rf installer_temp
  142. exit 1;
  143. fi
  144. cd build
  145. echo "Manifest-Version: 1.0" > manifest.txt
  146. echo "Created-By: DMDirc Installer" >> manifest.txt
  147. echo "Main-Class: com.dmdirc.installer.Main" >> manifest.txt
  148. echo "Class-Path: " >> manifest.txt
  149. echo "" >> manifest.txt
  150. ${JAR} cmf manifest.txt installer.jar com net
  151. if [ $? -ne 0 ]; then
  152. echo "================================================================"
  153. echo "Building installer failed."
  154. echo "================================================================"
  155. cd ${THISDIR}
  156. rm -Rf installer_temp
  157. exit 1;
  158. else
  159. rm -Rf ${THISDIR}/common/installer.jar
  160. mv installer.jar ${THISDIR}/common/installer.jar
  161. fi
  162. cd ${THISDIR}
  163. rm -Rf installer_temp
  164. echo "================================================================"
  165. echo "Building linux installer"
  166. echo "================================================================"
  167. cd linux
  168. ./makeInstallerLinux.sh ${OPT}-c -k ${BRANCH}${RELEASE} -p "${plugins} ${plugins_linux}"
  169. cd ${THISDIR}
  170. echo "================================================================"
  171. echo "Building Windows installer"
  172. echo "================================================================"
  173. cd windows
  174. ./makeInstallerWindows.sh ${OPT}-k -s ${BRANCH}${RELEASE} -p "${plugins} ${plugins_windows}"
  175. cd ${THISDIR}
  176. MD5BIN=`which md5sum`
  177. if [ "${MD5BIN}" != "" ]; then
  178. echo "================================================================"
  179. echo "Creating MD5SUM files"
  180. echo "================================================================"
  181. cd output
  182. for outputFile in *; do
  183. if [ "${outputFile##*.}" != "md5" ]; then
  184. if [ -e "${outputFile}.md5" ]; then
  185. rm -f "${outputFile}.md5"
  186. fi
  187. ${MD5BIN} "${outputFile}" > "${outputFile}.md5"
  188. fi
  189. done
  190. cd ${THISDIR}
  191. fi
  192. echo "================================================================"
  193. echo "Release ready - see output folder"
  194. echo "================================================================"
  195. exit 0;