![Eelco Dolstra](/assets/img/avatar_default.png)
* A solution to the library abstraction problem (i.e., if package X needs library Y, and library Y needs library Z, then we do not (generally) want to declare Z as a input to X since that would break abstraction). This was not possible under the old Nix. svn path=/nixpkgs/trunk/; revision=150
50 lines
1.2 KiB
Perl
Executable file
50 lines
1.2 KiB
Perl
Executable file
#! /usr/bin/perl -w
|
|
|
|
use strict;
|
|
use Cwd;
|
|
|
|
my $selfdir = $ENV{"out"};
|
|
mkdir "$selfdir", 0755 || die "error creating $selfdir";
|
|
|
|
# For each activated package, create symlinks.
|
|
|
|
sub createLinks {
|
|
my $srcdir = shift;
|
|
my $dstdir = shift;
|
|
|
|
my @srcfiles = glob("$srcdir/*");
|
|
|
|
foreach my $srcfile (@srcfiles) {
|
|
my $basename = $srcfile;
|
|
$basename =~ s/^.*\///g; # strip directory
|
|
my $dstfile = "$dstdir/$basename";
|
|
if (-d $srcfile) {
|
|
# !!! hack for resolving name clashes
|
|
if (!-e $dstfile) {
|
|
mkdir $dstfile, 0755 ||
|
|
die "error creating directory $dstfile";
|
|
}
|
|
-d $dstfile or die "$dstfile is not a directory";
|
|
createLinks($srcfile, $dstfile);
|
|
} elsif (-l $dstfile) {
|
|
my $target = readlink($dstfile);
|
|
die "collission between $srcfile and $target";
|
|
} else {
|
|
# print "linking $dstfile to $srcfile\n";
|
|
symlink($srcfile, $dstfile) ||
|
|
die "error creating link $dstfile";
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach my $name (keys %ENV) {
|
|
|
|
next unless ($name =~ /^act.*$/);
|
|
|
|
my $pkgdir = $ENV{$name};
|
|
|
|
print "merging $pkgdir\n";
|
|
|
|
createLinks("$pkgdir", "$selfdir");
|
|
}
|