[t/spec] Unfudge log tests in real-bridge.t.
[pugs.git] / util / ghc_setup.pl
blob11809449455aafcc9875f949ab7018afadefaab8
1 #!/usr/bin/perl
3 # Silly GHC ./Setup helper, simply to strip the DESTDIR away
4 # when it is not passed in, and add "--copy-prefix" if it is.
7 use Config;
8 use File::Spec;
10 my $setup = File::Spec->catfile(File::Spec->curdir, "Setup$Config{_exe}");
11 my @args = grep !/^--[-\w]*prefix=$/, @ARGV;
12 my $prompt_register;
14 if ($args[0] eq 'copy') {
15 if (@args != @ARGV and is_root()) {
16 # if there's no prefix, we want an install.
17 $args[0] = 'install';
19 else {
20 # If this is merely a copy, tell the user to "make register".
21 $prompt_register = 1;
24 print "*** Running: $setup @args\n";
26 my $rv = system($setup, @args);
27 if ($rv == 0) {
28 if ($prompt_register) {
29 print << ".";
30 *** Installed! If you would like to make Pugs a system-wide GHC package
31 for use with other Haskell programs, type '$Config{make} register'.
34 else {
35 print << ".";
36 *** Installed successfully!
40 else {
41 print << ".";
42 *** Installation failed (exit code $rv).
46 exit $rv;
48 sub is_root {
49 local $@;
50 eval('$> == 0') || $@; # System with no concepts of UIDs