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

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