Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 182 lines (152 sloc) 5.775 kb
a23fcb7e » coke
2008-12-06 [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
1 #! perl
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
2 # Copyright (C) 2009 The Perl Foundation
a23fcb7e » coke
2008-12-06 [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
3
0bb68ee0 » japhb
2009-04-04 Configure improvements
4 use 5.008;
a23fcb7e » coke
2008-12-06 [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
5 use strict;
6 use warnings;
0579b564 » pmichaud
2011-06-08 Add support for "config.default" file to hold default arguments to Co…
7 use Text::ParseWords;
0bb68ee0 » japhb
2009-04-04 Configure improvements
8 use Getopt::Long;
607f5315 » pmichaud
2009-07-22 Initial re-attempt at building/running Rakudo from installed Parrot.
9 use Cwd;
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
10 use lib "tools/lib";
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
11 use NQP::Configure qw(sorry slurp cmp_rev gen_nqp read_config
39737cac » pmichaud
2011-06-08 Clean up verify_install handling.
12 fill_template_text fill_template_file
79c1c9f8 » moritz
2011-11-04 [Configure.pl] fix import list, not_gerd++
13 system_or_die verify_install);
a23fcb7e » coke
2008-12-06 [perl6] add a Configure.pl for perl6; use this to regenerate the Make…
14
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
15 my $lang = 'Rakudo';
16 my $lclang = lc $lang;
17 my $uclang = uc $lang;
18
688f9a2f » pmichaud
2009-03-03 Modernizing some code. Eliminated globals from Configure.pl. Error ch…
19 MAIN: {
0579b564 » pmichaud
2011-06-08 Add support for "config.default" file to hold default arguments to Co…
20 if (-r "config.default") {
21 unshift @ARGV, shellwords(slurp('config.default'));
22 }
23
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
24 my %config;
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
25 my $config_status = "${lclang}_config_status";
26 $config{$config_status} = join(' ', map { "\"$_\""} @ARGV);
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
27
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
28 my $exe = $NQP::Configure::exe;
29
0bb68ee0 » japhb
2009-04-04 Configure improvements
30 my %options;
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
31 GetOptions(\%options, 'help!', 'prefix=s',
32 'with-nqp=s', 'gen-nqp:s',
6dcae2e7 » pmichaud
2011-06-10 Add --parrot-option to Configure.pl.
33 'with-parrot=s', 'gen-parrot:s', 'parrot-option=s@',
ced04f71 » felher
2012-03-02 enable Configure.pl to pass options to Parrot's make
34 'parrot-make-option=s@',
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
35 'make-install!', 'makefile-timing!',
36 );
688f9a2f » pmichaud
2009-03-03 Modernizing some code. Eliminated globals from Configure.pl. Error ch…
37
38 # Print help if it's requested
39 if ($options{'help'}) {
40 print_help();
41 exit(0);
42 }
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
43
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
44 my $prefix = $options{'prefix'} || cwd().'/install';
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
45 my $with_nqp = $options{'with-nqp'};
46 my $gen_nqp = $options{'gen-nqp'};
47 my $with_parrot = $options{'with-parrot'};
48 my $gen_parrot = $options{'gen-parrot'};
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
49
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
50 # Save options in config.status
51 unlink('config.status');
52 if (open(my $CONFIG_STATUS, '>', 'config.status')) {
53 print $CONFIG_STATUS
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
54 "$^X Configure.pl $config{$config_status} \$*\n";
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
55 close($CONFIG_STATUS);
924ea541 » moritz
2011-05-10 detect missing nqp executable at Configure.pl time
56 }
57
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
58 # --with-parrot and --gen-parrot imply --gen-nqp
75c0e9c4 » moritz
2012-05-26 [Configure] do not gen-nqp when --with-nqp is provided
59 if (!defined $gen_nqp && !defined $with_nqp && (defined $with_parrot || defined $gen_parrot)) {
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
60 $gen_nqp = '';
61 }
62
63 # determine the version of NQP we want
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
64 my ($nqp_want) = split(' ', slurp('tools/build/NQP_REVISION'));
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
65
66 if (defined $gen_nqp) {
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
67 $with_nqp = gen_nqp($nqp_want, %options);
bd7533f6 » pmichaud
2009-08-26 Improve the error diagnostics when someone tries to build Rakudo
68 }
688f9a2f » pmichaud
2009-03-03 Modernizing some code. Eliminated globals from Configure.pl. Error ch…
69
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
70 my @errors;
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
71
72 my %nqp_config;
73 if ($with_nqp) {
74 %nqp_config = read_config($with_nqp)
75 or push @errors, "Unable to read configuration from $with_nqp.";
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
76 }
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
77 else {
78 %nqp_config = read_config("$prefix/bin/nqp$exe", "nqp$exe")
79 or push @errors, "Unable to find an NQP executable.";
80 $with_nqp = fill_template_text('@bindir@/nqp@exe@', %nqp_config)
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
81 }
82
83 %config = (%config, %nqp_config);
bcc0773e » pmichaud
2011-06-08 Search for nqp executable if not specified. Check NQP revision requir…
84 my $nqp_have = $config{'nqp::version'} || '';
85 if ($nqp_have && cmp_rev($nqp_have, $nqp_want) < 0) {
86 push @errors, "NQP revision $nqp_want required (currently $nqp_have).";
87 }
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
88
39737cac » pmichaud
2011-06-08 Clean up verify_install handling.
89 if (!@errors) {
90 push @errors, verify_install([ @NQP::Configure::required_parrot_files,
91 @NQP::Configure::required_nqp_files ],
92 %config);
93 push @errors,
94 "(Perhaps you need to 'make install', 'make install-dev',",
95 "or install the 'devel' package for NQP or Parrot?)"
96 if @errors;
97 }
98
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
99 if (@errors && !defined $gen_nqp) {
100 push @errors,
39737cac » pmichaud
2011-06-08 Clean up verify_install handling.
101 "\nTo automatically clone (git) and build a copy of NQP $nqp_want,",
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
102 "try re-running Configure.pl with the '--gen-nqp' or '--gen-parrot'",
103 "options. Or, use '--with-nqp=' or '--with-parrot=' to explicitly",
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
104 "specify the NQP or Parrot executable to use to build $lang.";
6c9783d2 » pmichaud
2011-06-08 Add some better error message support and option handling.
105 }
106
107 sorry(@errors) if @errors;
108
109 print "Using $with_nqp (version $config{'nqp::version'}).\n";
110
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
111 $config{'makefile-timing'} = $options{'makefile-timing'};
112 $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
25967bee » jnthn
2012-01-20 Fix build on Cygwin; patch courtesy of not_gerd++.
113 $config{'shell'} = $^O eq 'MSWin32' ? 'cmd' : 'sh';
114 if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
115 $config{'dll'} = '$(PARROT_BIN_DIR)/$(PARROT_LIB_SHARED)';
116 $config{'dllcopy'} = '$(PARROT_LIB_SHARED)';
117 $config{'make_dllcopy'} =
118 '$(PARROT_DLL_COPY): $(PARROT_DLL)'."\n\t".'$(CP) $(PARROT_DLL) .';
72472775 » moritz
2010-05-08 [Configure] experimental timing option for Makefile
119 }
120
424a6df4 » pmichaud
2011-06-08 Force a "make clean" after running Configure, output a better 'we are…
121 my $make = fill_template_text('@make@', %config);
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
122 fill_template_file('tools/build/Makefile.in', 'Makefile', %config);
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
123
424a6df4 » pmichaud
2011-06-08 Force a "make clean" after running Configure, output a better 'we are…
124 {
125 no warnings;
126 print "Cleaning up ...\n";
127 if (open my $CLEAN, '-|', "$make clean") {
128 my @slurp = <$CLEAN>;
129 close($CLEAN);
130 }
131 }
132
133 if ($options{'make-install'}) {
134 system_or_die($make);
135 system_or_die($make, 'install');
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
136 print "\n$lang has been built and installed.\n";
424a6df4 » pmichaud
2011-06-08 Force a "make clean" after running Configure, output a better 'we are…
137 }
138 else {
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
139 print "\nYou can now use '$make' to build $lang.\n";
424a6df4 » pmichaud
2011-06-08 Force a "make clean" after running Configure, output a better 'we are…
140 print "After that, '$make test' will run some tests and\n";
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
141 print "'$make install' will install $lang.\n";
424a6df4 » pmichaud
2011-06-08 Force a "make clean" after running Configure, output a better 'we are…
142 }
143
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
144 exit 0;
5948c118 » pmichaud
2009-06-18 Allow Parrot VERSION to be used in cases when the svn revision
145 }
146
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
147
148 # Print some help text.
149 sub print_help {
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
150 print <<"END";
151 Configure.pl - $lang Configure
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
152
153 General Options:
154 --help Show this text
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
155 --prefix=dir Install files in dir
412a42e7 » pmichaud
2011-06-08 Update Configure.pl --help text.
156 --with-nqp=path/to/bin/nqp
05e5fabb » pmichaud
2011-06-08 Parameterize Configure.pl so it can potentially be used by languages …
157 NQP executable to use to build $lang
412a42e7 » pmichaud
2011-06-08 Update Configure.pl --help text.
158 --gen-nqp[=branch]
159 Download and build a copy of NQP
160 --with-parrot=path/to/bin/parrot
7ec8cf26 » pmichaud
2011-06-08 New Configure/build system, part 1.
161 Parrot executable to use to build NQP
412a42e7 » pmichaud
2011-06-08 Update Configure.pl --help text.
162 --gen-parrot[=branch]
163 Download and build a copy of Parrot
6dcae2e7 » pmichaud
2011-06-10 Add --parrot-option to Configure.pl.
164 --parrot-option='--option'
165 Options to pass to Parrot's Configure.pl
ced04f71 » felher
2012-03-02 enable Configure.pl to pass options to Parrot's make
166 --parrot-make-option='--option'
167 Options to pass to Parrot's make, for example:
168 --parrot-make-option='--jobs=4'
412a42e7 » pmichaud
2011-06-08 Update Configure.pl --help text.
169 --makefile-timing Enable timing of individual makefile commands
d5237b9e » pmichaud
2011-06-08 Update --help text to tell about config.default.
170
171 Configure.pl also reads options from 'config.default' in the current directory.
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
172 END
f9cb35e0 » petdance
2009-02-26 modernize some code, and add error checking
173
174 return;
7d7f1aff » Patrick R. Michaud
2009-02-04 Update Configure.pl with some help messages and options.
175 }
46f5a490 » moritz
2009-02-08 Apply coding style fix by François Perrad, fperrad++
176
177 # Local Variables:
178 # mode: cperl
179 # cperl-indent-level: 4
180 # fill-column: 100
181 # End:
182 # vim: expandtab shiftwidth=4:
Something went wrong with that request. Please try again.