tools/buildbot/bootstrap.pl
author Scott Ehlert <ds@alliedmods.net>
Wed Feb 25 23:17:37 2009 -0600 (2009-02-25)
changeset 2617 253d6b4f15ab
parent 2522 bb1336c14492
parent 2616 92dd6cae4991
child 2625 3914790cc90e
permissions -rwxr-xr-x
Merged changes from 1.1
     1 #!/usr/bin/perl
     2 
     3 use strict;
     4 use Cwd;
     5 use File::Basename;
     6 
     7 my ($myself, $path) = fileparse($0);
     8 chdir($path);
     9 
    10 require 'helpers.pm';
    11 
    12 chdir(Build::PathFormat('../builder'));
    13 if ($^O eq "linux")
    14 {
    15     Build::Command('make clean');
    16     Build::Command('make');
    17 }
    18 else
    19 {
    20     Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild builder.csproj Release');
    21     Build::Command('move ' . Build::PathFormat('bin/Release/builder.exe') . ' .');
    22 }
    23 
    24 die "Unable to build builder tool!\n" unless -e 'builder.exe';
    25 
    26 #Go back to main source dir.
    27 chdir(Build::PathFormat('../..'));
    28 
    29 #Get the source path.
    30 our ($root) = getcwd();
    31 
    32 #Create output folder if it doesn't exist.
    33 if (!(-d 'OUTPUT')) {
    34     mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
    35 }
    36 
    37 #Write the configuration file.
    38 open(CONF, '>build.cfg') or die("Failed to write build.cfg: $!\n");
    39 print CONF "OutputBase = " . Build::PathFormat($root . '/OUTPUT') . "\n";
    40 print CONF "SourceBase = $root\n";
    41 if ($^O eq "linux") 
    42 {
    43     print CONF "BuilderPath = /usr/bin/make\n";
    44 }
    45 else
    46 {
    47     print CONF "BuilderPath = " . $ENV{'VC9BUILDER'} . "\n";
    48     print CONF "PDBLog = $root\\OUTPUT\\pdblog.txt\n";
    49 }
    50 close(CONF);
    51 
    52 #Do the annoying revision bumping.
    53 #Linux needs some help here.
    54 if ($^O eq "linux")
    55 {
    56     Build::Command("flip -u modules.versions");
    57     Build::Command("flip -u tools/versionchanger.pl");
    58     Build::Command("chmod +x tools/versionchanger.pl");
    59 }
    60 Build::Command(Build::PathFormat('tools/versionchanger.pl') . ' --buildstring="-dev"');
    61 
    62 #Bootstrap extensions that have complex dependencies
    63 
    64 if ($^O eq "linux")
    65 {
    66 	BuildLibCurl_Linux();
    67 }
    68 else
    69 {
    70 	BuildLibCurl_Win32();
    71 }
    72 
    73 sub BuildLibCurl_Win32
    74 {
    75 	chdir("extensions\\curl\\curl-src\\lib");
    76 	Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild build_libcurl.vcproj "LIB Release"');
    77 	die "Unable to find libcurl.lib!\n" unless (-f "LIB-Release\\libcurl.lib");
    78 	chdir("..\\..\\..\\..");
    79 }
    80 
    81 sub BuildLibCurl_Linux
    82 {
    83 	chdir("extensions/curl/curl-src");
    84 	Build::Command("mkdir -p Release");
    85 	Build::Command("chmod +x configure");
    86 	chdir("Release");
    87 	Build::Command("../configure --enable-static --disable-shared --disable-ldap --without-ssl --without-zlib");
    88 	Build::Command("make");
    89 	die "Unable to find libcurl.a!\n" unless (-f "lib/.libs/libcurl.a");
    90 	chdir("../../../..");
    91 }