Changeset 21770 for Makefile.PL

Show
Ignore:
Timestamp:
08/04/08 11:30:29 (4 months ago)
Author:
audreyt
Message:

* Makefile.PL: Install prerequisites automatically without connecting to hackage.haskell.org.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Makefile.PL

    r21762 r21770  
    2828my $bin_dir = File::Spec->catdir($app_dir, 'bin'); 
    2929my $cabal   = File::Spec->catfile($bin_dir, "cabal$Config{_exe}"); 
     30my $cabal_config = File::Spec->catfile($app_dir, 'config'); 
    3031 
    3132$ENV{PATH} = $bin_dir . $Config{path_sep} . $ENV{PATH}; 
     
    3738my $rebuilt = 0; 
    3839$rebuilt += bootstrap_with(Cabal            => qr/1\.4\./, '1.4.0'); 
    39 #$rebuilt ||= bootstrap_with(bytestring       => qr/0\.9\.[1-9]/, '0.9.1'); 
    4040$rebuilt += bootstrap_with(parsec           => qr/2\./, '2.0'); 
    4141$rebuilt += bootstrap_with(network          => qr/[12]\./, '1.0'); 
     
    5151 
    5252my @deps = qw( 
    53     filepath mtl stm pretty time random process containers array directory  
    54  
    55     utf8-string 
    56     binary 
    57     haskeline 
    58     FindBin 
    59     MetaObject 
    60     HsParrot 
    61     pugs-compat 
    62     pugs-DrIFT 
    63     stringtable-atom 
    64     HsSyck 
     53    mtl time utf8-string binary haskeline FindBin MetaObject HsParrot 
     54    pugs-compat pugs-DrIFT stringtable-atom HsSyck 
    6555); 
    6656 
    67 system($cabal => 'update'); 
    68 system($cabal => 'install', '--user', @deps); 
    69  
    70 # TODO - At this point we'd like to fool Cabal into using our own archive. 
     57# This line is here simply to trick Cabal into creating a default config file. 
     58my $rv = `cabal list -v0 --installed --simple-output`; 
     59 
     60my $cabal_local_config = "$FindBin::RealBin/third-party/packages/config"; 
     61 
     62# Ok, now we copy the config file to our tree. 
     63open IN, '<', $cabal_config or die "Impossible: $cabal_config not found?"; 
     64open OUT, '>', $cabal_local_config; 
     65print OUT << "."; 
     66local-repos: "$FindBin::RealBin/third-party/packages/hackage.haskell.org" 
     67. 
     68while (<IN>) { 
     69    next if /^(?:local-)?repos:/; 
     70    print OUT $_; 
     71} 
     72close IN; 
     73close OUT; 
     74 
     75$ENV{CABAL_CONFIG_FILE} = $cabal_local_config; 
     76system($cabal => 'install', '--user', '-p', @deps); 
     77 
    7178do "Configure.PL"; 
    7279print "==> Pugs configuration finished.\n"; 
     
    238245 
    239246    system($ghc, qw(--make -O0), -o => $setup_exe, $setup_hs) 
    240         || system($setup_exe, qw(configure --user)) 
     247        || system($setup_exe, qw(configure --user -p)) 
    241248        || system($setup_exe, qw(build)) 
    242249        || system($setup_exe, qw(install --user))