X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Build.PL;fp=Build.PL;h=2939b1751e68f949471a148b0514594c691d5b4e;hb=09baddbd49de087e08177d20594c9d313b542949;hp=702ee1a39f35a6d4c3c8d9c3282232e5e64f691c;hpb=56f74ebb051e474ced234286cd79303f3e9cd14c;p=urisagit%2FStem.git diff --git a/Build.PL b/Build.PL index 702ee1a..2939b17 100644 --- a/Build.PL +++ b/Build.PL @@ -5,146 +5,178 @@ use warnings ; use Config ; use File::Spec ; -use BuildStem ; use Data::Dumper ; -# I wonder if I should add the ability to put the Docs and Design etc -# directories in apropriate spots, like -# /usr/local/share/stem (site) or /usr/share/stem (vendor) - -my %requires ; +use BuildStem ; -my $version_from = File::Spec->catfile( File::Spec->curdir, 'lib', 'Stem.pm' ); +my $version_from = File::Spec->catfile( + File::Spec->curdir, 'lib', 'Stem.pm' +); my $build = BuildStem->new( -#my $build = $class->new( - module_name => 'Stem', - dist_version_from => $version_from, - requires => \%requires, - dist_abstract => 'ABSTRACT GOES HERE', - license => 'gpl', - dynamic_config => 1, - recursive_test_files => 1, - create_makefile_pl => 'passthrough' + module_name => 'Stem', + dist_version_from => $version_from, + requires => { + YAML => 0, + }, + dist_abstract => + 'An asynchronous message passing framework for Perl', + license => 'gpl', + dynamic_config => 1, + recursive_test_files => 1, + needs_compiler => 0, + recommends => { + DBI => 0, + Event => 0, + }, + create_makefile_pl => 'passthrough' ); -$build->is_unixish() || die "Stem currently only installs properly on *nix-like platforms.\n"; +$build->is_unixish() or + die "Stem currently only installs properly on *nix-like platforms.\n"; -### this will come in handy for some refactoring... -## $build->config( 'install_base' ) -print <<'EOT'; +### ask about the config path and where to install bundled config files -Stem comes with a utility called 'run_stem' which takes care of things -like initalizing Stem with a configuration file and controlling it's -operation via various parameters you can pass in as environment -variables or command line arguments. +print <<'EOT'; -Stem configuration files are used to create and initialize Stem Cells -(objects). run_stem can search a path list for config files, so you -can set that list of directories here. +Stem configuration files are used to create and initialize Stem Cells. +An included program called 'run_stem' will search a default path for +a specified config file and use it to get everything going. You can see +this in action if you check out Stem's demo scripts. Note that you can easily override this path with either a shell environment -variable or on the command line of run_stem. See the documentation on -run_stem for how so do this. - -The last directory in the list is where the standard and demo Stem -configuration files will be installed. +variable or a command line agrument. See the documentation on run_stem for +how to do this. EOT -my $conf_path = $build->prompt( - "Please enter a list of directory paths separated by ':'\n", +$build->config_data( + conf_path => scalar $build->prompt( + "Please enter a list of directory paths separated by ':'\n", '.:~/.stem/conf:/usr/local/stem/conf' + ) ); -$build->config_data(conf_path => $conf_path); +print <<'EOT'; -print "\n\nChecking to see if you have a good C compiler...\n\n" ; -if ( $build->have_c_compiler() ) { - print <<'EOT'; +Where would you like to install the config files bundled with Stem? +If you specify a directory not already in the path above, it will be +appended. If this directory does not exist, it will be created. +EOT -ssfe (Split Screen Front End) is a compiled program optionally used by -the Stem demonstration scripts that provides a full screen interface -with command line editing and history. It is not required to run Stem -but it makes the demonstrations easier to work with and they look much -nicer. To use ssfe add the '-s' option when you run any demonstration -script. You can also use ssfe for your own programs. If you build ssfe -it will be installed in the demo/ directory. You may copy it to a place -in your $PATH is you wish. +$build->config_data( + conf_dir => scalar $build->prompt( + "Please enter a directory path:\n", + '/usr/local/stem/conf' + ) +); -EOT - my $build_ssfe = $build->y_n("Do you want to build ssfe?\n", 'y'); - $build->config_data(build_ssfe => $build_ssfe); +### add the conf_dir to the conf_path, if necessary +{ + my $conf_path = $build->config_data( 'conf_path' ); + my $conf_dir = $build->config_data( 'conf_dir' ); + if ( $conf_path =~ /(^|:)\Q$conf_dir\E(:|$)/ ) { + $build->config_data( conf_path => "$conf_path:$conf_dir" ); + } } + +### ask about building the demo scripts print <<'EOT'; Stem comes with a variety of demos to show how to get started and do some -basic things. If you wish, they can be configured to run locally out of the -demo/ directory. +basic things. If you wish to try them they will be available in the demo/ +directory after you run ./Build. In any case, they will not be installed +to the system, even after you install the rest of Stem. EOT -my $build_demos = $build->y_n("\nDo you want to build the demos?\n",'y'); -$build->config_data(build_demos => $build_demos); -if ( $build_demos ) { - # Check for telnet +$build->config_data( + build_demos => scalar $build->y_n( + "Do you want to build the demos?\n", 'y' + ) +); + + +if ( $build->config_data( 'build_demos' ) ) { + + + ### Try to find telnet my $telnet_path = $build->find_binary( 'telnet' ) || '' ; while ( ! -x $telnet_path && ! $build->_is_unattended() ) { print <<'EOT'; -telnet was not found on this system. you can't run the demo programs -without telnet. Make sure you enter a valid path to telnet or some other -terminal emulator. - -NOTE: If you don't have an telnet, you can still run the demo scripts -by hand. Run a *_demo script and see what telnet commands it -issues. The run those telnet commands using your telnet or another -similar program. +telnet was not found on this system. the demo programs won't run properly +without telnet. Please enter a valid path to telnet, or a single +to give up trying. EOT $telnet_path = $build->prompt( "Enter the path to telnet " . "(or another compatible telnet client)", - '/usr/bin/telnet' + '/usr/bin/telnet' ) ; + last if $telnet_path =~ s/^\w+$//; } - $build->config_data( telnet_path => $telnet_path ) ; + $build->config_data( telnet_path => $telnet_path || undef ) ; + + - # Check for xterm + # Try to find xterm my $xterm_path = $build->find_binary( 'xterm' ) || '' ; while ( ! -x $xterm_path && ! $build->_is_unattended() ) { - print <<'EOT'; + print <<'EOT'; + +xterm was not found on this system. the demo programs won't run properly +without xterm. Please enter a valid path to xterm or a single to +give up trying. + +EOT + $xterm_path = $build->prompt( + "Enter the path to xterm " + . "(or another compatible terminal emulator)", + '/usr/bin/xterm' + ) ; + last if $xterm_path =~ s/^\w+$//; + } + $build->config_data( xterm_path => $xterm_path || undef ) ; -xterm was not found on this system. you can't run the demo programs -without xterm. Make sure you enter a valid path to xterm or some other -terminal emulator. + ### Only build ssfe if we have a working C compiler + if ( $build->have_c_compiler() ) { + print <<'EOT'; -NOTE: If you don't have an xterm, you can still run the demo scripts -by hand. Run a *_demo script and see what commands it issues. Take the -part after the -e and run that command in its own terminal window. +ssfe (Split Screen Front End) is a compiled program optionally used by +the Stem demonstration scripts that provides a full screen interface +with command line editing and history. It is not required to run Stem +but it makes the demonstrations easier to work with and they look much +nicer. To use ssfe add the '-s' option when you run any demonstration +script. You can also use ssfe for your own programs. If you build ssfe +it will be installed in the demo/ directory. You may copy it to a place +in your $PATH is you wish. EOT - $xterm_path = $build->prompt( - "Enter the path to xterm " - . "(or another compatible terminal emulator)", - '/usr/bin/xterm' - ) ; + $build->config_data( + build_ssfe => scalar $build->y_n( + "Do you want to build ssfe for the demos?\n", 'y' + ) + ); + } } - $build->config_data( xterm_path => $xterm_path ) ; -} +### NOTE: find out whether or not each of the following +### config_data settings are actually being *used* for anything + my $script_dest = $build->install_destination('script') ; my $run_stem_path = File::Spec->catfile( $script_dest, 'run_stem' ) ; $build->config_data( run_stem_path => $run_stem_path ) ;