* Moved `nix-populate' here.

svn path=/nixpkgs/trunk/; revision=61
gstqt5
Eelco Dolstra 2003-05-26 14:03:24 +00:00
parent 4066121043
commit e501be70c6
2 changed files with 59 additions and 1 deletions

58
build/populate-linkdirs.pl Executable file
View File

@ -0,0 +1,58 @@
#! /usr/bin/perl -w
use strict;
use Cwd;
my $selfdir = cwd;
my @dirs = ("bin", "sbin", "lib", "include");
# Create the subdirectories.
mkdir $selfdir;
foreach my $dir (@dirs) {
mkdir "$selfdir/$dir";
}
# 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) or
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) or
die "error creating link $dstfile";
}
}
}
foreach my $name (keys %ENV) {
next unless ($name =~ /^act.*$/);
my $pkgdir = $ENV{$name};
print "merging $pkgdir\n";
foreach my $dir (@dirs) {
createLinks("$pkgdir/$dir", "$selfdir/$dir");
}
}

View File

@ -14,6 +14,6 @@ Descr(
, Bind("actPan", Fix("./pan-0.14.0.fix"))
, Bind("actSubversion", Fix("./subversion-0.21.0.fix"))
, Bind("build", Local("../../scripts/nix-populate"))
, Bind("build", Local("../build/populate-linkdirs.pl"))
]
)