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 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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 " --jar <file> Use <file> instead of compiling a jar."
  16. echo " --fulljar <file> Use <file> instead of compiling a jar, and don't run makeJar on it."
  17. echo " --jre Include a jre in the installers."
  18. echo " --jre64 Include a 64bit jre in the installers."
  19. echo "-p, --plugins <plugins> Plugins to add to all the jars."
  20. echo "-pl, --plugins-linux <plugins> Plugins to linux installer."
  21. echo "-pw, --plugins-windows <plugins> Plugins to linux installer."
  22. echo "-h, --help Help information"
  23. echo "-o, --opt <options> Additional options to pass to the make*Installer.sh files"
  24. echo "---------------------"
  25. exit 0;
  26. }
  27. # Check for some CLI params
  28. LAST=""
  29. OPT=""
  30. BRANCH=""
  31. JARFILE=""
  32. JRE=""
  33. FULLJAR=""
  34. while test -n "$1"; do
  35. LAST=${1}
  36. case "$1" in
  37. --plugins|-p)
  38. shift
  39. plugins="${1}"
  40. ;;
  41. --jar)
  42. shift
  43. JARFILE="--jar ${1} "
  44. ;;
  45. --fulljar)
  46. shift
  47. JARFILE="--jar ${1} "
  48. FULLJAR="1"
  49. ;;
  50. --jre|--jre64)
  51. JRE="${1} "
  52. ;;
  53. --plugins-linux|-pl)
  54. shift
  55. plugins_linux="${1}"
  56. ;;
  57. --plugins-windows|-pw)
  58. shift
  59. plugins_windows="${1}"
  60. ;;
  61. --opt|-o)
  62. shift
  63. OPT="${1} "
  64. ;;
  65. --help|-h)
  66. showHelp;
  67. ;;
  68. --branch|-b)
  69. BRANCH="-b "
  70. ;;
  71. esac
  72. shift
  73. done
  74. if [ "${plugins}" = "*" -o "${plugins_linux}" = "*" -o "${plugins_windows}" = "*" ]; then
  75. echo "Something is all.";
  76. allPlugins=""
  77. for thisfile in `ls -1 ../plugins/*.jar`; do
  78. allPlugins=${allPlugins}" ${thisfile##*/}"
  79. done
  80. if [ "${plugins}" = "*" ]; then plugins=${allPlugins}; fi
  81. if [ "${plugins_linux}" = "*" ]; then plugins_linux=${allPlugins}; fi
  82. if [ "${plugins_windows}" = "*" ]; then plugins_windows=${allPlugins}; fi
  83. fi;
  84. if [ "${LAST}" != "" ]; then
  85. if [ "${LAST}" = "trunk" ]; then
  86. RELEASE=""
  87. elif [ "${LAST}" = "this" ]; then
  88. # Work out what type of build this is!
  89. thisDIR=${PWD}
  90. cd ..
  91. tempDIR=${PWD##*/}
  92. if [ "${tempDIR}" = "trunk" ]; then
  93. echo "This is a trunk release.";
  94. else
  95. echo "This is not a trunk release.";
  96. version=${tempDIR}
  97. cd ..
  98. tempDIR=${PWD##*/}
  99. if [ "${tempDIR}" = "tags" ]; then
  100. echo "Release of tag "${version}
  101. RELEASE="-r "${version}
  102. elif [ "${tempDIR}" = "branches" ]; then
  103. echo "Release of branch "${version}
  104. BRANCH="-b "
  105. RELEASE="-r "${version}
  106. else
  107. echo "Unknown release target - Building as trunk build"
  108. OPT="--current ${OPT}"
  109. fi
  110. fi;
  111. cd ${thisDIR}
  112. elif [ "${BRANCH}" != "" -a ! -e "../../branches/"${LAST} ]; then
  113. echo "Branch '"${LAST}"' not found."
  114. exit 1;
  115. elif [ "${BRANCH}" = "" -a ! -e "../../tags/"${LAST} ]; then
  116. echo "Tag '"${LAST}"' not found."
  117. exit 1;
  118. else
  119. RELEASE="-r "${LAST}
  120. fi
  121. else
  122. echo "Usage: ${0} [params] <release>"
  123. echo "Release can be either 'this', 'trunk' or a valid tag. (see ${0} --help for further information)"
  124. exit 1;
  125. fi
  126. JAR=/usr/bin/jar
  127. JAVAC=/usr/bin/javac
  128. THISDIR=${PWD}
  129. echo "================================================================"
  130. echo "Removing existing releases from output directory"
  131. echo "================================================================"
  132. rm -Rf output/*.run output/*.exe
  133. echo "================================================================"
  134. echo "Building Installer JAR "
  135. echo "================================================================"
  136. mkdir -p installer_temp/build
  137. cd installer_temp
  138. ln -sf ../../src/com
  139. ln -sf ../../src/net
  140. # I don't know why, but -d doesn't nicely put ALL generated class files here,
  141. # just those that were in the dir of the java file that was requested for compile
  142. # So we specify each of the different ones we want built into the jar file here.
  143. FILELIST="com/dmdirc/installer/*.java"
  144. FILELIST=${FILELIST}" com/dmdirc/installer/cliparser/*.java"
  145. FILELIST=${FILELIST}" com/dmdirc/ui/swing/dialogs/wizard/*.java"
  146. FILELIST=${FILELIST}" com/dmdirc/ui/interfaces/MainWindow.java"
  147. FILELIST=${FILELIST}" com/dmdirc/ui/swing/MainFrame.java"
  148. FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  149. FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  150. FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/StandardDialog.java"
  151. FILELIST=${FILELIST}" com/dmdirc/util/ListenerList.java"
  152. FILELIST=${FILELIST}" com/dmdirc/util/WeakMapList.java"
  153. FILELIST=${FILELIST}" com/dmdirc/util/WeakList.java"
  154. FILELIST=${FILELIST}" net/miginfocom/layout/*.java"
  155. FILELIST=${FILELIST}" net/miginfocom/swing/*.java"
  156. ${JAVAC} -d ./build ${FILELIST}
  157. if [ $? -ne 0 ]; then
  158. echo "================================================================"
  159. echo "Building installer failed."
  160. echo "================================================================"
  161. cd ${THISDIR}
  162. rm -Rf installer_temp
  163. exit 1;
  164. fi
  165. cd build
  166. echo "Manifest-Version: 1.0" > manifest.txt
  167. echo "Created-By: DMDirc Installer" >> manifest.txt
  168. echo "Main-Class: com.dmdirc.installer.Main" >> manifest.txt
  169. echo "Class-Path: " >> manifest.txt
  170. echo "" >> manifest.txt
  171. ${JAR} cmf manifest.txt installer.jar com net
  172. if [ $? -ne 0 ]; then
  173. echo "================================================================"
  174. echo "Building installer failed."
  175. echo "================================================================"
  176. cd ${THISDIR}
  177. rm -Rf installer_temp
  178. exit 1;
  179. else
  180. rm -Rf ${THISDIR}/common/installer.jar
  181. mv installer.jar ${THISDIR}/common/installer.jar
  182. fi
  183. cd ${THISDIR}
  184. rm -Rf installer_temp
  185. # Copy default settings from www to trunk for compile (if they exist, and we are
  186. # building a new jar)
  187. REVERTLIST=""
  188. if [ "" != "${JARFILE}" ]; then
  189. if [ -e "${HOME}/www/updates/" ]; then
  190. echo "================================================================"
  191. echo "Applying settings update to this source"
  192. echo "================================================================"
  193. for updatedir in `ls -1 ../src/com/dmdirc/config/defaults/`; do
  194. src="${HOME}/www/updates/${updatedir}"
  195. if [ -e ${src} ]; then
  196. REVERTLIST=${REVERTLIST}" ../src/com/dmdirc/config/defaults/${updatedir}/"
  197. cp -Rfv ${src}/* ../src/com/dmdirc/config/defaults/${updatedir}/
  198. fi;
  199. done
  200. fi;
  201. fi;
  202. if [ "" = "${FULLJAR}" ]; then
  203. echo "================================================================"
  204. echo "Building Release Jar"
  205. echo "================================================================"
  206. cd jar
  207. ./makeJar.sh ${OPT}${JARFILE}${JRE}-c -k -s ${BRANCH}${RELEASE} -p "${plugins}"
  208. RESULT=${?}
  209. cd ${THISDIR}
  210. if [ ${RESULT} -eq 0 ]; then
  211. JARNAME=`ls -1tr output | grep jar$ | tail -n 1`
  212. JARFILE="--jar ../output/${JARNAME} "
  213. else
  214. echo "Failed to build release jar, aborting."
  215. exit 1;
  216. fi;
  217. fi;
  218. echo "================================================================"
  219. echo "Building linux installer"
  220. echo "================================================================"
  221. cd linux
  222. ./makeInstallerLinux.sh ${OPT}${JARFILE}${JRE}-k ${BRANCH}${RELEASE} -p "${plugins_linux}"
  223. cd ${THISDIR}
  224. echo "================================================================"
  225. echo "Building Windows installer"
  226. echo "================================================================"
  227. cd windows
  228. ./makeInstallerWindows.sh ${OPT}${JARFILE}${JRE}-k -s ${BRANCH}${RELEASE} -p "${plugins_windows}"
  229. cd ${THISDIR}
  230. #MD5BIN=`which md5sum`
  231. #if [ "${MD5BIN}" != "" ]; then
  232. # echo "================================================================"
  233. # echo "Creating MD5SUM files"
  234. # echo "================================================================"
  235. # cd output
  236. # for outputFile in *; do
  237. # if [ "${outputFile##*.}" != "md5" ]; then
  238. # if [ -e "${outputFile}.md5" ]; then
  239. # rm -f "${outputFile}.md5"
  240. # fi
  241. # ${MD5BIN} "${outputFile}" > "${outputFile}.md5"
  242. # fi
  243. # done
  244. # cd ${THISDIR}
  245. #fi
  246. echo "================================================================"
  247. echo "Clean Up"
  248. echo "================================================================"
  249. # Now revert the trunk so as not to break updates.
  250. for updatedir in ${REVERTLIST}; do
  251. SVN=`which svn`
  252. ${svn} revert ${updatedir}/*
  253. done;
  254. echo "================================================================"
  255. echo "Release ready - see output folder"
  256. echo "================================================================"
  257. exit 0;