Fixed a bug in win32 startbuild.pl.
6 my ($myself, $path) = fileparse($0);
11 #Get to top of source tree
15 # Folder .vcproj Engine Binary Suffix type
16 Build('loader', 'mm_loader', '', 'server', 'full');
17 Build('core-legacy', 'mm_core-legacy', '', 'metamod.1.ep1', '');
18 Build('core', 'mm_core', 'OrangeBox', 'metamod.2.ep2', '');
19 Build('core', 'mm_core', 'Left4Dead', 'metamod.2.l4d', '');
21 #Structure our output folder
23 mkdir(Build::PathFormat('OUTPUT/addons'));
24 mkdir(Build::PathFormat('OUTPUT/addons/metamod'));
25 mkdir(Build::PathFormat('OUTPUT/addons/metamod/bin'));
28 for ($i = 0; $i <= $#LIBRARIES; $i++)
30 my $library = $LIBRARIES[$i];
31 Copy($library, Build::PathFormat('OUTPUT/addons/metamod/bin'));
33 Copy(Build::PathFormat('support/metaplugins.ini'),
34 Build::PathFormat('OUTPUT/addons/metamod'));
35 Copy(Build::PathFormat('support/README.txt'),
36 Build::PathFormat('OUTPUT/addons/metamod'));
42 die "Could not copy $a to $b!\n" if (!Build::Copy($a, $b));
47 my ($srcdir, $vcproj, $objdir, $binary, $suffix) = (@_);
51 if ($suffix eq 'full')
53 $binary .= '_i486.so';
59 BuildLinux($srcdir, $objdir, $binary);
64 BuildWindows($srcdir, $vcproj, $objdir, $binary);
70 my ($srcdir, $vcproj, $build, $binary) = (@_);
71 my ($dir, $file, $param, $vcbuilder, $cmd);
74 chdir("$srcdir\\msvc9");
77 if ($build eq "Orange Box")
79 $param = "Release - Orange Box";
81 elsif ($build eq "Left4Dead")
83 $param = "Release - Left 4 Dead";
86 print "Clean building $srcdir...\n";
87 $vcbuilder = $ENV{'VC9BUILDER'};
88 $cmd = "\"$vcbuilder\" /rebuild \"$vcproj.vcproj\" \"$param\"";
93 $file = "msvc9\\$param\\$binary";
95 die "Output library not found: $file\n" if (!-f $file);
99 push(@LIBRARIES, "$srcdir\\$file");
104 my ($srcdir, $build, $binary) = (@_);
105 my ($dir, $file, $param);
112 if ($build eq "OrangeBox")
114 $param = "ENGINE=orangebox";
115 $file .= '.orangebox';
117 elsif ($build eq "Left4Dead")
119 $param = "ENGINE=left4dead";
120 $file .= '.left4dead';
122 $file .= '/' . $binary;
124 print "Cleaning $srcdir...\n";
125 system("make $param clean");
128 print "Building $srcdir for $binary...\n";
130 system("make $param");
133 die "Output library not found: $file\n" if (!-f $file);
137 push(@LIBRARIES, $srcdir . '/' . $file);
142 die "Build failed: $!\n" if $? == -1;
143 die "Build died :(\n" if $^O eq "linux" and $? & 127;
144 die "Build failed with exit code: " . ($? >> 8) . "\n" if ($? >> 8 != 0);