#!/usr/bin/perl

# Copyright (C) 1999-2003, Matevz Tadel. All rights reserved.
# This file is part of GLED, released under GNU General Public License version 2.
# For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

# Run all meta-packing on the main server

use Carp;
use lib ".";
use ParseConfig;

$def_cfg = "build.rc";

my $cfg_parser = new ParseConfig(-defcfg=>$def_cfg, -useenv=>1);
$cfg_parser->parse();

do "$CONFIG" or die "Could not open config file '$CONFIG'";

########################################################################

sub system_or_die {
  my $cmd = shift;
  system "$cmd" and die "$cmd died";
}

########################################################################

# Make source meta-packs on first binary build. Then skip (see assig below).
$extra = "-meta-pack-srcs";

for $b (@$BinaryBuilds) {
  print '#' x 80 ."\n" . '#' x 80 ."\n";
  print "# Meta packing for $b\n";
  print '#' x 80 ."\n" . '#' x 80 ."\n\n";

  system_or_die("./build.pl -build $b -skip-ext -skip-lib -noskip-meta $extra");
  $extra = "";
}
