Commit | Line | Data |
b3407611 |
1 | #!/usr/bin/env perl |
4536f655 |
2 | |
b3407611 |
3 | use strict ; |
4 | use warnings ; |
4536f655 |
5 | |
b3407611 |
6 | use Config ; |
7 | use File::Spec ; |
4536f655 |
8 | use BuildStem ; |
b3407611 |
9 | use Data::Dumper ; |
4536f655 |
10 | |
b3407611 |
11 | # I wonder if I should add the ability to put the Docs and Design etc |
12 | # directories in apropriate spots, like |
13 | # /usr/local/share/stem (site) or /usr/share/stem (vendor) |
4536f655 |
14 | |
15 | my %requires ; |
16 | |
17 | my $version_from = File::Spec->catfile( File::Spec->curdir, 'lib', 'Stem.pm' ); |
18 | |
19 | my $build = BuildStem->new( |
b3407611 |
20 | #my $build = $class->new( |
4536f655 |
21 | module_name => 'Stem', |
22 | dist_version_from => $version_from, |
23 | requires => \%requires, |
b3407611 |
24 | dist_abstract => 'ABSTRACT GOES HERE', |
4536f655 |
25 | license => 'gpl', |
26 | dynamic_config => 1, |
27 | recursive_test_files => 1, |
28 | create_makefile_pl => 'passthrough' |
29 | ); |
30 | |
4536f655 |
31 | |
b3407611 |
32 | |
33 | $build->is_unixish() || die "Stem currently only installs properly on *nix-like platforms.\n"; |
34 | |
35 | ### this will come in handy for some refactoring... |
36 | ## $build->config( 'install_base' ) |
37 | |
38 | print <<'EOT'; |
39 | |
b3407611 |
40 | Stem comes with a utility called 'run_stem' which takes care of things |
3e03d89e |
41 | like initalizing Stem with a configuration file and controlling it's |
42 | operation via various parameters you can pass in as environment |
43 | variables or command line arguments. |
b3407611 |
44 | |
45 | Stem configuration files are used to create and initialize Stem Cells |
3e03d89e |
46 | (objects). run_stem can search a path list for config files, so you |
b3407611 |
47 | can set that list of directories here. |
48 | |
49 | Note that you can easily override this path with either a shell environment |
50 | variable or on the command line of run_stem. See the documentation on |
51 | run_stem for how so do this. |
52 | |
53 | The last directory in the list is where the standard and demo Stem |
54 | configuration files will be installed. |
55 | |
b3407611 |
56 | EOT |
57 | |
58 | my $conf_path = $build->prompt( |
3e03d89e |
59 | "Please enter a list of directory paths separated by ':'\n", |
b3407611 |
60 | '.:~/.stem/conf:/usr/local/stem/conf' |
61 | ); |
62 | $build->config_data(conf_path => $conf_path); |
63 | |
64 | |
65 | |
b3407611 |
66 | print "\n\nChecking to see if you have a good C compiler...\n\n" ; |
67 | if ( $build->have_c_compiler() ) { |
68 | print <<'EOT'; |
3e03d89e |
69 | |
70 | |
b3407611 |
71 | ssfe (Split Screen Front End) is a compiled program optionally used by |
72 | the Stem demonstration scripts that provides a full screen interface |
73 | with command line editing and history. It is not required to run Stem |
74 | but it makes the demonstrations easier to work with and they look much |
75 | nicer. To use ssfe add the '-s' option when you run any demonstration |
3e03d89e |
76 | script. You can also use ssfe for your own programs. If you build ssfe |
77 | it will be installed in the demo/ directory. You may copy it to a place |
78 | in your $PATH is you wish. |
b3407611 |
79 | |
80 | EOT |
3e03d89e |
81 | my $build_ssfe = $build->y_n("Do you want to build ssfe?\n", 'y'); |
82 | $build->config_data(build_ssfe => $build_ssfe); |
b3407611 |
83 | } |
84 | |
b3407611 |
85 | |
86 | print <<'EOT'; |
87 | |
3e03d89e |
88 | Stem comes with a variety of demos to show how to get started and do some |
89 | basic things. If you wish, they can be configured to run locally out of the |
90 | demo/ directory. |
b3407611 |
91 | |
92 | EOT |
3e03d89e |
93 | my $build_demos = $build->y_n("\nDo you want to build the demos?\n",'y'); |
94 | $build->config_data(build_demos => $build_demos); |
95 | if ( $build_demos ) { |
b3407611 |
96 | |
97 | # Check for telnet |
98 | my $telnet_path = $build->find_binary( 'telnet' ) || '' ; |
99 | while ( ! -x $telnet_path && ! $build->_is_unattended() ) { |
100 | print <<'EOT'; |
101 | |
b3407611 |
102 | telnet was not found on this system. you can't run the demo programs |
103 | without telnet. Make sure you enter a valid path to telnet or some other |
104 | terminal emulator. |
105 | |
106 | NOTE: If you don't have an telnet, you can still run the demo scripts |
107 | by hand. Run a *_demo script and see what telnet commands it |
108 | issues. The run those telnet commands using your telnet or another |
109 | similar program. |
110 | |
111 | EOT |
112 | $telnet_path = $build->prompt( |
113 | "Enter the path to telnet " |
114 | . "(or another compatible telnet client)", |
115 | '/usr/bin/telnet' |
116 | ) ; |
117 | } |
118 | $build->config_data( telnet_path => $telnet_path ) ; |
119 | |
120 | |
121 | # Check for xterm |
122 | my $xterm_path = $build->find_binary( 'xterm' ) || '' ; |
123 | while ( ! -x $xterm_path && ! $build->_is_unattended() ) { |
124 | print <<'EOT'; |
125 | |
126 | |
127 | xterm was not found on this system. you can't run the demo programs |
128 | without xterm. Make sure you enter a valid path to xterm or some other |
129 | terminal emulator. |
130 | |
131 | NOTE: If you don't have an xterm, you can still run the demo scripts |
132 | by hand. Run a *_demo script and see what commands it issues. Take the |
133 | part after the -e and run that command in its own terminal window. |
134 | |
135 | EOT |
136 | $xterm_path = $build->prompt( |
137 | "Enter the path to xterm " |
138 | . "(or another compatible terminal emulator)", |
139 | '/usr/bin/xterm' |
140 | ) ; |
3e03d89e |
141 | } |
b3407611 |
142 | $build->config_data( xterm_path => $xterm_path ) ; |
143 | |
144 | } |
145 | |
146 | |
147 | |
148 | my $script_dest = $build->install_destination('script') ; |
149 | my $run_stem_path = File::Spec->catfile( $script_dest, 'run_stem' ) ; |
150 | $build->config_data( run_stem_path => $run_stem_path ) ; |
151 | |
152 | |
153 | |
154 | |
155 | my $bin_path = $build->install_destination('bin') ; |
156 | $build->config_data( bin_path => $bin_path ) ; |
157 | |
158 | $build->config_data( perl_path => $build->config( 'perlpath' ) ) ; |
159 | |
160 | # Several different prefixes... which one to use?? |
161 | #$build->config_data( prefix => $build->prefix() ) ; |
162 | $build->config_data( prefix => $build->config( 'install_base' ) ) ; |
163 | |
164 | |
165 | $build->config_data( config_done => 1 ) ; |
166 | |
167 | |
168 | #print Dumper \%{ $build->config_data() }; |
169 | |
4536f655 |
170 | |
171 | $build->create_build_script() ; |
172 | |
173 | exit ; |
b3407611 |
174 | |
175 | 1 ; |