1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
/* SMPlayer Build Script */
/* root done by Herwig Bauernfeind, enhanced by Silvan Scherrer */
/* version history */
/* version 0.1.0 from 07.09.2009 Silvan (first edition) */
/* version 0.2.2 from 08.09.2009 Herwig (a lot enhancements) */
/* version 0.2.3 from 10.09.2009 Silvan (fixed a slash bug in rootdir) */
/* version 0.2.4 from 19.10.2009 Silvan (enabled lrelease support) */
/* version 0.2.5 from 22.10.2009 Silvan (enabled install) */
/* version 0.2.6 from 29.01.2010 Silvan (added more readmes) */
/* version 0.2.7 from 29.04.2010 Silvan (added SMPlayer version for sed'ing readme's) */
/* version 0.2.8 from 20.05.2010 Silvan (added version to zip) */
/* version 0.2.9 from 11.11.2011 Silvan (adapted to Qt 4.7.3) */
/* version 0.3.0 from 24.12.2011 Silvan (added shadow build) */
/* version 0.3.1 from 16.03.2012 Silvan (get the version from version.cpp) */
/* version 0.3.2 from 29.03.2012 Silvan (don't delete the installdir completely) */
/* init the version string (don't forget to change) */
version = "0.3.2"
version_date = "29.03.2012"
'@echo off'
parse arg command option
parse source . . scriptFile
/* init the required vars */
qRC = 0
mRC = 0
buildDir = strip(directory(),'T','\') /* Make sure we have no trailing backslash */
sourceDir = FixDir(filespec('D', scriptFile) || filespec('P', scriptFile))
os2Dir = sourceDir || '\os2'
srcDir = sourceDir || '\src'
installDir = buildDir || '\install'
installDirT= installDir || '\translations'
qErrorFile = buildDir||'\qmake.err'
qOutFile = buildDir||'\qmake.out'
mErrorFile = buildDir||'\make.err'
mOutFile = buildDir||'\make.out'
/* get the SMPlayer version */
SMPlayer_version = '0.0.0'
call version
internal_build = translate(SMPlayer_version, '_', '.')
title = "SMPlayer for eCS (OS/2) build script v" || version || " from " || version_date
say title
say
say "Build directory:" buildDir
say "Source directory:" sourceDir
say
say "SMPlayer version:" SMPlayer_version
say
/* translate command to all upercase */
command = translate(command)
if command = "" then signal help
if command = "INSTALL" then do
SMPlayer_build = option
select
when SMPlayer_build \== "" then do
zipFile = installDir || '\SMPlayer-' || internal_build || '-' || SMPlayer_build || '.zip'
end
otherwise do
signal help
end
end
end
/* now we translate also the options */
options = translate(options)
if sourceDir \== buildDir then do
say "Shadow build in progress ..."
say
end
select
when command = "MAKE" & option = "CLEAN" then do
say "Executing command: "command option
say "cleaning the tree"
call make 'distclean'
say "please execute this script again with 'make' to build SMPlayer"
end
when command = "MAKE" then do
say "Executing command: "command option
say "building svn_revision"
ok = SysMkDir(buildDir||'\src')
address cmd 'sh ' sourceDir||'\get_svn_revision.sh ' sourceDir ' "eCS(OS/2) build"'
say "creating SMPlayer makefile"
call qmake
if qRC = 0 then do
say "building SMPlayer"
if option = "" then do
call make
end
else do
call make 'debug'
end
end
end
when command = "INSTALL" then do
say "Executing command: "command
/* first delete everything */
call deleteall
/* create the installDir,and the translation subdir */
ok = SysMkDir(installDir)
ok = SysMkDir(installDirT)
/* copy the exe */
ok = SysCopyObject(buildDir||'\src\smplayer.exe',installDir)
/* copy the readme */
rm.0 = 3
rm.1 = 'readme.os2'
rm.2 = 'liesmich.os2'
rm.3 = 'lisezmoi.os2'
do i = 1 to rm.0
cmdtorun = 'sed "s;_VERSION_;' || SMPlayer_version || ';g" ' || os2Dir || '\' || rm.i || ' | sed "s;_BUILD_;' || SMPlayer_build || ';g" >' || installDir || '\' || rm.i
address cmd cmdtorun
end
/* create the qm files from ts files */
ok = SysFileTree(srcDir||'\translations\*.ts', rm.,'FO')
do i = 1 to rm.0
fileName = filespec('N',rm.i)
fileName = left(fileName,lastpos('.', fileName)-1) || '.qm'
cmdtorun = 'lrelease ' || rm.i || ' -qm ' || installDir || '\translations\' || fileName
address cmd cmdtorun
end
/* zip all dynamic stuff */
ok = directory(installDir)
cmdtorun = 'zip -r ' || zipFile || ' * -x *.zip'
address cmd cmdtorun
ok = directory(buildDir)
/* zip all icons */
ok = directory(os2Dir)
cmdtorun = 'zip ' || zipFile || ' *.ico'
address cmd cmdtorun
ok = directory(buildDir)
end
when command = "UNINSTALL" then do
say "Executing command: "command
call deleteall
end
otherwise do
say 'Unknown parameter "'command'" - aborting...'
exit 1
end
end
/* cleanup the mess */
error:
if qRC = 0 & mRC = 0 then do
ok = SysFileDelete(mOutFile)
ok = SysFileDelete(mErrorFile)
ok = SysFileDelete(qOutFile)
ok = SysFileDelete(qErrorFile)
end
else do
if mRC <> 0 then do
say "Alarm! Make errors occured! Look at "mOutFile" and "mErrorFile
end
if qRC <> 0 then do
say "Alarm! qMake errors occured! Look at "qOutFile" and "qErrorFile
end
end
exit 0
qmake:
address cmd 'qmake ' sourceDir ' 2>'qErrorFile' 1>'qOutFile
qRC = RC
if qRC <> 0 then do
call beep 880, 20
say "Alarm! qmake RC="RC
end
return
make:
makeparm = arg(1)
address cmd 'make 'makeparm' 2>'mErrorFile' 1>'mOutFile
mRC = RC
if mRC <> 0 then do
call beep 880, 20
say "Alarm! make RC="RC
end
return
deleteall: /* delete installDir (including subdirs) except zip files */
say "Delete all files except *zip in " installDir
ok = SysFileTree(installDir||'\*', rm.,'FOS')
do i = 1 to rm.0
if translate(right(rm.i, 3)) \== 'ZIP' then do
ok = SysFileDelete(rm.i)
end
end
say "Delete zip file " zipFile
ok = SysFileDelete(zipFile)
say "Removing subdirs from " || installDir
ok = SysFileTree(installDir||'\*', rm.,'OS')
do i = 1 to rm.0
ok = SysRmDir(rm.i)
end
call SysSleep(5)
return
/**
* Fixes the directory path by a) converting all slashes to back
* slashes and b) ensuring that the trailing slash is present if
* the directory is the root directory, and absent otherwise.
*
* @param dir the directory path
* @param noslash
* optional argument. If 1, the path returned will not have a
* trailing slash anyway. Useful for concatenating it with a
* file name.
*/
FixDir: procedure expose (Globals)
parse arg dir, noslash
noslash = (noslash = 1)
dir = translate(dir, '\', '/')
if (right(dir, 1) == '\' &,
(noslash | \(length(dir) == 3 & (substr(dir, 2, 1) == ':')))) then
dir = substr(dir, 1, length(dir) - 1)
return dir
/**
* reads the version.cpp and gets the SMPlayer version from there
*/
version: procedure expose SMPlayer_version srcDir
SMPlayerVer = ' '
/* SMPlayer Version file */
Version = srcDir || "\version.cpp"
do until lines(Version) = 0
verline = linein(Version)
if left(Verline,15) = "#define VERSION" then do
parse var verline . ' '. ' ' SMPlayerVer
end
end
ok = stream(Version,'c','close')
if SMPlayerVer \== ' ' then do
SMPlayer_version = strip(SMPlayerVer,,'"')
end
return
help:
say "Parameters:"
say " make"
say " make debug"
say " make clean"
say " install version"
say " uninstall"
exit 255
|