diff options
author | Reinhard Tartler <siretart@tauware.de> | 2009-03-31 15:58:19 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2009-03-31 15:58:19 +0200 |
commit | 25db897553a0db0f912602b375029e724f51556e (patch) | |
tree | 613c8c23e22481e31a4d2f474e022ad87728da24 /infrastructure/setupexternal.pl | |
parent | 2787035d98661881477d696403ca2a78b49322d5 (diff) |
Import upstream version 0.11~rc2+r2072
Diffstat (limited to 'infrastructure/setupexternal.pl')
-rwxr-xr-x | infrastructure/setupexternal.pl | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/infrastructure/setupexternal.pl b/infrastructure/setupexternal.pl new file mode 100755 index 00000000..87ec5560 --- /dev/null +++ b/infrastructure/setupexternal.pl @@ -0,0 +1,55 @@ +#!@PERL@ +use strict; + +# This script links in the essential directories and processes various +# files to allow the Box libraries to be used in projects outside the main +# box library tree. + +# directories to link through +my @linkdirs = qw/lib infrastructure/; + +# ---------------------------------------------------- + +my $libdir = $ARGV[0]; +die "Provided library dir $libdir does not exist" unless -d $libdir; + +# Check and remove links from the directory, then add new symlinks +for my $d (@linkdirs) +{ + if(-e $d) + { + die "In project, $d is not a symbolic link" + unless -l $d; + print "Removing existing symlink $d\n"; + unlink $d; + } + my $link_target = "$libdir/$d"; + print "Add symlink $d -> $link_target\n"; + die "Can't create symlink $d" unless + symlink $link_target, $d; +} + +# Copy and create a base modules file which includes all the libraries +print "Create new modules_base.txt file\n"; +open OUT,">modules_base.txt" or die "Can't open modules_base.txt file for writing"; +print OUT <<__E; +# +# Automatically generated file, do not edit +# +# Source: $libdir/modules.txt +# + +__E + +open IN,"$libdir/modules.txt" or die "Can't open $libdir/modules.txt for reading"; + +while(<IN>) +{ + if(m/\A(lib\/.+?)\s/) + { + print OUT + } +} + +close IN; +close OUT; |