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.

makeInstallerWindows.sh 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. #!/bin/sh
  2. #
  3. # This script generates a .exe file that will install DMDirc
  4. #
  5. # DMDirc - Open Source IRC Client
  6. # Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining a copy
  9. # of this software and associated documentation files (the "Software"), to deal
  10. # in the Software without restriction, including without limitation the rights
  11. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. # copies of the Software, and to permit persons to whom the Software is
  13. # furnished to do so, subject to the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included in
  16. # all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. # SOFTWARE.
  25. # Name of the extractor
  26. RUNNAME=extractor.exe
  27. # Name of the installer (without .exe)
  28. INSTALLNAME=DMDirc-Setup
  29. # Name of the internal file
  30. INTNAME=extractor.7z
  31. # full name of the files to output to
  32. RUNNAME="${PWD}/${RUNNAME}"
  33. INTNAME="${PWD}/${INTNAME}"
  34. # Get 7zip path
  35. ZIP=`which 7z`
  36. if [ "" = "${ZIP}" ]; then
  37. echo "7Zip not found, failing."
  38. exit 1;
  39. fi
  40. # Compress stuff!
  41. compress() {
  42. ${ZIP} a -yl ${INTNAME} $@ 2>/dev/null || {
  43. echo "Compression failed."
  44. kill -15 $$;
  45. };
  46. }
  47. # Get signcode path
  48. SIGNCODE=`which signcode`
  49. if [ "" = "${SIGNCODE}" ]; then
  50. echo "Signcode not found. EXE's will not be digitally signed."
  51. fi
  52. # Sign stuff!
  53. signexe() {
  54. return;
  55. if [ "" != "${SIGNCODE}" ]; then
  56. if [ -e "../signing/DMDirc.spc" -a -e "../signing/DMDirc.pvk" ]; then
  57. echo "Digitally Signing EXE (${@})..."
  58. ${SIGNCODE} -spc "../signing/DMDirc.spc" -v "../signing/DMDirc.pvk" -i "http://www.dmdirc.com/" -n "DMDirc Installer" $@ 2>/dev/null || {
  59. kill -15 $$;
  60. };
  61. rm ${@}.sig
  62. rm ${@}.bak
  63. fi
  64. fi
  65. }
  66. # Check for some CLI params
  67. compileJar="false"
  68. updateSVN="true"
  69. compileSetup="false"
  70. useOldSetup="false"
  71. isRelease=""
  72. useUPX="false"
  73. finalTag=""
  74. signEXE="true"
  75. compilerFlags=""
  76. BRANCH="0"
  77. plugins=""
  78. location="../../../"
  79. jarfile=""
  80. current=""
  81. jre=""
  82. jrename="jre" # Filename for JRE without the .exe
  83. showHelp() {
  84. echo "This will generate a DMDirc installer for a windows based system."
  85. echo "The following command line arguments are known:"
  86. echo "---------------------"
  87. echo "-h, --help Help information"
  88. echo "-r, --release <version> Generate a file based on an svn tag (or branch with -b aswell)"
  89. echo "-b, --branch Release in -r is a branch "
  90. echo "-s, --setup Recompile the .exe file"
  91. echo "-e, If setup.exe compile fails, use old version"
  92. echo "-p, --plugins <plugins> What plugins to add to the jar file"
  93. echo "-c, --compile Recompile the .jar file"
  94. echo "-u, --unsigned Don't sign the exe"
  95. echo "-t, --tag <tag> Tag to add to final exe name to distinguish this build from a standard build"
  96. echo "-f, --flags <flags> Extra flags to pass to the compiler"
  97. echo " --jre Include the JRE in this installer"
  98. echo " --jar <file> use <file> as DMDirc.jar"
  99. echo " --current Use the current folder as the base for the build"
  100. # This is not in the help cos its crappy really, and makes little/no difference to the
  101. # exe size unless debugging information is added using --flags, in which case the person
  102. # probably is Dataforce and knows about this flag anyway
  103. # echo " --upx UPX binary if UPX is available on the path,"
  104. # echo " (Compression Level: 4 for signed exe, 9 for unsigned)"
  105. echo "-k, --keep Keep the existing source tree when compiling"
  106. echo " (don't svn update beforehand)"
  107. echo "---------------------"
  108. exit 0;
  109. }
  110. while test -n "$1"; do
  111. case "$1" in
  112. --plugins|-p)
  113. shift
  114. plugins=${1}
  115. ;;
  116. --jar)
  117. shift
  118. jarfile=${1}
  119. ;;
  120. --jre)
  121. jre="http://www.dmdirc.com/getjava/windows/all"
  122. ;;
  123. --jre64)
  124. # No specific jre64 for windows.
  125. echo "No specific 64ibt JRE for windows, exiting"
  126. exit 1;
  127. ;;
  128. --current)
  129. location="../../"
  130. current="1"
  131. ;;
  132. --compile|-c)
  133. compileJar="true"
  134. ;;
  135. --setup|-s)
  136. compileSetup="true"
  137. ;;
  138. -e)
  139. useOldSetup="true"
  140. ;;
  141. --release|-r)
  142. shift
  143. isRelease=${1}
  144. ;;
  145. --tag|-t)
  146. shift
  147. finalTag="-${1}"
  148. ;;
  149. --flags|-f)
  150. shift
  151. compilerFlags="${1} "
  152. ;;
  153. --upx)
  154. useUPX="true"
  155. ;;
  156. --unsigned|-u)
  157. signEXE="false"
  158. ;;
  159. --keep|-k)
  160. updateSVN="false"
  161. ;;
  162. --help|-h)
  163. showHelp;
  164. ;;
  165. --branch|-b)
  166. BRANCH="1"
  167. ;;
  168. esac
  169. shift
  170. done
  171. # Go!
  172. echo "-----------"
  173. if [ -e "${RUNNAME}" ]; then
  174. echo "Removing existing .exe file"
  175. rm -Rf "${RUNNAME}"
  176. fi
  177. if [ -e "${INTNAME}" ]; then
  178. echo "Removing existing .7z file"
  179. rm -Rf "${INTNAME}"
  180. fi
  181. echo "Creating .7z file"
  182. if [ "" = "${current}" ]; then
  183. jarPath="${location}trunk"
  184. else
  185. jarPath="${location}"
  186. fi
  187. if [ "${isRelease}" != "" ]; then
  188. if [ "${BRANCH}" != "0" ]; then
  189. if [ -e "${location}/${isRelease}" ]; then
  190. jarPath="${location}/${isRelease}"
  191. else
  192. echo "Branch "${isRelease}" not found."
  193. exit 1;
  194. fi
  195. else
  196. if [ -e "${location}/${isRelease}" ]; then
  197. jarPath="${location}/${isRelease}"
  198. else
  199. echo "Tag "${isRelease}" not found."
  200. exit 1;
  201. fi
  202. fi
  203. fi
  204. if [ "" = "${jarfile}" ]; then
  205. jarfile=${jarPath}"/dist/DMDirc.jar"
  206. if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
  207. echo "Creating jar.."
  208. OLDPWD=${PWD}
  209. cd ${jarPath}
  210. if [ "${updateSVN}" = "true" ]; then
  211. svn update
  212. fi
  213. rm -Rf build dist
  214. ant jar
  215. if [ ! -e "dist/DMDirc.jar" ]; then
  216. echo "There was an error creating the .jar file. Aborting."
  217. exit 1;
  218. fi;
  219. cd ${OLDPWD}
  220. fi;
  221. elif [ ! -e "${jarfile}" ]; then
  222. echo "Requested Jar file (${jarfile}) does not exist."
  223. exit 1;
  224. fi;
  225. if [ "" = "${plugins}" ]; then
  226. echo "Linking jar (${jarfile}).."
  227. ln -sf ${jarfile} "./DMDirc.jar"
  228. else
  229. echo "Copying jar (${jarfile}).."
  230. cp ${jarfile} "./DMDirc.jar"
  231. echo "Adding plugins to jar"
  232. ln -sf ${jarPath}"/plugins"
  233. pluginList=""
  234. for plugin in ${plugins}; do
  235. pluginList=${pluginList}" plugins/${plugin}"
  236. done
  237. jar -uvf "DMDirc.jar" ${pluginList}
  238. rm -Rf plugins;
  239. fi
  240. echo " ReleaseNumber: String = '${isRelease}';" > SetupConsts.inc
  241. FILES="DMDirc.jar Setup.exe";
  242. if [ "" != "${jre}" ]; then
  243. if [ ! -e "../common/${jrename}.exe" ]; then
  244. echo "Downloading JRE to include in installer"
  245. wget ${jre} -O ../common/${jrename}.exe
  246. fi
  247. ln -sf ../common/${jrename}.exe jre.exe
  248. FILES="${FILES} jre.exe"
  249. fi;
  250. DELETEFILES=${FILES}
  251. FPC=`which fpc`
  252. lazarusDir="/usr/lib/lazarus"
  253. compilerFlags="-Sd -Twin32 ${compilerFlags}";
  254. if [ ! -e "Setup.exe" -o "${compileSetup}" = "true" ]; then
  255. echo "Setup.exe does not exist. Lets try and compile it."
  256. if [ "${FPC}" = "" ]; then
  257. echo "FPC Compiler not found, Setup.exe can not be built."
  258. exit 1;
  259. else
  260. echo "Building Setup.exe..."
  261. extraFlags=""
  262. if [ -e "${lazarusDir}/lcl" ]; then
  263. echo "Using Lazarus"
  264. mkdir -p ${PWD}/lazarus-build
  265. extraFlags="-dLAZARUS -FU${PWD}/lazarus-build -Fu${PWD}/lazarus-build -Fu${lazarusDir}/lcl/widgetset/ -Fu${lazarusDir}/lcl/interfaces/win32/ -Fu${lazarusDir}/lcl/ -Fi${lazarusDir}/lcl/include/"
  266. fi;
  267. ${FPC} ${compilerFlags} ${extraFlags} Setup.dpr
  268. if [ $? -ne 0 ]; then
  269. if [ -e "Setup.exe" -a "${useOldSetup}" = "true" ]; then
  270. echo "Unable to compile Setup.exe, using existing version."
  271. else
  272. echo "Unable to compile Setup.exe, terminating."
  273. exit 1;
  274. fi
  275. fi;
  276. fi
  277. fi
  278. ls
  279. if [ ! -e "Setup.exe" ]; then
  280. echo "Still can't find Setup.exe, terminating."
  281. exit 1;
  282. fi
  283. echo "Compressing files.."
  284. if [ -e "../common/installer.jar" ]; then
  285. ln -sf ../common/installer.jar ./installer.jar
  286. FILES="${FILES} installer.jar"
  287. DELETEFILES="${DELETEFILES} installer.jar"
  288. else
  289. echo "[WARNING] Creating installer-less archive - relying on Setup.exe"
  290. fi
  291. if [ -e ${jarPath}"/src/com/dmdirc/res/icon.ico" ]; then
  292. ln -sf ${jarPath}"/src/com/dmdirc/res/icon.ico" ./icon.ico
  293. FILES="${FILES} icon.ico"
  294. DELETEFILES="${DELETEFILES} icon.ico"
  295. fi
  296. # Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
  297. if [ ! -e Shortcut.exe ]; then
  298. wget http://www.optimumx.com/download/Shortcut.zip
  299. unzip -q Shortcut.zip Shortcut.exe
  300. rm Shortcut.zip
  301. fi
  302. FILES="${FILES} Shortcut.exe"
  303. DELETEFILES="${DELETEFILES} Shortcut.exe"
  304. if [ "${isRelease}" != "" ]; then
  305. DOCSDIR=${jarPath}
  306. else
  307. DOCSDIR="../common"
  308. fi
  309. if [ -e "${DOCSDIR}/README.TXT" ]; then
  310. ln -sf "${DOCSDIR}/README.TXT" .
  311. FILES="${FILES} README.TXT"
  312. DELETEFILES="${DELETEFILES} README.TXT"
  313. fi
  314. if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
  315. ln -sf "${DOCSDIR}/CHANGES.TXT" .
  316. FILES="${FILES} CHANGES.TXT"
  317. DELETEFILES="${DELETEFILES} CHANGES.TXT"
  318. elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
  319. ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
  320. FILES="${FILES} CHANGELOG.TXT"
  321. DELETEFILES="${DELETEFILES} CHANGELOG.TXT"
  322. fi
  323. if [ -e "${jarPath}/launcher/windows" ]; then
  324. # Try to compile all
  325. olddir=${PWD}
  326. cd "${jarPath}/launcher/windows/"
  327. sh compile.sh
  328. cd ${olddir}
  329. # Now add to file list.
  330. for thisfile in `ls -1 ${jarPath}/launcher/windows/*.exe`; do
  331. ln -sf ${thisfile} .
  332. FILES="${FILES} ${thisfile}"
  333. done
  334. fi
  335. # Icon Res file
  336. echo "icon.ico ICON icon.ico" > icon.rc
  337. # Other resources
  338. echo "extractor RCDATA extractor.exe" > files.rc
  339. COMPILER_IS_BROKEN="0";
  340. # Version Numbers
  341. if [ "" = "${1}" ]; then
  342. MAJORVER="0"
  343. MINORVER="0"
  344. RELEASE="0"
  345. TEXTVER="Trunk"
  346. PRIVATE="1"
  347. USER=`whoami`
  348. HOST=`hostname`
  349. DATE=`date`
  350. else
  351. MAJORVER=${1%%.*}
  352. SUBVER=${1#*.}
  353. DOT=`expr index "${SUBVER}" .`
  354. if [ "${DOT}" = "0" ]; then
  355. MINORVER=${SUBVER}
  356. RELEASE="0"
  357. else
  358. MINORVER=${SUBVER%%.*}
  359. RELEASE=${SUBVER##*.}
  360. fi
  361. TEXTVER=$1
  362. PRIVATE="0"
  363. fi;
  364. # Information for the below section:
  365. #
  366. # http://support.microsoft.com/kb/139491
  367. # http://msdn2.microsoft.com/en-us/library/aa381049.aspx
  368. # http://courses.cs.vt.edu/~cs3304/FreePascal/doc/prog/node14.html#SECTION001440000000000000000
  369. # http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/src/Resources/TortoiseShell.rc2
  370. echo "1 VERSIONINFO" > version.rc.1
  371. echo "FILEVERSION 1, 0, 0, 0" >> version.rc.1
  372. echo "PRODUCTVERSION ${MAJORVER}, ${MINORVER}, ${RELEASE}, 0" >> version.rc.1
  373. if [ "${PRIVATE}" = "1" ]; then
  374. if [ "${COMPILER_IS_BROKEN}" = "0" ]; then
  375. echo "FILEFLAGSMASK 0x000A" >> version.rc.1
  376. echo "FILEFLAGS 0x3f" >> version.rc.1
  377. else
  378. echo "FILEFLAGS 0x000A" >> version.rc.1
  379. fi;
  380. else
  381. echo "FILEFLAGSMASK 0" >> version.rc.1
  382. fi;
  383. echo "FILEOS 0x40004" >> version.rc.1
  384. echo "FILETYPE 1" >> version.rc.1
  385. echo "BEGIN" >> version.rc.1
  386. echo " BLOCK \"StringFileInfo\"" >> version.rc.1
  387. echo " BEGIN" >> version.rc.1
  388. echo " BLOCK \"040004E4\"" >> version.rc.1
  389. echo " BEGIN" >> version.rc.1
  390. echo " VALUE \"Comments\", \"http://www.dmdirc.com/\"" >> version.rc.1
  391. echo " VALUE \"CompanyName\", \"DMDirc\"" >> version.rc.1
  392. cat version.rc.1 > version.rc
  393. cat version.rc.1 > uninstallversion.rc
  394. rm version.rc.1
  395. echo " VALUE \"FileDescription\", \"Installer for DMDirc ${TEXTVER}\"" >> version.rc
  396. echo " VALUE \"FileDescription\", \"Uninstaller for DMDirc\"" >> uninstallversion.rc
  397. echo " VALUE \"FileVersion\", \"2.0\"" > version.rc.2
  398. echo " VALUE \"InternalName\", \"DMDirc.jar\"" >> version.rc.2
  399. echo " VALUE \"LegalCopyright\", \"Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes\"" >> version.rc.2
  400. echo " VALUE \"OriginalFilename\", \"$2\"" >> version.rc.2
  401. echo " VALUE \"ProductName\", \"DMDirc\"" >> version.rc.2
  402. echo " VALUE \"ProductVersion\", \"${TEXTVER}\"" >> version.rc.2
  403. if [ "${PRIVATE}" = "1" ]; then
  404. echo " VALUE \"PrivateBuild\", \"Build by ${USER}@${HOST} on ${DATE}\"" >> version.rc.2
  405. fi;
  406. echo " END" >> version.rc.2
  407. echo " END" >> version.rc.2
  408. echo " BLOCK \"VarFileInfo\"" >> version.rc.2
  409. echo " BEGIN" >> version.rc.2
  410. echo " VALUE \"Translation\", 0x400, 1252" >> version.rc.2
  411. echo " END" >> version.rc.2
  412. echo "END" >> version.rc.2
  413. cat version.rc.2 >> version.rc
  414. cat version.rc.2 >> uninstallversion.rc
  415. rm version.rc.2
  416. echo "1 24 \"UAC.manifest\"" > UAC.rc
  417. # Build res files
  418. #windres -F pe-i386 -i version.rc -o version.res
  419. #windres -F pe-i386 -i files.rc -o files.res
  420. #windres -F pe-i386 -i icon.rc -o icon.res
  421. cat UAC.rc > uninstall.rc
  422. cat uninstallversion.rc >> all.rc
  423. cat icon.rc >> uninstall.rc
  424. windres -F pe-i386 -i uninstall.rc -o uninstall.res
  425. ${FPC} ${compilerFlags} ${3}Uninstaller.dpr
  426. if [ -e "Uninstaller.exe" ]; then
  427. FILES="${FILES} Uninstaller.exe"
  428. DELETEFILES="${DELETEFILES} Uninstaller.exe"
  429. fi
  430. # Add wget to allow downloading jre
  431. if [ ! -e "wget.exe" ]; then
  432. wget "http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe"
  433. fi;
  434. if [ ! -e "wget.exe" ]; then
  435. echo "wget.exe not found, unable to continue."
  436. exit 1;
  437. fi;
  438. FILES="${FILES} wget.exe"
  439. compress $FILES
  440. echo "Creating config.."
  441. echo ";!@Install@!UTF-8!" > 7zip.conf
  442. if [ "${isRelease}" != "" ]; then
  443. echo "Title=\"DMDirc Installation "${isRelease}"\"" >> 7zip.conf
  444. # echo "BeginPrompt=\"Do you want to install DMDirc "${isRelease}"?\"" >> 7zip.conf
  445. else
  446. echo "Title=\"DMDirc Installation\"" > 7zip.conf
  447. # echo "BeginPrompt=\"Do you want to install DMDirc?\"" >> 7zip.conf
  448. fi;
  449. echo "ExecuteFile=\"Setup.exe\"" >> 7zip.conf
  450. echo ";!@InstallEnd@!" >> 7zip.conf
  451. if [ ! -e "7zS.sfx" ]; then
  452. echo "Obtaining sfx stub.."
  453. wget http://downloads.sourceforge.net/sevenzip/7z452_extra.tar.bz2 -O 7zextra.tar.bz2
  454. tar -jxvf 7zextra.tar.bz2 7zS.sfx
  455. rm 7zextra.tar.bz2
  456. fi
  457. if [ ! -e "7zS.sfx" ]; then
  458. echo "7zS.sfx not found, unable to continue."
  459. exit 1;
  460. fi;
  461. echo "Creating .exe"
  462. cat 7zS.sfx 7zip.conf "${INTNAME}" > "${RUNNAME}"
  463. if [ "${isRelease}" != "" ]; then
  464. if [ "${BRANCH}" = "1" ]; then
  465. releaseTag=branch-${isRelease}
  466. else
  467. releaseTag=${isRelease};
  468. fi;
  469. ORIGNAME="DMDirc-${releaseTag}-Setup${finalTag}.exe"
  470. else
  471. ORIGNAME="${INSTALLNAME}${finalTag}.exe"
  472. fi;
  473. echo "Building launcher";
  474. MD5BIN=`which md5sum`
  475. AWK=`which awk`
  476. MD5SUM=""
  477. if [ "${MD5BIN}" != "" -a "${AWK}" != "" ]; then
  478. MD5SUM=`${MD5BIN} extractor.exe | ${AWK} '{print $1}'`
  479. fi
  480. echo "const" > consts.inc
  481. echo " MD5SUM: String = '${MD5SUM}';" >> consts.inc
  482. # Code to extract and launch resource
  483. echo "ExtractResource('extractor', 'dmdirc_extractor.exe', TempDir);" > ExtractCode.inc
  484. if [ "${MD5SUM}" != "" ]; then
  485. echo "if FindCmdLineSwitch('-nomd5') or FindCmdLineSwitch('nomd5') or checkMD5(TempDir+'dmdirc_extractor.exe') then begin" >> ExtractCode.inc
  486. echo -n " "; # Oh so important for code formatting!
  487. fi;
  488. echo "Launch(TempDir+'dmdirc_extractor.exe');" >> ExtractCode.inc
  489. if [ "${MD5SUM}" != "" ]; then
  490. echo "end" >> ExtractCode.inc
  491. echo "else begin" >> ExtractCode.inc
  492. echo " ErrorMessage := 'This copy of the DMDirc installer appears to be damaged and will now exit';" >> ExtractCode.inc
  493. echo " ErrorMessage := ErrorMessage+#13#10+'You may choose to skip this check and run it anyway by passing the /nomd5 parameter';" >> ExtractCode.inc
  494. echo " ErrorMessage := ErrorMessage+#13#10+'';" >> ExtractCode.inc
  495. echo " ErrorMessage := ErrorMessage+#13#10;" >> ExtractCode.inc
  496. echo " ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';" >> ExtractCode.inc
  497. echo " ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';" >> ExtractCode.inc
  498. echo " " >> ExtractCode.inc
  499. echo " MessageBox(0, PChar(ErrorMessage), 'Sorry, setup is unable to continue', MB_OK + MB_ICONSTOP);" >> ExtractCode.inc
  500. echo "end;" >> ExtractCode.inc
  501. fi
  502. cat UAC.rc > all.rc
  503. cat version.rc >> all.rc
  504. cat files.rc >> all.rc
  505. cat icon.rc >> all.rc
  506. windres -F pe-i386 -i all.rc -o all.res
  507. ${FPC} ${compilerFlags} ${3}Launcher.dpr
  508. if [ $? -ne 0 ]; then
  509. if [ -e "Launcher.exe" ]; then
  510. echo "Unable to compile Launcher.exe, using existing version."
  511. else
  512. echo "Unable to compile Launcher.exe, terminating."
  513. exit 1;
  514. fi
  515. fi
  516. rm -f *.res
  517. rm -f *.rc
  518. rm -f *.inc
  519. rm -f *.ppu
  520. FULLINSTALLER="${PWD}/${INSTALLNAME}${finalTag}.exe"
  521. mv Launcher.exe ${FULLINSTALLER}
  522. if [ "${useUPX}" = "true" ]; then
  523. UPX=`which upx`
  524. if [ "${UPX}" != "" ]; then
  525. if [ "${signEXE}" = "true" ]; then
  526. ${UPX} -4 ${FULLINSTALLER}
  527. else
  528. ${UPX} -9 ${FULLINSTALLER}
  529. fi
  530. fi
  531. fi
  532. echo "Chmodding.."
  533. chmod a+x ${FULLINSTALLER}
  534. if [ "${signEXE}" = "true" ]; then
  535. echo "Signing.."
  536. signexe ${FULLINSTALLER}
  537. else
  538. echo "Not Signing.."
  539. fi;
  540. if [ "" != "${jre}" ]; then
  541. ORIGNAME=`echo ${ORIGNAME} | sed "s/.exe$/.${jrename}.exe/"`
  542. fi;
  543. mv ${FULLINSTALLER} ../output/${ORIGNAME}
  544. # Quick hack to prevent deleting of 2 important files in ${FILES}
  545. mv Setup.exe Setup.exe.tmp
  546. mv Shortcut.exe Shortcut.exe.tmp
  547. rm -f ${DELETEFILES}
  548. rm -f ./7zip.conf
  549. rm -f ./*.o
  550. rm -f ./*.or
  551. rm -f ${RUNNAME}
  552. rm -f ${INTNAME}
  553. rm -f icon.ico
  554. # And un-hack
  555. mv Setup.exe.tmp Setup.exe
  556. mv Shortcut.exe.tmp Shortcut.exe
  557. echo "-----------"
  558. echo "Done."
  559. echo "-----------"
  560. # and Done \o
  561. exit 0;