makeGoldenMipsy.pl 2.97 KB
#!/usr/local/bin/perl
#
# Copyright (C) 1996-1998 by the Board of Trustees
#    of Leland Stanford Junior University.
# 
# This file is part of the SimOS distribution. 
# See LICENSE file for terms of the license. 
#


# mkg -- installs mipsy files in golden copy directory
#
# John Heinlein
# Stolen liberally from
# Joel Baxter

# This version is much lower-tech than Joel's version for flashlite.
# This script assumes you're already built in the standard simtools hierarchy.
 
# To modify, change the variables below & the code in the "set up" sections
# of the various make_golden subroutines.  If the golden source directory
# locations change, more extensive changes in this script are required.

$simtools   = "$ENV{SIMTOOLS}";
$golden_dir = "/roadkill/rk5/dash2/Golden/libraries";

# Check that the correct environment variables exist, and that the
# correct user is running this script.

&checkenv();

# Get the command line options.

$version = shift;
if ($version !~ /\d+\.\d+/) {
    &Usage();
}

if (-e "$golden_dir/Mipsy/ver_$version") {
#    fatal("Version $version already exists in $golden_dir/Mipsy");
}

print "Making version $version: $golden_dir/Mipsy/ver_$version...\n";
mkdir("$golden_dir/Mipsy/ver_$version",0755);

print "Copying 2levellib.a...\n";
system("cp", "$simtools/caches/2Level/SOLO/2levellib.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying flashlitelib.a...\n";
system("cp", "$simtools/memsystems/flashlite/SOLO/flashlitelib.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying memsysmisc.a...\n";
system("cp", "$simtools/memsystems/misc/SOLO/memsysmisc.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying mipsylib.a...\n";
system("cp", "$simtools/cpus/mipsy/SOLO/mipsylib.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying common.a...\n";
system("cp", "$simtools/common/SOLO/common.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying tcl.a...\n";
system("cp", "$simtools/common/tcl/SOLO/tcl.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying symbols.a...\n";
system("cp", "$simtools/common/symbols/SOLO/symbols.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying stats.a...\n";
system("cp", "$simtools/common/stats/SOLO/stats.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying solo.a...\n";
system("cp", "$simtools/solo/solo.a",
       "$golden_dir/Mipsy/ver_$version");

print "Copying supportlib.a...\n";
system("cp", "$simtools/solo/supportlib.a",
       "$golden_dir/Mipsy/ver_$version");


sub checkenv {
    $< = $>;
    $login  =  (getpwuid($>))[0] || "Who the hell are you?";
    if ($login ne "dash2") {
	&fatal("You need to be the user \"dash2\".");
    }
    if ($ENV{CPU} ne "SGI") {
	&fatal("The only supported CPU type is \"SGI\".");
    }
}

sub fatal {
   local($message) = @_;

   $!=1;die "$0: $message\n";
}

sub Usage {
   print("\n");
   print("usage: makeGoldenMipsy version\n");
   print("\n");
   print("\tversion is a version number to be attached to the mipsy libraries\n");
   exit(0);
}