Ticket #4397: win32-packager.16.patch
File win32-packager.16.patch, 59.4 KB (added by , 16 years ago) |
---|
-
win32-packager.pl
old new 20 20 #use Cwd (); 21 21 use LWP::UserAgent; 22 22 use IO::File; 23 use Data::Dumper; 23 use Data::Dumper qw(Dumper); 24 use File::Copy qw(cp); 24 25 25 26 my $NOISY = 1; # set to 0 for less output to the screen 26 27 27 28 $| = 1; # autoflush stdout; 28 29 29 my $SVNRELEASE = '15 367' ;# this scipt was last tested to work with this version, on other versions YMMV.30 my $SVNRELEASE = '15433' ;# this scipt was last tested to work with this version, on other versions YMMV. 30 31 31 32 # We allow SourceForge to tell us which server to download from, 32 33 # rather than assuming specific server/s … … 47 48 # TODO using the proxy here WILL cause any Subversion (SVN) commands to fail, 48 49 # you will need to do that by hand. 49 50 my $proxy = ''; 50 #my $proxy = 'http:// prx-bne.qmtechnologies.com:8080';51 #my $proxy = 'http://enter.your.proxy.here:8080'; 51 52 52 53 # TODO - use this list to define the components to build - 53 54 my @components = ( 'mythtv', 'myththemes', 'mythplugins' ); … … 75 76 76 77 # unix/msys equivalent versions of the paths (for when we shell to MSYS/UNIX mode): 77 78 my $unixmsys = '/'; # msys root is always mounted here, irrespective of where DOS says it really is. 78 my $unixmingw = '/mingw/'; # mingw is always mounted here under unix, if you setup mingw right in msys .(see /etc/fstab)79 my $unixmingw = '/mingw/'; # mingw is always mounted here under unix, if you setup mingw right in msys, so we will usually just say /mingw in the code, not '.$unixmingw.' or similar (see /etc/fstab) 79 80 my $unixsources = perl2unix($sources); $unixsources =~ s#$unixmsys#/#i; #strip leading msys path, if there, it's unnecessary as it's mounted under / 80 81 my $unixmythtv = perl2unix($mythtv); 81 82 82 83 83 #NOTE: ITS IMPORTANT THAT ALL PATHS use FORWARD SLASHES in the declarations below, the code depends on it. 84 # ... and much of the path separator code is fragile! 85 # In some places we regex these into double backslashes, and at other times to a single 86 # backslash so that the call-outs to different environments (DOS/msys/perlticks) work. hopefully. 87 # (The only exception to "always forwardslash" is the contents of the file/s that are created with the 'write' action.) 88 89 #NOTE: [exec] actions should always refer to $dosXXX paths 90 # [shell] actions should always refer to $unixXXX paths 84 #NOTE: ITS IMPORTANT that the PATHS use the correct SLASH-ing method for the type of action: 85 # for [exec] actions, use standard DOS paths, with single BACK-SLASHES '\' (unless in double quotes, then double the backslashes) 86 # for [shell] actions, use standard UNIX paths, with single FORWARD-SLASHES '/' 87 # 88 #NOTE: when refering to variables in paths, try to keep them out of double quotes, or the slashing can get confused: 89 # [exec] actions should always refer to $dosXXX path variables 90 # [shell] actions should always refer to $unixXXX path variables 91 91 # [dir],[file],[mkdirs],[archive] actions should always refer to default perl compatible paths 92 92 93 93 # NOTE: The architecture of this script is based on cause-and-event. 94 94 # There are a number of "causes" (or expectations) that can trigger an event/action. 95 95 # There are a number of different actions that can be taken. 96 96 # 97 # eg: [ dir => "c:/MinGW", exec => $ sources.'MinGW-5.1.3.exe' ],97 # eg: [ dir => "c:/MinGW", exec => $dossources.'MinGW-5.1.3.exe' ], 98 98 # 99 99 # means: expect there to be a dir called "c:/MinGW", and if there isn't execute the file MinGW-5.1.3.exe. 100 100 # (clearly there needs to be a file MinGW-5.1.3.exe on disk for that to work, so there is an earlier declaration to 'fetch' it) … … 105 105 # missing folder [dir] 106 106 # missing source archive (fancy version of 'file' to fetch from the web) [archive] 107 107 # apply a perl pattern match and if it DOESNT match execute the action [grep] - this 'cause' actually needs two parameters in an array [ pattern, file] 108 # test the file/s are totally the same (by size and mtime) [filesame] - if first file is non-existant then that's permitted, it causes the action to trigger. 109 # test the first file is newer(mtime) than the second one [newer] - if given 2 existing files, not necessarily same size/content, and the first one isn't newer, execute the action!. If the first file is ABSENT, run the action too. 108 110 109 111 #build actions (events) are: 110 112 # fetch a file from the web (to a location) [fetch] … … 114 116 # extract a .tar .tar.gz or .tar.bz2 or ,zip file ( to a location) [extract] - (note that .gz and .bz2 are thought equivalent) 115 117 # write a small patch/config/script file directly to disk [write] 116 118 # make directory tree upto the path specified [mkdirs] 119 # copy a new version of a file, set mtime to the original [copy] 120 117 121 #TODO: 118 122 # copy a file or set of files (path/filespec, destination) not-yet-impl. use exec => 'copy /Y xxx yyy' 119 123 # apply a diff not-yet-impl use shell => 'patch -p0 < blah.patch' 120 # search-replace text in a file not-yet-impl 124 # search-replace text in a file not-yet-impl use grep => ['pattern',subject], exec => shell 'patch < etc to replace it' 121 125 122 126 123 127 # NOTES on specific actions: 124 # 'extract' now requires a all paths to be perl compatible (like all other commands) If not supplied, it extracts into the folder the .tar.gz is in. 125 # 'exec' actually runs all your commands inside a bash shell with -c "( cmd;cmd;cmd )" so be careful about quoting. 128 # 'extract' now requires all paths to be perl compatible (like all other commands) If not supplied, it extracts into the folder the .tar.gz is in. 129 # 'exec' actually runs all your commands inside a single cmd.exe command-line. To link commands use '&&' 130 # 'shell' actually runs all your commands inside a bash shell with -c "( cmd;cmd;cmd )" so be careful about quoting. 126 131 127 132 128 133 #------------------------------------------------------------------------------ … … 145 150 [ archive => $sources.'mingw-utils-0.3.tar.gz', 'fetch' => 'http://'.$sourceforge.'/sourceforge/mingw/mingw-utils-0.3.tar.gz' ], 146 151 147 152 148 [ dir => $mingw, exec => $ sources.'MinGW-5.1.3.exe',comment => 'install MinGW (be sure to install g++, g77 and ming make too) - it will require user interaction, but once completed, will return control to us....' ], # interactive, supposed to install g++ and ming make too, but people forget to select them?149 [ file => $mingw."bin/gcc.exe", exec => $ sources.'MinGW-5.1.3.exe',comment => 'unable to gind a gcc.exe where expected, rerunning MinGW installer!' ], # interactive, supposed to install g++ and ming make too, but people forget to select them?153 [ dir => $mingw, exec => $dossources.'MinGW-5.1.3.exe',comment => 'install MinGW (be sure to install g++, g77 and ming make too) - it will require user interaction, but once completed, will return control to us....' ], # interactive, supposed to install g++ and ming make too, but people forget to select them? 154 [ file => $mingw."bin/gcc.exe", exec => $dossources.'MinGW-5.1.3.exe',comment => 'unable to gind a gcc.exe where expected, rerunning MinGW installer!' ], # interactive, supposed to install g++ and ming make too, but people forget to select them? 150 155 151 156 [ archive => $sources.'MSYS-1.0.10.exe', 'fetch' => 'http://'.$sourceforge.'/sourceforge/mingw/MSYS-1.0.10.exe',comment => 'Get the MSYS and addons:' ] , 152 157 [ archive => $sources.'bash-3.1-MSYS-1.0.11-1.tar.bz2', 'fetch' => 'http://'.$sourceforge.'/sourceforge/mingw/bash-3.1-MSYS-1.0.11-1.tar.bz2' ] , … … 154 159 [ archive => $sources.'coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2', 'fetch' => 'http://'.$sourceforge.'/sourceforge/mingw/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2' ] , 155 160 156 161 # install MSYS, it supplies the 'tar' executable, among others: 157 [ file => $msys.'bin/tar.exe', 'exec' => $sources.'MSYS-1.0.10.exe',comment => 'Install MSYS, it supplies the tar executable, among others. You should follow prompts, AND do post-install in DOS box.' ] ,162 [ file => $msys.'bin/tar.exe', exec => $dossources.'MSYS-1.0.10.exe',comment => 'Install MSYS, it supplies the tar executable, among others. You should follow prompts, AND do post-install in DOS box.' ] , 158 163 159 # don't use the [shell] action here, as it's not available until bash is installed! 160 [ file => $msys.'bin/sh2.exe', exec => 'copy /Y '.$dosmsys.'bin/sh.exe '.$dosmsys.'bin/sh2.exe',comment => 'make a copy of the sh.exe so that we can utilise it when we extract later stuff' ], 161 162 # prior to this point you can't use the 'extract' feature, or the 'shell' feature! 164 # don't use the [shell] or [copy] actions here, as neither are available until bash is installed! 165 [ file => $msys.'bin/sh2.exe', exec => 'copy /Y '.$dosmsys.'bin\sh.exe '.$dosmsys.'bin\sh2.exe',comment => 'make a copy of the sh.exe so that we can utilise it when we extract later stuff' ], 163 166 167 # prior to this point you can't use the 'extract' 'copy' or 'shell' features! 164 168 165 169 # if you did a default-install of MingW, then you need to try again, as we really need g++ and mingw32-make, and g77 is needed for fftw 166 [ file => $mingw.'bin/mingw32-make.exe', exec => $ sources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ],167 [ file => $mingw.'bin/g++.exe', exec => $ sources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ],168 [ file => $mingw.'bin/g77.exe', exec => $ sources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ],170 [ file => $mingw.'bin/mingw32-make.exe', exec => $dossources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ], 171 [ file => $mingw.'bin/g++.exe', exec => $dossources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ], 172 [ file => $mingw.'bin/g77.exe', exec => $dossources.'MinGW-5.1.3.exe',comment => 'Seriously? You must have done a default install of MinGW. go try again! You MUST choose the custom installed and select the mingw make, g++ and g77 optional packages.' ], 169 173 170 174 #[ file => 'C:/MinGW/bin/mingw32-make.exe', extract => $sources.'mingw32-make-3.81-2.tar',"C:/MinGW" ], - optionally we could get mingw32-make from here 171 175 … … 183 187 # run it into a 'unzip' folder, becuase it doesn't extract to a folder: 184 188 [ dir => $sources."unzip" , mkdirs => $sources.'unzip',comment => 'unzip.exe - Get a precompiled native Win32 version from InfoZip' ], 185 189 [ archive => $sources.'unzip/unz552xN.exe', fetch => 'ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe'], 186 [ file => $sources.'unzip/unzip.exe', exec => "cd ".$dossources."unzip/ && ".$dossources."unzip/unz552xN.exe "],190 [ file => $sources.'unzip/unzip.exe', exec => 'chdir '.$dossources.'unzip && '.$dossources.'unzip/unz552xN.exe' ], 187 191 # we could probably put the unzip.exe into the path... 188 192 189 193 … … 197 201 [ dir => $sources."zlib" , mkdirs => $sources.'zlib',comment => 'the zlib download is a bit messed-up, and needs some TLC to put everything in the right place' ], 198 202 [ dir => $sources."zlib/usr", extract => [$sources.'zlib-1.2.3-MSYS-1.0.11.tar', $sources."zlib"] ], 199 203 # install to /usr: 200 [ file => $msys.'lib/libz.a', exec => "copy /Y ".$dossources."zlib/usr/lib/* ".$dosmsys."lib/" ],201 [ file => $msys.'bin/msys-z.dll', exec => "copy /Y ".$dossources."zlib/usr/bin/* ".$dosmsys."bin/"],202 [ file => $msys.'include/zlib.h', exec => "copy /Y ".$dossources."zlib/usr/include/* ".$dosmsys."include/"],204 [ file => $msys.'lib/libz.a', exec => ["copy /Y ".$dossources.'zlib\usr\lib\* '.$dosmsys."lib"] ], 205 [ file => $msys.'bin/msys-z.dll', exec => ["copy /Y ".$dossources.'zlib\usr\bin\* '.$dosmsys."bin"] ], 206 [ file => $msys.'include/zlib.h', exec => ["copy /Y ".$dossources.'zlib\usr\include\*', $dosmsys."include"] ], 203 207 # taglib also requires zlib in /mingw , so we'll put it there too, why not! 204 [ file => $msys.'lib/libz.a', exec => "copy /Y ".$dossources."zlib/usr/lib/* ".$dosmingw."lib/" ], 205 [ file => $msys.'bin/msys-z.dll', exec => "copy /Y ".$dossources."zlib/usr/bin/* ".$dosmingw."bin/" ], 206 [ file => $msys.'include/zlib.h', exec => "copy /Y ".$dossources."zlib/usr/include/* ".$dosmingw."include/" ], 208 [ file => $msys.'lib/libz.a', exec => ["copy /Y ".$dossources.'zlib\usr\lib\* '.$dosmingw."lib"] ], 209 [ file => $msys.'bin/msys-z.dll', exec => ["copy /Y ".$dossources.'zlib\usr\bin\*', $dosmingw."bin"] ], 210 [ file => $msys.'include/zlib.h', exec => ["copy /Y ".$dossources.'zlib\usr\include\* '.$dosmingw."include"] ], 211 212 207 213 208 214 # fetch mysql 209 215 # primary server site is: http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.45-win32.msi/from/http://mysql.mirrors.ilisys.com.au/ 210 216 [ archive => $sources.'mysql-essential-5.0.45-win32.msi', 'fetch' => 'http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.0/mysql-essential-5.0.45-win32.msi',comment => 'fetch mysql binaries - this is a big download(23MB) so it might take a while' ], 211 [ file => "c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll", exec => $ sources.'mysql-essential-5.0.45-win32.msi',comment => 'Install mysql - be sure to choose to do a "COMPLETE" install. You should also choose NOT to "configure the server now" ' ],217 [ file => "c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll", exec => $dossources.'mysql-essential-5.0.45-win32.msi',comment => 'Install mysql - be sure to choose to do a "COMPLETE" install. You should also choose NOT to "configure the server now" ' ], 212 218 213 219 # after mysql install 214 [ file => $mingw.'bin/libmySQL.dll', exec => "copy /Y \"c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll\" $dosmingw/bin/",comment => 'post-mysql-install'],215 [ file => $mingw.'lib/libmySQL.dll', exec => "copy /Y \"c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll\" $dosmingw/lib/",comment => 'post-mysql-install'],216 [ file => $mingw.'include/mysql.h', exec => "copy /Y \"c:/Program Files/MySQL/MySQL Server 5.0/include/*\" $dosmingw/include/"],217 [ file => $mingw.' lib/libmysql.lib', exec => "copy /Y \"c:/Program Files/MySQL/MySQL Server 5.0/lib/opt/libmysql.lib\" $dosmingw/lib/" ],220 [ filesame => [$mingw.'bin/libmySQL.dll','c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll'], copy => [''=>'',comment => 'post-mysql-install'] ], 221 [ filesame => [$mingw.'lib/libmySQL.dll','c:/Program Files/MySQL/MySQL Server 5.0/bin/libmySQL.dll'], copy => [''=>'',comment => 'post-mysql-install'] ], 222 [ filesame => [$mingw.'lib/libmysql.lib','c:/Program Files/MySQL/MySQL Server 5.0/lib/opt/libmysql.lib'], copy => [''=>''] ], 223 [ file => $mingw.'include/mysql.h' , exec => 'copy /Y "c:\Program Files\MySQL\MySQL Server 5.0\include\*" '.$dosmingw."include" ], 218 224 # cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/include/* /c/MinGW/include/ 219 225 # cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/bin/libmySQL.dll /c/MinGW/lib 220 226 # cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/lib/opt/libmysql.lib /c/MinGW/lib 221 227 222 # 223 # TIP: we use a special file (with an extra _ ) as a marker to do this action every the time, it's harmless to do it more often that required. "nocheck" means continue even if the cause doesn't exist after. 224 [ file => $mingw.'lib/libmysql.lib__', shell => ["cd $unixmingw/lib","reimp -d libmysql.lib","dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a","nocheck"],comment => ' rebuild libmysql.a' ], 225 228 # 229 # TIP: we use a special file (with an extra _ ) as a marker to do this action every the time, it's harmless to do it more often that required. 'nocheck' means continue even if the cause doesn't exist after. 230 [ file => $mingw.'lib/libmysql.lib__', shell => ["cd /mingw/lib","reimp -d libmysql.lib","dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a",'nocheck'],comment => ' rebuild libmysql.a' ], 226 231 227 232 228 233 # grep => [pattern,file] , actions/etc 229 [ file => $mingw.'include/mysql__h.patch', write => [$mingw.'include/mysql__h.patch', 230 '*** orig_mysql.h Fri Jul 6 13:24:56 2007 231 *** mysql.h_orig Fri Jan 4 19:35:33 2008 232 --- mysql.h Fri Jan 4 16:45:46 2008 233 *************** 234 *** 45,51 **** 235 #include <winsock.h> /* For windows */ 236 #endif 237 typedef char my_bool; 238 ! #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) 239 #define __WIN__ 240 #endif 241 #if !defined(__WIN__) 242 --- 45,51 ---- 243 #include <winsock.h> /* For windows */ 244 #endif 245 typedef char my_bool; 246 ! #if (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__)) && !defined(__WIN__) 247 #define __WIN__ 248 #endif 249 #if !defined(__WIN__) 250 ' ],comment => 'write the patch to the the mysql.h file'], 234 [ file => $mingw.'include/mysql___h.patch', write => [$mingw.'include/mysql___h.patch', 235 '--- mysql.h_orig Fri Jan 4 19:35:33 2008 236 +++ mysql.h Tue Jan 8 14:48:36 2008 237 @@ -41,11 +41,9 @@ 238 239 #ifndef _global_h /* If not standard header */ 240 #include <sys/types.h> 241 -#ifdef __LCC__ 242 #include <winsock.h> /* For windows */ 243 -#endif 244 typedef char my_bool; 245 -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) 246 +#if (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__)) && !defined(__WIN__) 247 #define __WIN__ 248 #endif 249 #if !defined(__WIN__) 250 251 ' ],comment => 'write the patch for the the mysql.h file'], 251 252 252 253 253 [ grep => ['\|\| defined\(__MINGW32__\)',$mingw.'include/mysql.h'], shell => ["cd $unixmingw/include","patch -p0 < mysql__h.patch"],comment => 'Apply mysql.h patch file, if not already applied....' ],254 [ grep => ['\|\| defined\(__MINGW32__\)',$mingw.'include/mysql.h'], shell => ["cd /mingw/include","patch -p0 < mysql___h.patch"],comment => 'Apply mysql.h patch file, if not already applied....' ], 254 255 255 256 256 257 # fetch it 257 258 [ dir => $sources.'pthread', mkdirs => $sources.'pthread' ], 258 259 [ archive => $sources.'pthread/libpthread.a', 'fetch' => 'ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/libpthreadGC2.a',comment => 'libpthread is precompiled, we just download it to the right place ' ], 259 260 [ archive => $sources.'pthread/pthreadGC2.dll', 'fetch' => 'ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/pthreadGC2.dll' ], 260 [ file => $sources.'pthread/pthread.dll', exec => "copy /Y ".$sources."pthread/pthreadGC2.dll ".$sources."pthread/pthread.dll"],261 [ filesame => [$sources.'pthread/pthread.dll',$sources."pthread/pthreadGC2.dll"], copy => [''=>''] ], 261 262 [ archive => $sources.'pthread/pthread.h', 'fetch' => 'ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/pthread.h' ], 262 263 [ archive => $sources.'pthread/sched.h', 'fetch' => 'ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/sched.h' ], 263 264 [ archive => $sources.'pthread/semaphore.h', 'fetch' => 'ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/semaphore.h' ], 264 265 # install it: 265 [ file => $mingw.'lib/libpthread.a', exec => "copy /Y ".$dossources."pthread/libpthread.a ".$dosmingw.'lib/libpthread.a',comment => 'install pthread' ], 266 [ file => $mingw.'bin/pthreadGC2.dll', exec => "copy /Y ".$dossources."pthread/pthreadGC2.dll ".$dosmingw.'bin/pthreadGC2.dll' ], 267 [ file => $mingw.'bin/pthread.dll', exec => "copy /Y ".$dossources."pthread/pthread.dll ".$dosmingw.'bin/pthread.dll' ], 268 [ file => $mingw.'include/pthread.h', exec => "copy /Y ".$dossources."pthread/pthread.h ".$dosmingw.'include/pthread.h' ], 269 [ file => $mingw.'include/sched.h', exec => "copy /Y ".$dossources."pthread/sched.h ".$dosmingw.'include/sched.h' ], 270 [ file => $mingw.'include/semaphore.h', exec => "copy /Y ".$dossources."pthread/semaphore.h ".$dosmingw.'include/semaphore.h' ], 271 272 273 ## download the MS directX SDK 274 ## believe it or not, the above exe(dxsdk_november2007.exe) is actually just a zip archive(containing dxsdk_nov2007.exe) with 275 ## a "read the licence and click OK to unzip", so we just unzip it with a few magic incantations of command lines: 276 ## and the contents (dxsdk_nov2007.exe) is actually just a zip file too, so we unzip it (again) in a subfolder. finally, the files! 277 #[ archive => $sources.'dxsdk_november2007.exe','fetch' => 'http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=4b78a58a-e672-4b83-a28e-72b5e93bd60a&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fb%2fe%2f7%2fbe7ffe34-903c-410b-bdbc-ee6c018df45c%2fdxsdk_november2007.exe' ], 278 #[ dir => $sources."dxsdk/", mkdirs => $sources.'dxsdk' ], 279 ## command to extract this .zip file to a folder (this outer wrapper is NOT unzip.exe compatible!): 280 #[ file => $sources."dxsdk/dxsdk_nov2007.exe", exec => $dossources."dxsdk_november2007.exe /C /Q /T:".$dossources."dxsdk" ], 281 ## extract this - it's a "winzip self extracter" - which IS "unzip.exe compatible" 282 #[ file => $sources."dxsdk/Include/dsound.h", exec => "cd ".$dossources."dxsdk/ && ".$dossources."unzip/unzip.exe dxsdk_nov2007.exe" ], 283 ## relocate the dxsdk header files to the folder : 284 ## put ddraw.h dinput.h dsound.h into C:\MinGW\Include 285 #[ file => $mingw.'include/dsound.h', exec => "copy /Y ".$dossources."dxsdk/Include/dsound.h $dosmingw/include/dsound.h" ], 286 #[ file => $mingw.'include/dinput.h', exec => "copy /Y ".$dossources."dxsdk/Include/dinput.h $dosmingw/include/dinput.h" ], 287 #[ file => $mingw.'include/ddraw.h', exec => "copy /Y ".$dossources."dxsdk/Include/ddraw.h $dosmingw/include/ddraw.h" ], 288 ## not sure if we need this too, but it doesn't hurt: 289 #[ file => $mingw.'include/dsetup.h', exec => "copy /Y ".$dossources."dxsdk/Include/dsetup.h $dosmingw/include/dsetup.h" ], 266 [ filesame => [$mingw.'lib/libpthread.a', $sources."pthread/libpthread.a"], copy => [''=>'',comment => 'install pthread'] ], 267 [ filesame => [$mingw.'bin/pthreadGC2.dll', $sources."pthread/pthreadGC2.dll"], copy => [''=>''] ], 268 [ filesame => [$mingw.'bin/pthread.dll', $sources."pthread/pthread.dll"], copy => [''=>''] ], 269 [ filesame => [$mingw.'include/pthread.h', $sources."pthread/pthread.h"], copy => [''=>''] ], 270 [ filesame => [$mingw.'include/sched.h', $sources."pthread/sched.h"], copy => [''=>''] ], 271 [ filesame => [$mingw.'include/semaphore.h',$sources."pthread/semaphore.h"], copy => [''=>''] ], 272 290 273 291 274 # ( save bandwidth compare to the above full SDK where they came from: 292 275 [ archive => $sources.'DX9SDK_dsound_Include_subset.zip', 'fetch' => 'http://davidbuzz.googlepages.com/DX9SDK_dsound_Include_subset.zip',comment => 'We download just the required Include files for DX9' ], 293 276 [ dir => $sources.'DX9SDK_dsound_Include_subset', extract => $sources.'DX9SDK_dsound_Include_subset.zip' ], 294 [ file => $mingw.'include/dsound.h', exec => "copy /Y ".$dossources."DX9SDK_dsound_Include_subset/dsound.h ".$dosmingw."include/dsound.h" ], 295 [ file => $mingw.'include/dinput.h', exec => "copy /Y ".$dossources."DX9SDK_dsound_Include_subset/dinput.h ".$dosmingw."include/dinput.h" ], 296 [ file => $mingw.'include/ddraw.h', exec => "copy /Y ".$dossources."DX9SDK_dsound_Include_subset/ddraw.h ".$dosmingw."include/ddraw.h" ], 297 [ file => $mingw.'include/dsetup.h', exec => "copy /Y ".$dossources."DX9SDK_dsound_Include_subset/dsetup.h ".$dosmingw."include/dsetup.h" ], 298 277 [ filesame => [$mingw.'include/dsound.h',$sources."DX9SDK_dsound_Include_subset/dsound.h"], copy => [''=>''] ], 278 [ filesame => [$mingw.'include/dinput.h',$sources."DX9SDK_dsound_Include_subset/dinput.h"], copy => [''=>''] ], 279 [ filesame => [$mingw.'include/ddraw.h', $sources."DX9SDK_dsound_Include_subset/ddraw.h"], copy => [''=>''] ], 280 [ filesame => [$mingw.'include/dsetup.h',$sources."DX9SDK_dsound_Include_subset/dsetup.h"], copy => [''=>''] ], 299 281 300 282 301 283 #---------------------------------------- … … 308 290 [ archive => $sources.'freetype-2.3.5.tar.gz', fetch => 'http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.5.tar.gz'], 309 291 [ dir => $sources.'freetype-2.3.5', extract => $sources.'freetype-2.3.5.tar' ], 310 292 # caution... freetype comes with a Makefile in the .tar.gz, so work around it! 311 [ file => $sources.'freetype-2.3.5/Makefile_', shell => ["cd $unixsources/freetype-2.3.5","./configure --prefix=/mingw","make","make install","touch $unixsources/freetype-2.3.5/Makefile_"] ], 293 [ file => $sources.'freetype-2.3.5/Makefile_', shell => ["cd $unixsources/freetype-2.3.5","./configure --prefix=/mingw","touch $unixsources/freetype-2.3.5/Makefile_"] ], 294 # here's an example of specifying the make and make install steps separately, for apps that can't be relied on to have the make step work! 295 [ file => $sources.'freetype-2.3.5/objs/.libs/libfreetype.a', shell => ["cd $unixsources/freetype-2.3.5","make"] ], 296 [ file => $mingw.'lib/libfreetype.a', shell => ["cd $unixsources/freetype-2.3.5","make install"] ], 312 297 313 298 314 299 [ archive => $sources.'lame-3.97.tar.gz', fetch => 'http://'.$sourceforge.'/sourceforge/lame/lame-3.97.tar.gz'], 315 300 [ dir => $sources.'lame-3.97', extract => $sources.'lame-3.97.tar' ], 316 [ file => $sources.'lame-3.97/Makefile', shell => ["cd $unixsources/lame-3.97","./configure --prefix= $unixmingw","make","make install"] ],301 [ file => $sources.'lame-3.97/Makefile', shell => ["cd $unixsources/lame-3.97","./configure --prefix=/mingw","make","make install"] ], 317 302 318 303 [ archive => $sources.'libmad-0.15.1b.tar.gz', fetch => 'http://'.$sourceforge.'/sourceforge/mad/libmad-0.15.1b.tar.gz'], 319 304 [ dir => $sources.'libmad-0.15.1b', extract => $sources.'libmad-0.15.1b.tar' ], … … 387 372 [ archive => $sources.'qt-3.3.x-p8.tar.bz2', fetch => 'http://'.$sourceforge.'/sourceforge/qtwin/qt-3.3.x-p8.tar.bz2'], 388 373 [ dir => $msys.'qt-3.3.x-p8', extract => [$sources.'qt-3.3.x-p8.tar', $msys] ], 389 374 390 #391 392 375 # two older patches 393 376 #[ archive => 'qt.patch.gz' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4270/qt.patch.gz'], 394 377 #[ archive => 'qt2.patch' , 'fetch' => 'http://tanas.ca/qt2.patch'], 395 378 # OR: 396 379 # equivalent patch: 397 380 [ archive => $sources.'qt.patch' , 'fetch' => 'http://tanas.ca/qt.patch',comment => ' patch the QT sources'], 398 [ file => $msys.'qt-3.3.x-p8/qt.patch', exec => "copy /Y ".$dossources."qt.patch ".$msys."qt-3.3.x-p8"],381 [ filesame => [$msys.'qt-3.3.x-p8/qt.patch',$sources."qt.patch"], copy => [''=>''] ], 399 382 [ grep => ["\-lws2_32", $msys.'qt-3.3.x-p8/mkspecs/win32-g++/qmake.conf'], shell => ["cd ".$unixmsys."qt-3.3.x-p8/","patch -p1 < qt.patch"] ], 400 383 401 384 402 385 [ file => $msys.'bin/sh_.exe', shell => ["mv ".$unixmsys."bin/sh.exe ".$unixmsys."bin/sh_.exe"],comment => 'rename msys sh.exe out of the way before building QT! ' ] , 403 386 404 # write a batch script to build the QT sources here:405 # the double slashes in the paths here are because this string is in double quotes (the variables need interpolating, so the slashes geet it too) 406 [ file => $msys.'qt-3.3.x-p8/qtsetup.bat', write => [$msys.'qt-3.3.x-p8/qtsetup.bat', 407 'set QTDIR='.$dosmsys.'qt-3.3.x-p8387 # write a batch script for the QT environment under DOS: 388 [ file => $msys.'qt-3.3.x-p8/qt_env.bat', write => [$msys.'qt-3.3.x-p8/qt_env.bat', 389 'rem a batch script for the QT environment under DOS: 390 set QTDIR='.$dosmsys.'qt-3.3.x-p8 408 391 set MINGW='.$dosmingw.' 409 392 set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH% 410 393 set QMAKESPEC=win32-g++ 411 394 cd %QTDIR% 412 rem rename '.$dosmsys.'bin\sh.exe sh_.exe 413 configure.bat -thread -plugin-sql-mysql -opengl -no-sql-sqlite 414 mingw32-make 415 mingw32-make install 416 rem rename '.$dosmsys.'bin\sh_.exe sh.exe 417 ']], 395 ' 396 ],comment=>'write a batch script for the QT environment under DOS'], 397 398 399 [ file => $msys.'qt-3.3.x-p8/lib/libqt-mt3.dll', exec => $dosmsys.'qt-3.3.x-p8\qt_env.bat && configure.bat -thread -plugin-sql-mysql -opengl -no-sql-sqlite',comment => 'Execute qt_env.bat && the configure command to actually build QT now! - ie configures qt and also makes it, hopefully! WARNING SLOW (MAY TAKE HOURS!)' ], 400 401 [ filesame => [$msys.'qt-3.3.x-p8/bin/libqt-mt3.dll',$msys.'qt-3.3.x-p8/lib/libqt-mt3.dll'], copy => [''=>''], comment => 'is there a libqt-mt3.dll in the "lib" folder of QT? if so, copy it to the the "bin" folder for uic.exe to use!' ], 418 402 403 # did the configure finish? - run mingw32-make to get it to finish properly. 404 # HINT: the very last file built in a successful QT build env is the C:\msys\1.0\qt-3.3.x-p8\examples\xml\tagreader-with-features\tagreader-with-features.exe 405 [ file => $msys.'qt-3.3.x-p8/examples/xml/tagreader-with-features/tagreader-with-features.exe', exec => $dosmsys.'qt-3.3.x-p8\qt_env.bat && mingw32-make',comment => 'we try to finish the build of QT with mingw32-make, incase it was just a build dependancy issue? WARNING SLOW (MAY TAKE HOURS!)' ], 419 406 420 [ file => $msys.'qt-3.3.x-p8/lib/libqt-mt3.dll', exec => $dosmsys.'qt-3.3.x-p8/qtsetup.bat',comment => 'Execute qtsetup.bat script to actually build QT now! ' ], 407 # TODO - do we have an action we can take to build just this one file/dll if it fails? 408 # For now, we will just test if it built, and abort if it didn't! 409 [ file => $msys.'qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll', exec => '', comment => 'lib\libqsqlmysql.dll - here we are just validating some basics of the the QT install, and if any of these components are missing, the build must have failed ( is the sql driver built properly?) '], 410 [ file => $msys.'qt-3.3.x-p8/bin/qmake.exe', exec => '', comment => 'bin\qmake.exe - here we are just validating some basics of the the QT install, and if any of these components are missing, the build must have failed'], 411 [ file => $msys.'qt-3.3.x-p8/bin/moc.exe', exec => '', comment => 'bin\moc.exe - here we are just validating some basics of the the QT install, and if any of these components are missing, the build must have failed'], 412 [ file => $msys.'qt-3.3.x-p8/bin/uic.exe', exec => '', comment => 'bin\uic.exe - here we are just validating some basics of the the QT install, and if any of these components are missing, the build must have failed'], 413 414 415 # TODO "make install" qt - where to?, will this work? (not sure, it sometimes might, but it's not critical?) 416 #[ file => $msys.'qt-3.3.x-p8/lib/libqt-mt3.dll', exec => $dosmsys.'qt-3.3.x-p8\qt_env.bat && mingw32-make install',comment => 'install QT' ], 417 # a manual method for "installing" QT would be to put all the 'bin' files into /mingw/bin and similarly for the 'lib' and 'include' folders to their respective mingw folders?: 421 418 422 419 423 420 # (back to sh.exe ) now that we are done ! 424 421 [ file => $msys.'bin/sh.exe', shell => ["mv ".$unixmsys."bin/sh_.exe ".$unixmsys."bin/sh.exe"],comment => 'rename msys sh_.exe back again!' ] , 425 422 426 #Copy libqt-mt3.dll to libqt-mt.dll - but always do it(nocheck), or we could be using an old version:427 [ file => $msys.'qt-3.3.x-p8/lib/libqt-mt.dll', shell => ["cp ".$unixmsys."qt-3.3.x-p8/lib/libqt-mt3.dll ".$unixmsys."qt-3.3.x-p8/lib/libqt-mt.dll","nocheck"],comment => 'Copy libqt-mt3.dll to libqt-mt.dll' ] ,423 #Copy libqt-mt3.dll to libqt-mt.dll , if there is any date/size change! 424 [ filesame => [$msys.'qt-3.3.x-p8/lib/libqt-mt.dll',$msys.'qt-3.3.x-p8/lib/libqt-mt3.dll'], copy => [''=>''],comment => 'Copy libqt-mt3.dll to libqt-mt.dll' ] , 428 425 429 426 430 427 #---------------------------------------- … … 434 431 [ dir => $mythtv.'mythtv', mkdirs => $mythtv.'mythtv' ], 435 432 436 433 437 [ file => $mythtv.'svn_', shell => ["rm ".$unixmythtv."using_proxy_cannot_do_SVN.txt; if [ -n '$proxy' ] ; then touch ".$unixmythtv."using_proxy_cannot_do_SVN.txt; fi", "nocheck"],comment => 'disable SVN code fetching if we are using a proxy....' ],434 [ file => $mythtv.'svn_', shell => ["rm ".$unixmythtv."using_proxy_cannot_do_SVN.txt; if [ -n '$proxy' ] ; then touch ".$unixmythtv."using_proxy_cannot_do_SVN.txt; fi",'nocheck'],comment => 'disable SVN code fetching if we are using a proxy....' ], 438 435 439 436 # if we dont have the sources at all, get them all from SVN! (do a checkout, but only if we don't already have the .pro file as a sign of an earlier checkout) 440 437 # this is some nasty in-line batch-script code, but it works. … … 442 439 # mythtv,mythplugins,myththemes 443 440 foreach my $comp( @components ) { 444 441 push @{$expect}, 445 [ file => $mythtv.'using_proxy_cannot_do_SVN.txt', exec => ['set PATH='.$dosmsys.'bin;%PATH% && cd '.$dosmythtv.' && IF NOT EXIST '.$dosmythtv.'mythtv /mythtv.pro svn checkout http://svn.mythtv.org/svn/trunk/'."$comp $comp","nocheck"],comment => 'Get all the mythtv sources from SVN!:'.$comp ];442 [ file => $mythtv.'using_proxy_cannot_do_SVN.txt', exec => ['set PATH='.$dosmsys.'bin;%PATH% && cd '.$dosmythtv.' && IF NOT EXIST '.$dosmythtv.'mythtv\mythtv.pro svn checkout http://svn.mythtv.org/svn/trunk/'."$comp $comp",'nocheck'],comment => 'Get all the mythtv sources from SVN!:'.$comp ]; 446 443 } 447 444 push @{$expect}, 448 445 # now lets write some build scripts to help with mythtv itself … … 455 452 export PATH=$QTDIR/bin:$PATH 456 453 ' ],comment => 'write a script that we can source later when inside msys to setup the environment variables'], 457 454 458 # 459 [ file => $mythtv.'make_run.sh', write => [$mythtv.'make_run.sh', 460 '#!/bin/bash 461 source '.$unixmythtv.'qt_env.sh 462 cd '.$unixmythtv.'/mythtv 463 # keep around just one earlier verion in run_old: 464 rm -rf run_old 465 mv run run_old 466 mkdir run 467 # copy exes and dlls to the run folder: 468 find . -name \\*.exe | xargs -n1 -i__ cp __ ./run/ 469 find . -name \\*.dll | xargs -n1 -i__ cp __ ./run/ 470 # mythtv expects the dll to NOT have the 3 in it. 471 cp '.$unixmsys.'qt-3.3.x-p8/lib/libqt-mt3.dll '.$unixmsys.'qt-3.3.x-p8/lib/libqt-mt.dll 472 # mythtv needs the qt dlls at runtime: 473 cp '.$unixmsys.'qt-3.3.x-p8/lib/*.dll '.$unixmythtv.'mythtv/run 474 # qt mysql connection dll has to exist in a subfolder called sqldrivers: 475 mkdir '.$unixmythtv.'mythtv/run/sqldrivers 476 cp '.$unixmsys.'qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll '.$unixmythtv.'mythtv/run/sqldrivers 477 # pthread dlls and mingwm10.dll are copied from here: 478 cp '.$unixmingw.'bin/*.dll '.$unixmythtv.'mythtv/run 479 ' ],comment => 'script that will copy all the files necessary for running mythtv out of the build folder into the ./run folder'], 480 481 # 482 [ file => $mythtv.'build_myth.sh', write => [$mythtv.'build_myth.sh', 483 '#!/bin/bash 484 source '.$unixmythtv.'qt_env.sh 485 cd '.$unixmythtv.'mythtv 486 make clean 487 make distclean 488 touch '.$unixmythtv.'mythtv/config/config.pro 489 ./configure --prefix=/usr --disable-dbox2 --disable-hdhomerun --disable-dvb --disable-ivtv --disable-iptv --disable-joystick-menu --disable-xvmc-vld --disable-x11 --disable-xvmc --enable-directx --enable-memalign-hack --cpu=k8 --compile-type=debug && make && make install 490 #make 491 #make install 492 #cd .. 493 ' ],comment => 'write a script to build main mythtv'], 455 ## 456 #[ file => $mythtv.'make_run.sh', write => [$mythtv.'make_run.sh', 457 #'#!/bin/bash 458 #source '.$unixmythtv.'qt_env.sh 459 #cd '.$unixmythtv.'/mythtv 460 ## keep around just one earlier verion in run_old: 461 #rm -rf run_old 462 #mv run run_old 463 #mkdir run 464 ## copy exes and dlls to the run folder: 465 #find . -name \\*.exe | grep -v run | xargs -n1 -i__ cp __ ./run/ 466 #find . -name \\*.dll | grep -v run | xargs -n1 -i__ cp __ ./run/ 467 ## mythtv needs the qt dlls at runtime: 468 #cp '.$unixmsys.'qt-3.3.x-p8/lib/*.dll '.$unixmythtv.'mythtv/run 469 ## qt mysql connection dll has to exist in a subfolder called sqldrivers: 470 #mkdir '.$unixmythtv.'mythtv/run/sqldrivers 471 #cp '.$unixmsys.'qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll '.$unixmythtv.'mythtv/run/sqldrivers 472 ## pthread dlls and mingwm10.dll are copied from here: 473 #cp /mingw/bin/*.dll '.$unixmythtv.'mythtv/run 474 #' ],comment => 'script that will copy all the files necessary for running mythtv out of the build folder into the ./run folder'], 494 475 495 476 # 496 477 [ file => $mythtv.'build_plugins.sh', write => [$mythtv.'build_plugins.sh', … … 503 484 ' ],comment => 'write a script to build mythtv plugins'], 504 485 505 486 # chmod the shell scripts, everytime 506 [ file => $mythtv.'_' , shell => ["cd $mythtv","chmod 755 *.sh", "nocheck"] ],487 [ file => $mythtv.'_' , shell => ["cd $mythtv","chmod 755 *.sh",'nocheck'] ], 507 488 508 489 #---------------------------------------- 509 490 # now we build mythtv! … … 512 493 # SVN update every time, before patches, unless we are using a proxy 513 494 foreach my $comp( @components ) { 514 495 push @{$expect}, 515 [ file => $mythtv.'using_proxy_cannot_do_SVN.txt', exec => [ "cd ".$dosmythtv."$comp && ".$dosmsys."bin/svn.exe update","nocheck"],comment => 'getting SVN updates for:'.$comp ],496 [ file => $mythtv.'using_proxy_cannot_do_SVN.txt', exec => ['cd '.$dosmythtv."$comp && ".$dosmsys.'bin\svn.exe update','nocheck'],comment => 'getting SVN updates for:'.$comp ], 516 497 } 517 498 push @{$expect}, 518 499 … … 520 501 # apply any outstanding win32 patches - this section will be hard to keep upwith HEAD/SVN: 521 502 522 503 #fixed/closed: 523 524 #4390 - stuff 525 #[ archive => $sources.'videoout_embedding.patch' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4390/videoout_embedding.patch'], 526 #[ file => $mythtv.'mythtv/videoout_embedding.patch', exec => "copy /Y $sources/videoout_embedding.patch $mythtv/mythtv/" ], 527 #[ file => $mythtv.'mythtv/videoout_embedding.patch_', shell => ["cd /c/mythtv/mythtv/","patch -p0 < videoout_embedding.patch","touch videoout_embedding.patch_"] ], 528 529 # in SVN at 7th Jan 2008 530 #[ archive => $sources.'setup.patch' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4391/setup.patch'], 531 #[ file => $mythtv.'mythtv/setup.patch', exec => "copy /Y ".$dossources."setup.patch ".$dosmythtv."mythtv",comment => '4391: - configgroups patch' ], 532 #[ grep => ['children\[i\] \&\& children\[i\]->isVisible\(\)',$mythtv.'mythtv/libs/libmyth/mythconfiggroups.cpp'], shell => ["cd ".$unixmythtv."mythtv/","patch -p0 < setup.patch"] ], 533 534 ## 535 536 # in SVN at 7th Jan 2008 537 #[ archive => $sources.'mythwelcome.patch' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4409/mythwelcome.patch'], 538 #[ file => $mythtv.'mythtv/mythwelcome.patch', exec => "copy /Y ".$dossources."mythwelcome.patch ".$dosmythtv."mythtv",comment => '4409 mythwelcome patch: (MinGW SIGHUP undefined)' ], 539 #[ grep => ['\#include \"libmyth\/compat\.h\"',$mythtv.'mythtv/programs/mythwelcome/main.cpp'], shell => ["cd ".$unixmythtv."mythtv/","patch -p0 < mythwelcome.patch"] ], 540 541 # no longer required as at [15335] - 7th jan 2008 542 #[ archive => $sources.'themereload_win32.patch' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4411/themereload_win32.patch'], 543 #[ file => $mythtv.'mythtv/themereload_win32.patch', exec => "copy /Y ".$dossources."themereload_win32.patch ".$dosmythtv."mythtv",comment => '4411 changeset 15290 is incompatible with Win32' ], 544 #[ grep => ['\#ifndef _WIN32',$mythtv.'mythtv/programs/mythfrontend/main.cpp'], shell => ["cd ".$unixmythtv."mythtv/","patch -p0 < themereload_win32.patch"] ], 545 546 # in SVN at 7th Jan 2008 547 #[ archive => $sources.'dlerr.win.patch' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4422/dlerr.win.patch'], 548 #[ file => $mythtv.'mythtv/dlerr.win.patch', exec => "copy /Y ".$dossources."dlerr.win.patch ".$dosmythtv."mythtv",comment => '4422 fixes error: "call of overloaded QString(DWORD) is ambiguous" ' ], 549 #[ grep => ['inline const char \*dlerror(void)',$mythtv.'mythtv/libs/libmyth/compat.h'], shell => ["cd ".$unixmythtv."mythtv/","patch -p0 < dlerr.win.patch"] ], 550 551 552 [ archive => $sources.'backend.patch.gz' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4392/backend.patch.gz'], 553 [ file => $mythtv.'mythtv/backend.patch.gz', exec => "copy /Y ".$dossources."backend.patch.gz ".$dosmythtv."mythtv",comment => '4392: - backend connections being accepted patch ' ], 504 [ archive => $sources.'backend.patch.gz' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/4392/backend.patch.gz', comment => 'backend.patch.gz - apply any outstanding win32 patches - this section will be hard to keep upwith HEAD/SVN'], 505 [ filesame => [$mythtv.'mythtv/backend.patch.gz',$sources."backend.patch.gz"], copy => [''=>'',comment => '4392: - backend connections being accepted patch '] ], 554 506 [ grep => ['unsigned\* Indexes = new unsigned\[n\]\;',$mythtv.'mythtv/libs/libmyth/mythsocket.cpp'], shell => ["cd ".$unixmythtv."mythtv/","gunzip -f backend.patch.gz","patch -p0 < backend.patch"] ], 555 507 556 508 557 [ archive => $sources.'importicons_windows_2.diff' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/3334/importicons_windows_2.diff' ],558 [ file => $mythtv.'mythtv/importicons_windows_2.diff', exec => "copy /Y ".$dossources."importicons_windows_2.diff ".$dosmythtv."mythtv",comment => '3334 fixes error with mkdir() unknown. '],509 [ archive => $sources.'importicons_windows_2.diff' , 'fetch' => 'http://svn.mythtv.org/trac/raw-attachment/ticket/3334/importicons_windows_2.diff', comment => 'importicons_windows_2.diff - apply any outstanding win32 patches - this section will be hard to keep upwith HEAD/SVN'], 510 [ filesame => [$mythtv.'mythtv/importicons_windows_2.diff',$sources."importicons_windows_2.diff"], copy => [''=>'',comment => '3334 fixes error with mkdir() unknown.'] ], 559 511 [ grep => ['\#include <qdir\.h>',$mythtv.'mythtv/libs/libmythtv/importicons.cpp'], shell => ["cd ".$unixmythtv."mythtv/","patch -p0 < importicons_windows_2.diff"] ], 560 512 513 514 [ file => $mythtv.'mythtv/config/config.pro', shell => ['touch '.$unixmythtv.'mythtv/config/config.pro'], comment => 'create an empty config.pro or the mythtv build will fail'], 515 561 516 # next the build process: 517 # the old way: 518 #[ file => $mythtv.'no_rebuild_mythtv.txt', shell => ["cd ".$unixmythtv,'./build_myth.sh','touch no_rebuild_mythtv.txt'],comment => 'execute the mythtv build script (we wrote it earlier), unless its already been built once before ( ie the no_rebuild_mythtv.txt file exists! )' ], 519 520 # the new way, with a bit better dependancy resolution: 521 # total cleanup: 522 #[ file => $mythtv.'mythtv/Makefile', shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make distclean','nocheck'], comment => 'do a "make clean" first? not strictly necessary, and the build will be MUCH faster without it, but it is safer with it...'], 523 # minor cleanup (keep the configuration) 524 #[ file => $mythtv.'mythtv/Makefile', shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make clean','make distclean','nocheck'], comment => 'do a "make clean" first? not strictly necessary, and the build will be MUCH faster without it, but it is safer with it...'], 525 # config 526 [ file => $mythtv.'mythtv/Makefile', shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','./configure --prefix=/usr --disable-dbox2 --disable-hdhomerun --disable-dvb --disable-ivtv --disable-iptv --disable-joystick-menu --disable-xvmc-vld --disable-x11 --disable-xvmc --enable-directx --enable-memalign-hack --cpu=k8 --compile-type=debug'], comment => 'do we already have a Makefile for mythtv?' ], 527 # make 528 [ newer => [$mythtv.'mythtv/libs/libmyth/libmyth-0.20.dll',$mythtv.'mythtv/Makefile'], shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make'], comment => 'libs/libmyth/libmyth-0.20.dll - redo make unless all these files exist, and are newer than the Makefile' ], 529 [ newer => [$mythtv.'mythtv/libs/libmythtv/libmythtv-0.20.dll',$mythtv.'mythtv/Makefile'], shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make'], comment => 'libs/libmythtv/libmythtv-0.20.dll - redo make unless all these files exist, and are newer than the Makefile' ], 530 [ newer => [$mythtv.'mythtv/programs/mythfrontend/mythfrontend.exe',$mythtv.'mythtv/Makefile'], shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make'], comment => 'programs/mythfrontend/mythfrontend.exe - redo make unless all these files exist, and are newer than the Makefile' ], 531 [ newer => [$mythtv.'mythtv/programs/mythbackend/mythbackend.exe',$mythtv.'mythtv/Makefile'], shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make'], comment => 'programs/mythbackend/mythbackend.exe - redo make unless all these files exist, and are newer than the Makefile' ], 532 533 # re-install to msys /usr/bin folders etc, if we have a newer mythtv build ready: 534 [ newer => [$msys.'bin/mythfrontend.exe',$mythtv.'mythtv/programs/mythfrontend/mythfrontend.exe'], shell => ['source '.$unixmythtv.'qt_env.sh','cd '.$unixmythtv.'mythtv','make install'], comment => 'was the last configure successful? then install mythtv ' ], 535 536 # install some themes? does a 'make install' do that adequately (no, not if running outside msys)? 537 538 562 539 # 563 [ file => $mythtv.'no_rebuild_mythtv.txt', shell => ["cd ".$unixmythtv,'./build_myth.sh','touch no_rebuild_mythtv.txt'],comment => 'execute the mythtv build script (we wrote it earlier), unless its already been built once before ( ie the no_rebuild_mythtv.txt file exists! )' ], 540 [ file => $mythtv.'make_run.sh_', write => [$mythtv.'make_run.sh', 541 '#!/bin/bash 542 source '.$unixmythtv.'qt_env.sh 543 cd '.$unixmythtv.'mythtv 544 # keep around just one earlier verion in run_old: 545 rm -rf run_old 546 mv run run_old 547 mkdir run 548 # copy exes and dlls to the run folder: 549 find . -name \\*.exe | grep -v run | xargs -n1 -i__ cp __ ./run/ 550 find . -name \\*.dll | grep -v run | xargs -n1 -i__ cp __ ./run/ 551 # mythtv needs the qt dlls at runtime: 552 cp '.$unixmsys.'qt-3.3.x-p8/lib/*.dll '.$unixmythtv.'mythtv/run 553 # qt mysql connection dll has to exist in a subfolder called sqldrivers: 554 mkdir '.$unixmythtv.'mythtv/run/sqldrivers 555 cp '.$unixmsys.'qt-3.3.x-p8/plugins/sqldrivers/libqsqlmysql.dll '.$unixmythtv.'mythtv/run/sqldrivers 556 # pthread dlls and mingwm10.dll are copied from here: 557 cp /mingw/bin/*.dll '.$unixmythtv.'mythtv/run 558 ','nocheck' 559 ],comment => 'write a script that will copy all the files necessary for running mythtv out of the build folder into the ./run folder'], 560 561 562 [ newer => [$mythtv.'mythtv/run/mythfrontend.exe',$mythtv.'mythtv/programs/mythfrontend/mythfrontend.exe'], shell => [$unixmythtv.'make_run.sh'], comment => 'create a natively runnable version: with the make_run.sh script' ], 563 564 # create the mysql.txt file at: %HOMEPATH%\.mythtv\mysql.txt 565 [ file => $ENV{HOMEPATH}.'\.mythtv\mysql.txt_', write => [$ENV{HOMEPATH}.'\.mythtv\mysql.txt', 566 '# 567 DBHostName=127.0.0.1 568 DBHostPing=no 569 DBUserName=mythtv 570 DBPassword=mythtv 571 DBName=mythconverg 572 DBType=QMYSQL3 573 #LocalHostName=my-unique-identifier-goes-here 574 ','nocheck'], 575 comment => 'create a mysql.txt file at: %HOMEPATH%\.mythtv\mysql.txt' ], 576 577 578 #execute and capture output: C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqlshow.exe -u mythtv --password=mythtv 579 # example response: mysqlshow.exe: Can't connect to MySQL server on 'localhost' (10061) 580 # if this is doing an anonymous connection, so the BEST we should expect is an "access denied" message if the server is running properly. 581 582 [ file => $mythtv.'testmysql.bat_', write => [ $mythtv.'testmysql.bat', 583 '@echo off 584 echo testing connection to a local mysql server... 585 sleep 5 586 del '.$dosmythtv.'_mysqlshow_err.txt 587 "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqlshow.exe" -u mythtv --password=mythtv 2> '.$dosmythtv.'_mysqlshow_err.txt > '.$dosmythtv.'_mysqlshow_out.txt 588 type '.$dosmythtv.'_mysqlshow_out.txt >> '.$dosmythtv.'_mysqlshow_err.txt 589 del '.$dosmythtv.'_mysqlshow_out.txt 590 sleep 1 591 ','nocheck']], 592 593 # try to connect as mythtv/mythtv first (the best case scenario) 594 [ file => $mythtv.'skipping_db_tests.txt', exec => [$mythtv.'testmysql.bat','nocheck'], comment => 'First check - is the local mysql server running, accepting connections, and all that? (follow the bouncing ball on the install, a standard install is OK, remember the root password that you set, start it as a service!)' ], 595 596 # if the connection was good, or the permissions were wrong, but the server was there, there's no need to reconfigure the server! 597 [ grep => ['(\+--------------------\+|Access denied for user)',$mythtv.'_mysqlshow_err.txt'], exec => ['C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLInstanceConfig.exe','nocheck'], comment => 'See if we couldnt connect to a local mysql server. Please re-configure the MySQL server to start as a service.'], 598 599 # try again to connect as mythtv/mythtv first (the best case scenario) - the connection info should have changed! 600 [ file => $mythtv.'skipping_db_tests.txt', exec => [$mythtv.'testmysql.bat','nocheck'], comment => 'Second check - that the local mysql server is at least now now running?' ], 601 602 603 #set/reset mythtv/mythtv password! 604 [ file => $mythtv.'resetmythtv.bat_', write => [ $mythtv.'resetmythtv.bat', 605 "\@echo off 606 echo stopping mysql service: 607 net stop MySQL 608 sleep 2 609 echo writing script to reset mythtv/mythtv passwords: 610 echo USE mysql; >resetmythtv.sql 611 echo. >>resetmythtv.sql 612 echo INSERT IGNORE INTO user VALUES ('localhost','mythtv', PASSWORD('mythtv'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); >>resetmythtv.sql 613 echo REPLACE INTO user VALUES ('localhost','mythtv', PASSWORD('mythtv'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); >>resetmythtv.sql 614 echo INSERT IGNORE INTO user VALUES ('\%\%','mythtv', PASSWORD('mythtv'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); >>resetmythtv.sql 615 echo REPLACE INTO user VALUES ('\%\%','mythtv', PASSWORD('mythtv'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); >>resetmythtv.sql 616 echo trying to reset mythtv/mythtv passwords: 617 \"C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqld-nt.exe\" --no-defaults --bind-address=127.0.0.1 --bootstrap --console --skip-grant-tables --skip-innodb --standalone <resetmythtv.sql 618 del resetmythtv.sql 619 echo trying to re-start mysql 620 rem net stop MySQL 621 net start MySQL 622 rem so that the server has time to start before we query it again 623 sleep 5 624 echo. 625 echo Password for user 'mythtv' was reset to 'mythtv' 626 echo. 627 ",'nocheck'], 628 comment => 'writing a script to create the mysql user (mythtv/mythtv) without needing to ask you for the root password ...'], 629 630 # reset passwords, this give the myhttv user FULL access to the entire mysql instance! 631 # TODO give specific access to just the the mythconverg DB, as needed. 632 [ grep => ['(\+--------------------\+)',$mythtv.'_mysqlshow_err.txt'], exec => [$dosmythtv.'resetmythtv.bat','nocheck'], comment => 'Resetting the mythtv/mythtv permissions to mysql - if the user already has successful login access to the mysql server, theres no need to run this' ], 633 634 635 # try again to connect as mythtv/mythtv first (the best case scenario) - the connection info should have changed! 636 [ file => $mythtv.'skipping_db_tests.txt', exec => [$mythtv.'testmysql.bat','nocheck'], comment => 'Third check - that the local mysql server is fully accepting connections?' ], 637 638 # create DB: 639 # this has the 'nocheck' flag because the creation of the DB doesn't instantly reflect in the .txt file we are looking at: 640 [ grep => ['mythconverg',$mythtv.'_mysqlshow_err.txt'], exec => [ 'echo create database mythconverg; | "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe" -u mythtv --password=mythtv','nocheck'], comment => ' does the mythconverg database exist? (and can this user see it?) '], 564 641 565 #------------------------------------------------------------------------------566 642 567 ;568 643 644 # then we Can't connect to MySQL server is the message we get if the server is not even running! 645 #[ grep => ["Access denied for user",$mythtv.'_mysqlshow_err.txt'], exec => 'C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLInstanceConfig.exe', comment => 'We couldnt connect to server, please re-configure the MySQL server to start as a service.'], 646 647 #---------------------------------------- 648 649 ; # END OF CAUSE->ACTION DEFINITIONS 650 651 #------------------------------------------------------------------------------ 569 652 570 653 sub _end { 571 654 … … 574 657 print << "END"; 575 658 # 576 659 # SCRIPT TODO/NOTES: - further notes on this scripts direction.... 660 # if the build was successful then try running the 'mythfrontend.exe' and 'mythbackend.exe' from the 'C:\mythtv\mythtv\run' folder. 577 661 # ok, how about the test-run process? 578 # execute the $mythtv.'make_run.sh' to put all the exe's and dll's in one place579 662 # create a vanilla mysql.txt file 580 663 # check that the local mysql server is running, and configure it: 581 664 # we should run: 'C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\MySQLInstanceConfig.exe' … … 596 679 my $causetype = $dep[0]; 597 680 my $cause = $dep[1]; 598 681 my $effecttype = $dep[2]; 599 my $effectparams = $dep[3] ;600 die "too many parameters in cause->event declaration ( @dep)" if defined $dep[4] && $dep[4] ne 'comment'; # four pieces: cause => [blah] , effect => [blah]682 my $effectparams = $dep[3] || ''; 683 die "too many parameters in cause->event declaration (".join('|',@dep).")" if defined $dep[4] && $dep[4] ne 'comment'; # four pieces: cause => [blah] , effect => [blah] 601 684 my $comment = $dep[5] || ''; 602 685 603 686 if ( $comment && $NOISY ) { … … 615 698 die "too many parameters in cause->event declaration (@dep)" 616 699 if defined $dep[6]; 617 700 618 my @effectparams ;701 my @effectparams = (); 619 702 if (ref($effectparams) eq "ARRAY" ) { 620 703 @effectparams = @{$effectparams}; 621 704 } else { … … 653 736 if ( ! -f $cause[0] && $nocheck == 0) { 654 737 die "file -> EFFECT FAILED: $causetype,$cause[0],$effecttype\n"; 655 738 } 656 739 } elsif ( $causetype eq 'filesame' ) { 740 # TODO - currently we check file mtime, and byte size, but not MD5/CRC32 or contents, this is "good enough" for most circumstances. 741 my ( $size,$mtime)=(0,0); 742 if ( -f $cause[0] ) { 743 $size = (stat($cause[0]))[7]; 744 $mtime = (stat($cause[0]))[9]; 745 } 746 if (! (-f $cause[1] ) ) { die "cause: $causetype requires its SECOND filename to exist for comparison: $cause[1] \n"; } 747 my $size2 = (stat($cause[1]))[7]; 748 my $mtime2 = (stat($cause[1]))[9]; 749 if ( $mtime != $mtime2 || $size != $size2) { 750 if ( ! $nocheckeffectparams[0] ) { 751 die "sorry but you can not leave the arguments list empty for anything except the 'copy' action (and only when used with the 'filesame' cause)" unless $effecttype eq 'copy'; 752 print "no parameters defined, so applying effect($effecttype) as ( 2nd src parameter => 1st src parameter)!\n"; 753 effect($effecttype,$cause[1],$cause[0]); #copy the requested file[1] to the requested destn[0], now the [0] file exists and is the same. 754 } else { 755 effect($effecttype,@nocheckeffectparams); # do something else if the files are not 100% identical? 756 } 757 }else { 758 print "effect not requiredm files already up-to-date/identical: ($cause[0] => $cause[1]) \n"; 759 } 760 undef $size; undef $mtime; 761 undef $size2; undef $mtime2; 762 763 } elsif ( $causetype eq 'newer' ) { 764 my $mtime = 0; 765 if ( -f $cause[0] ) { 766 $mtime = (stat($cause[0]))[9]; 767 } 768 if (! ( -f $cause[1]) ) { die "cause: $causetype requires it's SECOND filename to exist for comparison: $cause[1]\n"; } 769 my $mtime2 = (stat($cause[1]))[9]; 770 if ( $mtime < $mtime2 ) { 771 effect($effecttype,@nocheckeffectparams); 772 if ( $nocheck == 0 ) { 773 # confirm it worked, mtimes should have changed now: 774 my $mtime3 = (stat($cause[0]))[9]; 775 my $mtime4 = (stat($cause[1]))[9]; 776 if ( $mtime3 < $mtime4 ) { 777 die "file -> EFFECT FAILED: $causetype,$cause[0],$cause[1],$effecttype\n"; 778 } 779 } 780 } else { 781 print "file ($cause[0]) has same or newer mtime than ($cause[1]) already, no action taken\n"; 782 } 783 undef $mtime; 784 undef $mtime2; 785 657 786 } elsif ( $causetype eq 'grep' ) { 658 787 if ( ! _grep($cause[0],$cause[1]) ) { # grep actually needs two parameters on the source side of the action 659 788 effect($effecttype,@nocheckeffectparams); 660 789 } else { 661 790 print "grep - already matched source file($cause[1]), with pattern ($cause[0]) - no action reqd\n"; 662 791 } 792 if ( (! _grep($cause[0],$cause[1])) && $nocheck == 0 ) { 793 die "grep -> EFFECT FAILED: $causetype,$effecttype,$cause[0],$cause[1]\n"; 794 } 663 795 664 796 } else { 665 die " unknown causetype $causetype \n"; 797 print Dumper(\@dep); 798 die " unknown causetype '$causetype' \n"; 666 799 } 667 800 } 668 801 … … 676 809 sub effect { 677 810 my ( $effecttype, @effectparams ) = @_; 678 811 679 if ( $effecttype eq 'fetch') {812 if ( $effecttype =~ /\s*fetch\s*/i ) { 680 813 # passing two parameters that came in via the array 681 814 _fetch(@effectparams); 682 815 683 } elsif ( $effecttype eq 'extract') {816 } elsif ( $effecttype =~ /\s*extract\s*/i ) { 684 817 my $tarfile = $effectparams[0]; 685 818 my $destdir = $effectparams[1] || ''; 686 819 if ($destdir eq '') { … … 693 826 print "extracttar($t,$destdir);\n"; 694 827 extracttar($t,$destdir); 695 828 696 } elsif ($effecttype eq 'exec') { # execute a DOS command829 } elsif ($effecttype =~ /\s*exec\s*/i ) { # execute a DOS command 697 830 my $cmd = shift @effectparams; 698 699 $cmd =~ s#/#\\#g; # convert all forward to SINGLE backward slashes700 # (TODO - might be overkill to do all slashes ?)701 702 # this next set of regex's is YUCK, but it actually works well,703 # if it breaks, we'll just add another special case like these:704 705 $cmd =~ s#\s\\Y\s# /Y #ig; # it is overkill, so undo specific case/s706 # (eg: the /Y flag to the copy command)707 $cmd =~ s#\s\\C\s# /C #ig; # the /C /Q and /T options708 # used to extract the dxsdk709 $cmd =~ s#\s\\Q\s# /Q #ig;710 $cmd =~ s#\s\\T# /T#ig;711 $cmd =~ s#http:\\\\#http://#ig; # dont backslash web addresses712 if ($cmd =~ m/http:/ ) {713 # next three lines will return any incorrectly backslashed714 # slashes in a URL like: http://blah\blah\blah715 # to http://blah/blah/blah as it should be:716 $cmd =~ s#^(.*)(http://.*$)#$2#i;717 my $pre = $1;718 $cmd =~ s#\\#/#g;719 print "pre:$pre\ncmd:$cmd\n";720 $cmd = $pre.$cmd;721 }722 723 831 #print `$cmd`; 724 832 print "exec:$cmd\n"; 725 open F, "$cmd|" || die "err: $!";833 open F, $cmd." |" || die "err: $!"; 726 834 while (<F>) { 727 835 print; 728 836 } 729 837 730 } elsif ($effecttype eq 'shell') {838 } elsif ($effecttype =~ /\s*shell\s*/i ) { 731 839 shell(@effectparams); 840 841 } elsif ($effecttype =~ /\s*copy\s*/i ) { 842 die "Can not copy non-existant file ($effectparams[0])\n" unless -f $effectparams[0]; 843 print "copying file ($effectparams[0] => $effectparams[1]) \n"; 844 cp($effectparams[0],$effectparams[1]); 845 # make destn mtime the same as the original for ease of comparison: 846 shell("touch --reference=".perl2unix($effectparams[0])." ".perl2unix($effectparams[1])); 732 847 733 } elsif ($effecttype eq 'mkdirs') {848 } elsif ($effecttype =~ /\s*mkdirs\s*/i ) { 734 849 mkdirs(shift @effectparams); 735 850 736 } elsif ($effecttype eq 'write') {851 } elsif ($effecttype =~ /\s*write\s*/i ) { 737 852 # just dump the requested content from the array to the file. 738 853 my $filename = shift @effectparams; 739 854 my $fh = new IO::File ("> $filename") … … 743 858 $fh->close(); 744 859 745 860 } else { 746 die " unknown effecttype $effecttype from cause 'dir'\n"; 861 print Dumper(\@effectparams); 862 die " unknown effecttype '$effecttype'\n"; 747 863 } 748 864 } 749 865 #------------------------------------------------------------------------------