nixpkgs/pkgs/build-support/mono-dll-fixer/dll-fixer.pl
Eelco Dolstra 9efa069a65 * Added a tool `mono-dll-fixer' to absolutise the DLL maps in the
`*.dll.config' files corresponding to CLR assemblies.  I.e., the
  full path to native libraries is included in the maps.  In effect
  this allows us to set the equivalent of an RPATH for assemblies.

* gtk-sharp: use the DLL fixer.  It's not perfect yet: I still have to
  set the LD_LIBRARY_PATH for monodoc to include the gtk-sharp lib
  directory itself, so that it can find the `*sharpglue.so' files.
  This seems to be gtk-sharp's fault; it doesn't have an entry for
  those libraries in its DLL maps.

svn path=/nixpkgs/trunk/; revision=2330
2005-03-03 17:19:58 +00:00

33 lines
643 B
Perl

#! @perl@ -w
use strict;
my @paths = split ' ', $ENV{"ALL_INPUTS"};
open IN, "<$ARGV[0]" or die;
open OUT, ">$ARGV[0].tmp" or die;
while (<IN>) {
# !!! should use a real XML library here.
if (!/<dllmap dll="(.*)" target="(.*)"\/>/) {
print OUT;
next;
}
my $dll = $1;
my $target = $2;
foreach my $path (@paths) {
my $fullPath = "$path/lib/$target";
if (-e "$fullPath") {
$target = $fullPath;
last;
}
}
print OUT " <dllmap dll=\"$dll\" target=\"$target\"/>\n";
}
close IN;
rename "$ARGV[0].tmp", "$ARGV[0]" or die "cannot rename $ARGV[0]";