Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

release.sh 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. if [ "osx" != "${BUILDTARGET}" ]; then
  155. echo "================================================================"
  156. echo "Building Installer JAR "
  157. echo "================================================================"
  158. mkdir -p installer_temp/build
  159. cd installer_temp
  160. ln -sf ../../src/com
  161. ln -sf ../../src/net
  162. # I don't know why, but -d doesn't nicely put ALL generated class files here,
  163. # just those that were in the dir of the java file that was requested for compile
  164. # So we specify each of the different ones we want built into the jar file here.
  165. FILELIST="com/dmdirc/installer/*.java"
  166. FILELIST=${FILELIST}" com/dmdirc/installer/cliparser/*.java"
  167. FILELIST=${FILELIST}" com/dmdirc/ui/swing/dialogs/wizard/*.java"
  168. FILELIST=${FILELIST}" com/dmdirc/ui/interfaces/MainWindow.java"
  169. FILELIST=${FILELIST}" com/dmdirc/ui/swing/MainFrame.java"
  170. FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  171. FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
  172. FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/StandardDialog.java"
  173. FILELIST=${FILELIST}" com/dmdirc/util/ListenerList.java"
  174. FILELIST=${FILELIST}" com/dmdirc/util/WeakMapList.java"
  175. FILELIST=${FILELIST}" com/dmdirc/util/MapList.java"
  176. FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/EtchedLineBorder.java"
  177. FILELIST=${FILELIST}" com/dmdirc/util/EquatableWeakReference.java"
  178. FILELIST=${FILELIST}" com/dmdirc/ui/swing/JWrappingLabel.java"
  179. FILELIST=${FILELIST}" com/dmdirc/util/WeakList.java"
  180. FILELIST=${FILELIST}" net/miginfocom/layout/*.java"
  181. FILELIST=${FILELIST}" net/miginfocom/swing/*.java"
  182. ${JAVAC} -d ./build ${FILELIST}
  183. if [ $? -ne 0 ]; then
  184. echo "================================================================"
  185. echo "Building installer failed."
  186. echo "================================================================"
  187. cd ${THISDIR}
  188. rm -Rf installer_temp
  189. exit 1;
  190. fi
  191. cd build
  192. echo "Manifest-Version: 1.0" > manifest.txt
  193. echo "Created-By: DMDirc Installer" >> manifest.txt
  194. echo "Main-Class: com.dmdirc.installer.Main" >> manifest.txt
  195. echo "Class-Path: " >> manifest.txt
  196. echo "" >> manifest.txt
  197. ${JAR} cmf manifest.txt installer.jar com net
  198. if [ $? -ne 0 ]; then
  199. echo "================================================================"
  200. echo "Building installer failed."
  201. echo "================================================================"
  202. cd ${THISDIR}
  203. rm -Rf installer_temp
  204. exit 1;
  205. else
  206. rm -Rf ${THISDIR}/common/installer.jar
  207. mv installer.jar ${THISDIR}/common/installer.jar
  208. fi
  209. cd ${THISDIR}
  210. rm -Rf installer_temp
  211. fi;
  212. # Copy default settings from www to trunk for compile (if they exist, and we are
  213. # building a new jar)
  214. REVERTLIST=""
  215. if [ "" = "${JARFILE}" ]; then
  216. if [ -e "${HOME}/www/updates/" ]; then
  217. echo "================================================================"
  218. echo "Applying settings update to this source"
  219. echo "================================================================"
  220. for updatedir in `ls -1 ../src/com/dmdirc/config/defaults/`; do
  221. src="${HOME}/www/updates/${updatedir}"
  222. if [ -e ${src} ]; then
  223. REVERTLIST=${REVERTLIST}" ../src/com/dmdirc/config/defaults/${updatedir}/"
  224. cp -Rfv ${src}/* ../src/com/dmdirc/config/defaults/${updatedir}/
  225. fi;
  226. done
  227. fi;
  228. fi;
  229. if [ "" = "${FULLJAR}" ]; then
  230. echo "================================================================"
  231. echo "Building Release Jar"
  232. echo "================================================================"
  233. cd jar
  234. ./makeJar.sh ${OPT}${JARFILE}${JRE}-c -k -s ${BRANCH}${RELEASE} -p "${plugins}"
  235. RESULT=${?}
  236. cd ${THISDIR}
  237. if [ ${RESULT} -eq 0 ]; then
  238. JARNAME=`ls -1tr output | grep jar$ | tail -n 1`
  239. JARFILE="--jar ../output/${JARNAME} "
  240. else
  241. echo "Failed to build release jar, aborting."
  242. exit 1;
  243. fi;
  244. fi;
  245. if [ "linux" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  246. echo "================================================================"
  247. echo "Building linux installer"
  248. echo "================================================================"
  249. cd linux
  250. ./makeInstallerLinux.sh ${OPT}${JARFILE}${JRE}-k ${BRANCH}${RELEASE} -p "${plugins_linux}"
  251. cd ${THISDIR}
  252. fi;
  253. if [ "windows" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  254. echo "================================================================"
  255. echo "Building Windows installer"
  256. echo "================================================================"
  257. cd windows
  258. ./makeInstallerWindows.sh ${OPT}${JARFILE}${JRE}-k -s ${BRANCH}${RELEASE} -p "${plugins_windows}"
  259. cd ${THISDIR}
  260. fi;
  261. if [ "osx" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
  262. echo "================================================================"
  263. echo "Building OSX Bundle"
  264. echo "================================================================"
  265. cd osx
  266. ./makeInstallerOSX.sh ${OPT}${JARFILE}-k -s ${BRANCH}${RELEASE} -p "${plugins_osx}"
  267. cd ${THISDIR}
  268. fi;
  269. #MD5BIN=`which md5sum`
  270. #if [ "${MD5BIN}" != "" ]; then
  271. # echo "================================================================"
  272. # echo "Creating MD5SUM files"
  273. # echo "================================================================"
  274. # cd output
  275. # for outputFile in *; do
  276. # if [ "${outputFile##*.}" != "md5" ]; then
  277. # if [ -e "${outputFile}.md5" ]; then
  278. # rm -f "${outputFile}.md5"
  279. # fi
  280. # ${MD5BIN} "${outputFile}" > "${outputFile}.md5"
  281. # fi
  282. # done
  283. # cd ${THISDIR}
  284. #fi
  285. echo "================================================================"
  286. echo "Clean Up"
  287. echo "================================================================"
  288. # Now revert the trunk so as not to break updates.
  289. for updatedir in ${REVERTLIST}; do
  290. SVN=`which svn`
  291. ${SVN} revert ${updatedir}/*
  292. done;
  293. echo "================================================================"
  294. echo "Release ready - see output folder"
  295. echo "================================================================"
  296. exit 0;