v1.7.3
[bioperl-live.git] / maintenance / symlink_script.pl
blobbf33fc5d4fde4b693c80aa8de0b474cf5b4a8e55
1 #!/usr/bin/perl
2 use Module::Build;
3 use strict;
4 use warnings;
6 my $build = Module::Build->current;
8 my %symlink_scripts = ('bp_bulk_load_gff.pl' => 'bp_pg_bulk_load_gff.pl');
10 #my $blib_dir = File::Spec->catdir($build->blib, 'script');
11 # using blib prior to installation, post build, always 'works', but the
12 # installation process installs the symlink as the actual file, so we may as
13 # well have just done a copy
15 my $install_dir = $build->install_destination('script');
16 $build->log_info("Will try to install symlinks to $install_dir\n");
17 my $orig_dir = $build->cwd;
18 chdir($install_dir);
20 while (my ($source, $destination) = each %symlink_scripts) {
21 if ($^O !~ /Win32/) {
22 eval { symlink($source, $destination) };
23 $build->log_warn("Cannot create symbolic link named $destination on your system for $source in $install_dir\n") if $@;
24 } else {
25 # Win32 perl does not implement symlink(), as it would not work on all filesystems.
26 require File::Copy;
27 eval { File::Copy::copy($source, $destination) };
28 $build->log_warn("Cannot create copy of script named $destination on your system for $source in $install_dir\n") if $@;
32 chdir($orig_dir);
34 exit;
36 __END__
38 =head1 NAME
40 symlink_script.pl - install script to create symbolic links
42 =head1 SYNOPSIS
44 perl Build.pl
45 ./Build install
47 =head1 DESCRIPTION
49 Used during "./Build install". Only works if the script installation directory
50 used during "perl Build.pl" matches that used for the actual installation during
51 "./Build install". So if you install to a special place, do
53 perl Build.pl --install_base /home/me
54 ./Build install
56 not
58 perl Build.pl
59 ./Build install --install_base /home/me
61 This script will create a symlink to a script in that same directory. It was
62 written to create a symlink with the name 'bp_pg_bulk_load_gff.pl' that targeted
63 'bp_bulk_load_gff.pl' but can be extended by adding files to the
64 %symlink_scripts hash.
66 Perl function 'symlink' is used to keep the script from crashing on systems
67 that don't allow symbolic linking.
69 =head1 SEE ALSO
71 =cut
73 =head1 FEEDBACK
75 =head2 Mailing Lists
77 User feedback is an integral part of the evolution of this and other
78 Bioperl modules. Send your comments and suggestions preferably to
79 the Bioperl mailing list. Your participation is much appreciated.
81 bioperl-l@bioperl.org - General discussion
82 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
84 =head2 Reporting Bugs
86 Report bugs to the Bioperl bug tracking system to help us keep track
87 of the bugs and their resolution. Bug reports can be submitted via the
88 web:
90 https://github.com/bioperl/bioperl-live/issues
92 =head1 AUTHOR - Sendu Bala
94 Email bix@sendu.me.uk
96 =cut