[mythtv] [mythtv-commits] Ticket #4397: win32 dependancy resolver and build script

Harold Brown labrat.hb at gmail.com
Fri Jan 4 00:07:03 UTC 2008


On Jan 3, 2008 3:48 PM, buzz <davidbuzz at gmail.com> wrote:
> Simon,
> unfortunately, due to the fact that this tool is essentially a
> bootstrap-loader for a msys environment, during the early stages, when msys
> isn't installed, we can only rely on the very basic operating system tools,
> ie DOS "mkdir", which doesn't support a -p option, and can't recursively
> make folders with it's mkdir command unless the DOS environment was started
> with -x (" cmd.exe -x") to enable extensions.    Forcing people to do that
> is harder that writing a subroutine to get around it with a foreach loop in
> perl.
> :-)
> Buzz
>

Command Extensions are enabled by default on Vista, WindowsXP and
Windows 2000 so mkdid with full path should work (and did on my XP and
Vista test machines)  and as the [mkdirs] did not work on either my XP
or Vista machines I changed it to the following which does work (when
passed a dos path ie $dossources):

sub mkdirs {
	my $path = shift;
  print `mkdir $path`;
}

another issue I've had with the script is that the [extract] function
doesn't work as it is trying to call an msys command (tar.exe) in a
regular command shell.  the child process (gzip or bzip2) does not
work, I modified the function to be as follows

sub extracttar {
	my ( $t, $d) = @_;

  unless ( $t =~ m/zip/ ) { # the unzip tool need the full DOS path,
the msys commands need that stripped off.
    $t =~ s#^$msys#/#i;
  }
	my $d2 = $d;
	#$d2 =~ s#/#\\\\#g;  # the chdir command MUST have paths with
backslashes, not forward slashes.
			
	print "extracting to: $d\n";	
	my $cmd = $msys.'bin/sh2.exe -c "( export PATH=/bin:/mingw/bin:$PATH;';
	#my $cmd = '';	
	if ( $t =~ /\.gz$/ ) {
		$cmd = $cmd."cd $d2;tar.exe -zxvpf $t";
	} elsif ( $t =~ /\.bz2$/ ) {
		$cmd = $cmd."cd $d2;tar.exe -jxvpf $t";
	}elsif ( $t =~ /\.zip$/ ) {
		$cmd = $cmd."cd $d2 && $sources/unzip/unzip.exe -o $t";
		#die "unzippng not implemented yet \n";
	}elsif ( $t =~ /\.tar$/ ) {
		$cmd = $cmd."cd $d2;tar.exe -xvpf $t";
	} else {
		die  "extract tar failed on ($t,$d)\n";
	}
	$cmd = $cmd.')"';
	# execute the cmd, and capture the output!
	# this is a glorified version of "print `$cmd`;" except it doesn't
buffer the output, if $|=1; is set.
	# $t should be a msys compatible path ie /sources/etc
	print "extracttar:$cmd\n";
	open F, "$cmd |"  || die "err: $!";
	while (<F>) {
	  print;
	}
}

You'll notice the use of sh2.exe instead of sh.exe.  I copy sh.exe to
sh2 in the install process as otherwise it can't be replaced when bash
is installed.

As for the dsound.h ddraw.h and dinput.h files, those can be
downloaded from the Allegro project in the following file:
http://alleg.sourceforge.net/files/dx80_mgw.zip

I'm a bit mystified as to how you're getting this bootstrap script to
run as-is with the problems I'm seeing with it


More information about the mythtv-dev mailing list