edited to reflect the moving around of the demo files
[urisagit/Stem.git] / Build.PL
CommitLineData
b3407611 1#!/usr/bin/env perl
4536f655 2
b3407611 3use strict ;
4use warnings ;
4536f655 5
b3407611 6use Config ;
7use File::Spec ;
4536f655 8use BuildStem ;
b3407611 9use 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
15my %requires ;
16
17my $version_from = File::Spec->catfile( File::Spec->curdir, 'lib', 'Stem.pm' );
18
19my $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
38print <<'EOT';
39
b3407611 40Stem comes with a utility called 'run_stem' which takes care of things
3e03d89e 41like initalizing Stem with a configuration file and controlling it's
42operation via various parameters you can pass in as environment
43variables or command line arguments.
b3407611 44
45Stem 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 47can set that list of directories here.
48
49Note that you can easily override this path with either a shell environment
50variable or on the command line of run_stem. See the documentation on
51run_stem for how so do this.
52
53The last directory in the list is where the standard and demo Stem
54configuration files will be installed.
55
b3407611 56EOT
57
58my $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 66print "\n\nChecking to see if you have a good C compiler...\n\n" ;
67if ( $build->have_c_compiler() ) {
68 print <<'EOT';
3e03d89e 69
70
b3407611 71ssfe (Split Screen Front End) is a compiled program optionally used by
72the Stem demonstration scripts that provides a full screen interface
73with command line editing and history. It is not required to run Stem
74but it makes the demonstrations easier to work with and they look much
75nicer. To use ssfe add the '-s' option when you run any demonstration
3e03d89e 76script. You can also use ssfe for your own programs. If you build ssfe
77it will be installed in the demo/ directory. You may copy it to a place
78in your $PATH is you wish.
b3407611 79
80EOT
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
86print <<'EOT';
87
3e03d89e 88Stem comes with a variety of demos to show how to get started and do some
89basic things. If you wish, they can be configured to run locally out of the
90demo/ directory.
b3407611 91
92EOT
3e03d89e 93my $build_demos = $build->y_n("\nDo you want to build the demos?\n",'y');
94$build->config_data(build_demos => $build_demos);
95if ( $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 102telnet was not found on this system. you can't run the demo programs
103without telnet. Make sure you enter a valid path to telnet or some other
104terminal emulator.
105
106NOTE: If you don't have an telnet, you can still run the demo scripts
107by hand. Run a *_demo script and see what telnet commands it
108issues. The run those telnet commands using your telnet or another
109similar program.
110
111EOT
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
127xterm was not found on this system. you can't run the demo programs
128without xterm. Make sure you enter a valid path to xterm or some other
129terminal emulator.
130
131NOTE: If you don't have an xterm, you can still run the demo scripts
132by hand. Run a *_demo script and see what commands it issues. Take the
133part after the -e and run that command in its own terminal window.
134
135EOT
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
148my $script_dest = $build->install_destination('script') ;
149my $run_stem_path = File::Spec->catfile( $script_dest, 'run_stem' ) ;
150$build->config_data( run_stem_path => $run_stem_path ) ;
151
152
153
154
155my $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
173exit ;
b3407611 174
1751 ;