-
Notifications
You must be signed in to change notification settings - Fork 138
/
charset.pm
97 lines (66 loc) · 1.99 KB
/
charset.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright (C) 2001-2003, The Perl Foundation.
# $Id$
=head1 NAME
config/inter/charset.pm - charset files
=head1 DESCRIPTION
Asks the user to select which charset files to include.
=cut
package inter::charset;
use strict;
use warnings;
use File::Basename qw/basename/;
use base qw(Parrot::Configure::Step);
use Parrot::Configure::Utils ':inter';
sub _init {
my $self = shift;
my %data;
$data{description} = q{Determining what charset files should be compiled in};
$data{result} = q{};
return \%data;
}
my @charsets_defaults =
defined( $ENV{TEST_CHARSET} )
? $ENV{TEST_CHARSET}
: sort map { basename($_) } glob "./src/charset/*.c";
sub runstep {
my ( $self, $conf ) = @_;
my @charset = @charsets_defaults;
my $charset_list = join ( ' ', grep { defined $_ } @charset );
if ( $conf->options->get('ask') ) {
print <<"END";
The following charsets are available:
@charset
END
$charset_list = prompt(
'Which charsets would you like?',
$charset_list
);
}
# names of class files for src/pmc/Makefile
( my $TEMP_charset_o = $charset_list ) =~ s/\.c/\$(O)/g;
my $TEMP_charset_build = <<"E_NOTE";
# the following part of the Makefile was built by 'config/inter/charset.pm'
E_NOTE
foreach my $charset ( split( /\s+/, $charset_list ) ) {
$charset =~ s/\.c$//;
$TEMP_charset_build .= <<END
src/charset/$charset\$(O): src/charset/$charset.h src/charset/ascii.h src/charset/$charset.c \$(NONGEN_HEADERS)
END
}
# build list of libraries for link line in Makefile
my $slash = $conf->data->get('slash');
$TEMP_charset_o =~ s/^| / src${slash}charset${slash}/g;
$conf->data->set(
charset => $charset_list,
TEMP_charset_o => $TEMP_charset_o,
TEMP_charset_build => $TEMP_charset_build,
);
return 1;
}
1;
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: