Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 98 lines (73 sloc) 2.108 kb
04f9724 Add configure script, piggy-backing on parrot's reconfigure to generate
wcoleda authored
1 #! perl
2
3 use strict;
4 use warnings;
be1652f Add a command-line option to Configure.pl, to pass in a full path to …
wcoleda authored
5 use Getopt::Long;
04f9724 Add configure script, piggy-backing on parrot's reconfigure to generate
wcoleda authored
6
c88d762 Add Parrot::Installed.pm
wcoleda authored
7 use Fatal qw(open);
8
be1652f Add a command-line option to Configure.pl, to pass in a full path to …
wcoleda authored
9 my %options;
10 GetOptions(\%options, 'parrot-config=s', 'help|?') or usage();
11 usage() if $options{'help'};
12
13 my $config = $options{'parrot-config'} || "parrot_config";
14
15 my $perlbin = `$config perl`
16 or die "Unable to find parrot_config, $config";
17 my $libdir = `$config libdir`;
d7c074d Instead of having a hardcoded shebang for the parrot only tests,
wcoleda authored
18 my $bindir = `$config bindir`;
be1652f Add a command-line option to Configure.pl, to pass in a full path to …
wcoleda authored
19 my $versiondir = `$config versiondir`;
20 my $slash = `$config slash`;
21 my $make = `$config make`;
72b645a Move closer to building against an installed parrot.
wcoleda authored
22
23 chomp($perlbin);
24 chomp($libdir);
25 chomp($versiondir);
26 chomp($slash);
27 chomp($make);
28
29 my $build_tool = $perlbin . " "
30 . $libdir
31 . $versiondir
32 . $slash
33 . "tools"
34 . $slash
35 . "dev"
36 . $slash
37 . "gen_makefile.pl";
38
39 my %makefiles = (
40 "config/makefiles/root.in" => "Makefile",
41 "config/makefiles/pmc.in" => "src/pmc/Makefile",
42 "config/makefiles/ops.in" => "src/ops/Makefile",
43 );
44
45 foreach my $template (keys %makefiles) {
46 my $makefile = $makefiles{$template};
47 print "Creating $makefile\n";
48 system("$build_tool $template $makefile");
49 }
50
c88d762 Add Parrot::Installed.pm
wcoleda authored
51
52 print "Creating Parrot::Installed\n";
53
54 open my $fh, '>', 'lib/Parrot/Installed.pm';
55
56 print {$fh} "package Parrot::Installed;\n";
57 print {$fh} "use lib qw(${libdir}${versiondir}/tools/lib);\n";
58 print {$fh} "1;\n";
59
d7c074d Instead of having a hardcoded shebang for the parrot only tests,
wcoleda authored
60 print "Generating miscellaneous files\n";
61
62 my $parrot = "$bindir/parrot";
63 add_shebang($parrot, "t/internals/select_switches.t", "t/internals/select_switches_t.in");
64 add_shebang($parrot, "t/internals/select_option.t", "t/internals/select_option_t.in");
65
66
72b645a Move closer to building against an installed parrot.
wcoleda authored
67 print <<"END";
68
b06e5a0 We like lowercase.
wcoleda authored
69 You can now use '$make' to build partcl.
72b645a Move closer to building against an installed parrot.
wcoleda authored
70 END
71
72 exit;
be1652f Add a command-line option to Configure.pl, to pass in a full path to …
wcoleda authored
73
74 sub usage {
75 die <<"EOM"
76 Usage: $0 [--parrot-config=/path/to/parrot_config]
77 EOM
78 }
d7c074d Instead of having a hardcoded shebang for the parrot only tests,
wcoleda authored
79
80 sub add_shebang {
81 my $exe = shift;
82 my $target = shift;
83 my $source = shift;
84
85 my $shebang = "#!$exe";
86
87 my $contents;
88 {
89 local undef $/;
90 open my $fh, '<', $source;
91 $contents = <$fh>;
92 }
93
94 open my $ofh, '>', $target;
95 print {$ofh} $shebang, "\n";
96 print {$ofh} $contents;
97 }
Something went wrong with that request. Please try again.