Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 143 lines (117 sloc) 4.345 kb
a23fcb7 @coke [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
coke authored
1 #! perl
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
2 # Copyright (C) 2009 The Perl Foundation
a23fcb7 @coke [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
coke authored
3
0bb68ee @japhb Configure improvements
japhb authored
4 use 5.008;
a23fcb7 @coke [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
coke authored
5 use strict;
6 use warnings;
0bb68ee @japhb Configure improvements
japhb authored
7 use Getopt::Long;
607f531 @pmichaud Initial re-attempt at building/running Rakudo from installed Parrot.
pmichaud authored
8 use Cwd;
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
9 use lib "tools/lib";
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
10 use NQP::Configure qw(sorry slurp cmp_rev gen_nqp read_config
39737ca @pmichaud Clean up verify_install handling.
pmichaud authored
11 fill_template_text fill_template_file
12 verify_install);
a23fcb7 @coke [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
coke authored
13
688f9a2 @pmichaud Modernizing some code. Eliminated globals from Configure.pl. Error c…
pmichaud authored
14 MAIN: {
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
15 my %config;
16 $config{'rakudo_config_status'} = join(' ', map { "\"$_\""} @ARGV);
17
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
18 my $exe = $NQP::Configure::exe;
19
0bb68ee @japhb Configure improvements
japhb authored
20 my %options;
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
21 GetOptions(\%options, 'help!', 'prefix=s',
22 'with-nqp=s', 'gen-nqp:s',
23 'with-parrot=s', 'gen-parrot:s',
24 'make-install!', 'makefile-timing!',
25 );
688f9a2 @pmichaud Modernizing some code. Eliminated globals from Configure.pl. Error c…
pmichaud authored
26
27 # Print help if it's requested
28 if ($options{'help'}) {
29 print_help();
30 exit(0);
31 }
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
32
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
33 my $prefix = $options{'prefix'} || cwd().'/install';
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
34 my $with_nqp = $options{'with-nqp'};
35 my $gen_nqp = $options{'gen-nqp'};
36 my $with_parrot = $options{'with-parrot'};
37 my $gen_parrot = $options{'gen-parrot'};
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
38
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
39 # Save options in config.status
40 unlink('config.status');
41 if (open(my $CONFIG_STATUS, '>', 'config.status')) {
42 print $CONFIG_STATUS
43 "$^X Configure.pl $config{'rakudo_config_status'} \$*\n";
44 close($CONFIG_STATUS);
924ea54 @moritz detect missing nqp executable at Configure.pl time
moritz authored
45 }
46
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
47 # --with-parrot and --gen-parrot imply --gen-nqp
48 if (!defined $gen_nqp && (defined $with_parrot || defined $gen_parrot)) {
49 $gen_nqp = '';
50 }
51
52 # determine the version of NQP we want
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
53 my ($nqp_want) = split(' ', slurp('tools/build/NQP_REVISION'));
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
54
55 if (defined $gen_nqp) {
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
56 $with_nqp = gen_nqp($nqp_want, %options);
bd7533f @pmichaud Improve the error diagnostics when someone tries to build Rakudo
pmichaud authored
57 }
688f9a2 @pmichaud Modernizing some code. Eliminated globals from Configure.pl. Error c…
pmichaud authored
58
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
59 my @errors;
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
60
61 my %nqp_config;
62 if ($with_nqp) {
63 %nqp_config = read_config($with_nqp)
64 or push @errors, "Unable to read configuration from $with_nqp.";
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
65 }
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
66 else {
67 %nqp_config = read_config("$prefix/bin/nqp$exe", "nqp$exe")
68 or push @errors, "Unable to find an NQP executable.";
69 $with_nqp = fill_template_text('@bindir@/nqp@exe@', %nqp_config)
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
70 }
71
72 %config = (%config, %nqp_config);
bcc0773 @pmichaud Search for nqp executable if not specified. Check NQP revision requi…
pmichaud authored
73 my $nqp_have = $config{'nqp::version'} || '';
74 if ($nqp_have && cmp_rev($nqp_have, $nqp_want) < 0) {
75 push @errors, "NQP revision $nqp_want required (currently $nqp_have).";
76 }
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
77
39737ca @pmichaud Clean up verify_install handling.
pmichaud authored
78 if (!@errors) {
79 push @errors, verify_install([ @NQP::Configure::required_parrot_files,
80 @NQP::Configure::required_nqp_files ],
81 %config);
82 push @errors,
83 "(Perhaps you need to 'make install', 'make install-dev',",
84 "or install the 'devel' package for NQP or Parrot?)"
85 if @errors;
86 }
87
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
88 if (@errors && !defined $gen_nqp) {
89 push @errors,
39737ca @pmichaud Clean up verify_install handling.
pmichaud authored
90 "\nTo automatically clone (git) and build a copy of NQP $nqp_want,",
6c9783d @pmichaud Add some better error message support and option handling.
pmichaud authored
91 "try re-running Configure.pl with the '--gen-nqp' or '--gen-parrot'",
92 "options. Or, use '--with-nqp=' or '--with-parrot=' to explicitly",
93 "specify the NQP or Parrot executable to use to build Rakudo.";
94 }
95
96 sorry(@errors) if @errors;
97
98 print "Using $with_nqp (version $config{'nqp::version'}).\n";
99
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
100 $config{'makefile-timing'} = $options{'makefile-timing'};
101 $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
102 $config{'shell'} = 'sh';
7b4118d @jnthn [config] Configure needs to translate forward slashes in makefile to …
jnthn authored
103 if ($^O eq 'MSWin32') {
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
104 $config{'shell'} = 'cmd';
105 $config{'win32_libparrot_copy'} =
106 'copy $(PARROT_BIN_DIR)\libparrot.dll .';
7247277 @moritz [Configure] experimental timing option for Makefile
moritz authored
107 }
108
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
109 fill_template_file('tools/build/Makefile.in', 'Makefile', %config);
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
110
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
111 exit 0;
5948c11 @pmichaud Allow Parrot VERSION to be used in cases when the svn revision
pmichaud authored
112 }
113
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
114
115 # Print some help text.
116 sub print_help {
46f5a49 @moritz Apply coding style fix by François Perrad, fperrad++
moritz authored
117 print <<'END';
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
118 Configure.pl - NQP Configure
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
119
120 General Options:
121 --help Show this text
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
122 --prefix=dir Install files in dir
412a42e @pmichaud Update Configure.pl --help text.
pmichaud authored
123 --with-nqp=path/to/bin/nqp
124 NQP executable to use to build Rakudo
125 --gen-nqp[=branch]
126 Download and build a copy of NQP
127 --with-parrot=path/to/bin/parrot
7ec8cf2 @pmichaud New Configure/build system, part 1.
pmichaud authored
128 Parrot executable to use to build NQP
412a42e @pmichaud Update Configure.pl --help text.
pmichaud authored
129 --gen-parrot[=branch]
130 Download and build a copy of Parrot
131 --makefile-timing Enable timing of individual makefile commands
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
132 END
f9cb35e @petdance modernize some code, and add error checking
petdance authored
133
134 return;
7d7f1af Update Configure.pl with some help messages and options.
Patrick R. Michaud authored
135 }
46f5a49 @moritz Apply coding style fix by François Perrad, fperrad++
moritz authored
136
137 # Local Variables:
138 # mode: cperl
139 # cperl-indent-level: 4
140 # fill-column: 100
141 # End:
142 # vim: expandtab shiftwidth=4:
Something went wrong with that request. Please try again.