pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / mono-dll-fixer / dll-fixer.pl
blob4a8b468692f0c49fa8455ef87db8c673091062d7
1 #! @perl@ -w
3 use strict;
5 my @paths = split ' ', $ENV{"ALL_INPUTS"};
7 open IN, "<$ARGV[0]" or die;
8 open OUT, ">$ARGV[0].tmp" or die;
10 while (<IN>) {
11 # !!! should use a real XML library here.
12 if (!/<dllmap dll="(.*)" target="(.*)"\/>/) {
13 print OUT;
14 next;
16 my $dll = $1;
17 my $target = $2;
19 foreach my $path (@paths) {
20 my $fullPath = "$path/lib/$target";
21 if (-e "$fullPath") {
22 $target = $fullPath;
23 last;
27 print OUT " <dllmap dll=\"$dll\" target=\"$target\"/>\n";
30 close IN;
32 rename "$ARGV[0].tmp", "$ARGV[0]" or die "cannot rename $ARGV[0]";