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

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