From 8f9b028e742dd186757714f23e25d551bfa30556 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 Aug 2006 21:57:48 +0000 Subject: * infrastructure/BoxPlatform.pm.in Determine whether we are building for Windows or not, and export that information Search for VERSION.txt in a few more places, for example when running Perl scripts like getversion.pl (refs #3) --- infrastructure/BoxPlatform.pm.in | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/infrastructure/BoxPlatform.pm.in b/infrastructure/BoxPlatform.pm.in index afcbee6e..828516e2 100644 --- a/infrastructure/BoxPlatform.pm.in +++ b/infrastructure/BoxPlatform.pm.in @@ -1,14 +1,26 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; -@EXPORT = qw/$build_os $target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext/; +@EXPORT = qw/$build_os $target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext $target_windows/; BEGIN { # which OS are we building under? - $build_os = `uname`; - chomp $build_os; + $target_os = '@target_os@'; + $target_windows = 0; + $target_windows = 1 if $target_os =~ m'^mingw32' + or $target_os eq "winnt"; + + if ($^O eq "MSWin32" and not -x "/usr/bin/uname") + { + $build_os = "winnt"; + } + else + { + $build_os = `uname`; + chomp $build_os; + } # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) @@ -22,11 +34,18 @@ BEGIN $platform_compile_line_extra =~ s/ -O2//; $platform_link_line_extra = '@LDFLAGS@'; $platform_lib_files = '@LIBS@'; - $target_os = '@target_os@'; $platform_exe_ext = '@EXEEXT@'; # get version - open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; + if (! -r "VERSION.txt" and -r "../../VERSION.txt") + { + open VERSION,"../../VERSION.txt" or die "../../VERSION.txt: $!"; + } + else + { + open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; + } + $product_version = ; chomp $product_version; $product_name = ; -- cgit v1.2.3