| 1 | diff -Naur E:\trees\smtube\trunk\..\vendor\current/build_os2.cmd E:\trees\smtube\trunk/build_os2.cmd
|
|---|
| 2 | --- E:\trees\smtube\trunk\..\vendor\current/build_os2.cmd 1970-01-01 01:00:00.000000000 +0100
|
|---|
| 3 | +++ E:\trees\smtube\trunk/build_os2.cmd 2013-11-28 12:54:50.000000000 +0100
|
|---|
| 4 | @@ -0,0 +1,288 @@
|
|---|
| 5 | +/* SMTube Build Script */
|
|---|
| 6 | +/* root done by Herwig Bauernfeind, enhanced by Silvan Scherrer */
|
|---|
| 7 | +
|
|---|
| 8 | +/* version history */
|
|---|
| 9 | +/* version 0.1.0 from 23.05.2013 Silvan (first edition) */
|
|---|
| 10 | +/* version 0.1.1 from 05.06.2013 Silvan renamed readme files (happy birthday Justin) */
|
|---|
| 11 | +/* version 0.2.0 from 28.11.2013 Silvan added branding, added diff */
|
|---|
| 12 | +
|
|---|
| 13 | +/* init the version string (don't forget to change) */
|
|---|
| 14 | +version = "0.2.0"
|
|---|
| 15 | +version_date = "28.11.2013"
|
|---|
| 16 | +'@echo off'
|
|---|
| 17 | +
|
|---|
| 18 | +parse arg command option
|
|---|
| 19 | +parse source . . scriptFile
|
|---|
| 20 | +
|
|---|
| 21 | +/* init the required vars */
|
|---|
| 22 | +qRC = 0
|
|---|
| 23 | +mRC = 0
|
|---|
| 24 | +buildDir = strip(directory(),'T','\') /* Make sure we have no trailing backslash */
|
|---|
| 25 | +sourceDir = FixDir(filespec('D', scriptFile) || filespec('P', scriptFile))
|
|---|
| 26 | +os2Dir = sourceDir || '\os2'
|
|---|
| 27 | +srcDir = sourceDir || '\src'
|
|---|
| 28 | +vendorDir = sourceDir || '\..\vendor\current'
|
|---|
| 29 | +diffDir = sourceDir || '\..\'
|
|---|
| 30 | +installDir = buildDir || '\install'
|
|---|
| 31 | +installDirT= installDir || '\translations'
|
|---|
| 32 | +qErrorFile = buildDir||'\qmake.err'
|
|---|
| 33 | +qOutFile = buildDir||'\qmake.out'
|
|---|
| 34 | +mErrorFile = buildDir||'\make.err'
|
|---|
| 35 | +mOutFile = buildDir||'\make.out'
|
|---|
| 36 | +
|
|---|
| 37 | +/* get the SMTube version */
|
|---|
| 38 | +SMTube_version = '0.0.0'
|
|---|
| 39 | +SMTube_build = ''
|
|---|
| 40 | +call version
|
|---|
| 41 | +internal_build = translate(SMTube_version, '_', '.')
|
|---|
| 42 | +
|
|---|
| 43 | +title = "SMTube for eCS (OS/2) build script v" || version || " from " || version_date
|
|---|
| 44 | +say title
|
|---|
| 45 | +say
|
|---|
| 46 | +say "Build directory :" buildDir
|
|---|
| 47 | +say "Source directory:" sourceDir
|
|---|
| 48 | +say
|
|---|
| 49 | +say "SMTube version :" SMTube_version
|
|---|
| 50 | +say " build :" SMTube_build
|
|---|
| 51 | +say
|
|---|
| 52 | +
|
|---|
| 53 | +/* translate command to all upercase */
|
|---|
| 54 | +command = translate(command)
|
|---|
| 55 | +
|
|---|
| 56 | +if command = "" then signal help
|
|---|
| 57 | +
|
|---|
| 58 | +if command = "INSTALL" then do
|
|---|
| 59 | + if option \== "" then do
|
|---|
| 60 | + SMTube_build = option
|
|---|
| 61 | + end
|
|---|
| 62 | + select
|
|---|
| 63 | + when SMTube_build \== "" then do
|
|---|
| 64 | + zipFile = installDir || '\SMTube-' || internal_build || '-' || SMTube_build || '.zip'
|
|---|
| 65 | + end
|
|---|
| 66 | + otherwise do
|
|---|
| 67 | + signal help
|
|---|
| 68 | + end
|
|---|
| 69 | + end
|
|---|
| 70 | +end
|
|---|
| 71 | +
|
|---|
| 72 | +/* now we translate also the options */
|
|---|
| 73 | +option = translate(option)
|
|---|
| 74 | +
|
|---|
| 75 | +if sourceDir \== buildDir then do
|
|---|
| 76 | + say "Shadow build in progress ..."
|
|---|
| 77 | + say
|
|---|
| 78 | +end
|
|---|
| 79 | +
|
|---|
| 80 | +say "Executing command: "command option
|
|---|
| 81 | +
|
|---|
| 82 | +select
|
|---|
| 83 | + when command = "MAKE" & option = "CLEAN" then do
|
|---|
| 84 | +
|
|---|
| 85 | + say "cleaning the tree"
|
|---|
| 86 | + call make 'distclean'
|
|---|
| 87 | +
|
|---|
| 88 | + say "please execute this script again with 'make' to build SMTube"
|
|---|
| 89 | +
|
|---|
| 90 | + end
|
|---|
| 91 | + when command = "MAKE" then do
|
|---|
| 92 | +
|
|---|
| 93 | + say "building svn_revision"
|
|---|
| 94 | + ok = SysMkDir(buildDir||'\src')
|
|---|
| 95 | + address cmd 'sh ' sourceDir||'\get_svn_revision.sh ' sourceDir ' "eCS(OS/2) build"'
|
|---|
| 96 | +
|
|---|
| 97 | + say "creating SMTube makefile"
|
|---|
| 98 | + call qmake
|
|---|
| 99 | +
|
|---|
| 100 | + if qRC = 0 then do
|
|---|
| 101 | + say "building SMTube"
|
|---|
| 102 | + if option = "" then do
|
|---|
| 103 | + call make
|
|---|
| 104 | + end
|
|---|
| 105 | + else do
|
|---|
| 106 | + call make 'debug'
|
|---|
| 107 | + end
|
|---|
| 108 | + end
|
|---|
| 109 | +
|
|---|
| 110 | + end
|
|---|
| 111 | +
|
|---|
| 112 | + when command = "INSTALL" then do
|
|---|
| 113 | +
|
|---|
| 114 | +/* first delete everything */
|
|---|
| 115 | + call deleteall
|
|---|
| 116 | +
|
|---|
| 117 | +/* create the installDir,and the translation subdir */
|
|---|
| 118 | + ok = SysMkDir(installDir)
|
|---|
| 119 | + ok = SysMkDir(installDirT)
|
|---|
| 120 | +
|
|---|
| 121 | +/* copy the exe */
|
|---|
| 122 | + ok = SysCopyObject(buildDir||'\src\smtube.exe',installDir)
|
|---|
| 123 | +
|
|---|
| 124 | +/* copy the readme */
|
|---|
| 125 | + rm.0 = 3
|
|---|
| 126 | + rm.1 = 'smtube_en.txt'
|
|---|
| 127 | + rm.2 = 'smtube_de.txt'
|
|---|
| 128 | + rm.3 = 'smtube_fr.txt'
|
|---|
| 129 | + do i = 1 to rm.0
|
|---|
| 130 | + cmdtorun = 'sed "s;_VERSION_;' || SMTube_version || ';g" ' || os2Dir || '\' || rm.i || ' | sed "s;_BUILD_;' || SMTube_build || ';g" >' || installDir || '\' || rm.i
|
|---|
| 131 | + address cmd cmdtorun
|
|---|
| 132 | + end
|
|---|
| 133 | +
|
|---|
| 134 | +/* create the qm files from ts files */
|
|---|
| 135 | + ok = SysFileTree(srcDir||'\translations\*.ts', rm.,'FO')
|
|---|
| 136 | + do i = 1 to rm.0
|
|---|
| 137 | + fileName = filespec('N',rm.i)
|
|---|
| 138 | + fileName = left(fileName,lastpos('.', fileName)-1) || '.qm'
|
|---|
| 139 | + cmdtorun = 'lrelease ' || rm.i || ' -qm ' || installDir || '\translations\' || fileName
|
|---|
| 140 | + address cmd cmdtorun
|
|---|
| 141 | + end
|
|---|
| 142 | +
|
|---|
| 143 | +/* zip all dynamic stuff */
|
|---|
| 144 | + ok = directory(installDir)
|
|---|
| 145 | + cmdtorun = 'zip -r ' || zipFile || ' * -x *.zip'
|
|---|
| 146 | + address cmd cmdtorun
|
|---|
| 147 | + ok = directory(buildDir)
|
|---|
| 148 | +
|
|---|
| 149 | +/* zip all icons */
|
|---|
| 150 | + ok = directory(os2Dir)
|
|---|
| 151 | + cmdtorun = 'zip ' || zipFile || ' *.ico'
|
|---|
| 152 | + address cmd cmdtorun
|
|---|
| 153 | + ok = directory(buildDir)
|
|---|
| 154 | +
|
|---|
| 155 | + end
|
|---|
| 156 | +
|
|---|
| 157 | + when command = "UNINSTALL" then do
|
|---|
| 158 | +
|
|---|
| 159 | + call deleteall
|
|---|
| 160 | +
|
|---|
| 161 | + end
|
|---|
| 162 | +
|
|---|
| 163 | + when command = "DIFF" then do
|
|---|
| 164 | +
|
|---|
| 165 | + address cmd 'diff -Naur ' || vendorDir || ' ' || sourceDir || ' > ' || diffDir || 'smtube_' || SMTube_version || '_' || SMTube_build || '.diff'
|
|---|
| 166 | +
|
|---|
| 167 | + end
|
|---|
| 168 | +
|
|---|
| 169 | + otherwise do
|
|---|
| 170 | + say 'Unknown parameter "'command'" - aborting...'
|
|---|
| 171 | + exit 1
|
|---|
| 172 | + end
|
|---|
| 173 | +end
|
|---|
| 174 | +
|
|---|
| 175 | +/* cleanup the mess */
|
|---|
| 176 | +error:
|
|---|
| 177 | +
|
|---|
| 178 | +if qRC = 0 & mRC = 0 then do
|
|---|
| 179 | + ok = SysFileDelete(mOutFile)
|
|---|
| 180 | + ok = SysFileDelete(mErrorFile)
|
|---|
| 181 | + ok = SysFileDelete(qOutFile)
|
|---|
| 182 | + ok = SysFileDelete(qErrorFile)
|
|---|
| 183 | +end
|
|---|
| 184 | +else do
|
|---|
| 185 | + if mRC <> 0 then do
|
|---|
| 186 | + say "Alarm! Make errors occured! Look at "mOutFile" and "mErrorFile
|
|---|
| 187 | + end
|
|---|
| 188 | + if qRC <> 0 then do
|
|---|
| 189 | + say "Alarm! qMake errors occured! Look at "qOutFile" and "qErrorFile
|
|---|
| 190 | + end
|
|---|
| 191 | +end
|
|---|
| 192 | +
|
|---|
| 193 | +exit 0
|
|---|
| 194 | +
|
|---|
| 195 | +qmake:
|
|---|
| 196 | + address cmd 'qmake ' sourceDir ' "APPLICATION_VERSION='SMTube_version'" 2>'qErrorFile' 1>'qOutFile
|
|---|
| 197 | + qRC = RC
|
|---|
| 198 | + if qRC <> 0 then do
|
|---|
| 199 | + call beep 880, 20
|
|---|
| 200 | + say "Alarm! qmake RC="RC
|
|---|
| 201 | + end
|
|---|
| 202 | +return
|
|---|
| 203 | +
|
|---|
| 204 | +make:
|
|---|
| 205 | + makeparm = arg(1)
|
|---|
| 206 | + address cmd 'make 'makeparm' 2>'mErrorFile' 1>'mOutFile
|
|---|
| 207 | + mRC = RC
|
|---|
| 208 | + if mRC <> 0 then do
|
|---|
| 209 | + call beep 880, 20
|
|---|
| 210 | + say "Alarm! make RC="RC
|
|---|
| 211 | + end
|
|---|
| 212 | +return
|
|---|
| 213 | +
|
|---|
| 214 | +
|
|---|
| 215 | +deleteall: /* delete installDir (including subdirs) except zip files */
|
|---|
| 216 | +
|
|---|
| 217 | + say "Delete all files except *zip in " installDir
|
|---|
| 218 | + ok = SysFileTree(installDir||'\*', rm.,'FOS')
|
|---|
| 219 | + do i = 1 to rm.0
|
|---|
| 220 | + if translate(right(rm.i, 3)) \== 'ZIP' then do
|
|---|
| 221 | + ok = SysFileDelete(rm.i)
|
|---|
| 222 | + end
|
|---|
| 223 | + end
|
|---|
| 224 | +
|
|---|
| 225 | + say "Delete zip file " zipFile
|
|---|
|
|---|