removed parameter_t
[swftools.git] / lib / pdf / inject-xpdf.pl
1 #!/usr/bin/perl
2
3 $filename = $ARGV[0];
4
5 $filename or die "no filename";
6
7 $directory = $filename;
8 $directory =~ s/.tar.gz$//g;
9
10 mkdir("$directory");
11 mkdir("$directory/tmp/");
12
13 chdir("$directory/tmp/") or die;
14 system("tar -zxvf ../../$filename") and die;
15 system("find -type f -exec mv {} .. \\;") and die;
16 chdir("..");
17 system("find -type d -exec rmdir {} \\; 2> /dev/null");
18
19 $c = 'find . \( -name "*.cc" -or -name "*.h" -or -name "*.c" \) -exec cp {} {}.orig \;';
20 print "$c\n";
21 system($c);
22
23 system("patch < ../xpdf-changes.patch 2>&1 | grep failed");
24 chdir("..");
25 system("rm -f xpdf");
26 system("ln -s $directory xpdf");
27
28 open(fi, ">switch");
29
30 print fi <<EOF
31 #!/bin/sh
32
33 VERSION=\$1
34 PS3="choose> "
35
36 if test "x\$VERSION" = "x";then
37     select V in stable latest;do VERSION="\$V";break;done
38 fi
39 if test "x\$VERSION" = "xstable";then
40     echo "Switching to stable version"
41     rm -f xpdf
42     ln -s xpdf-3.02 xpdf
43 elif test "x\$VERSION" = "xlatest";then
44     echo "Switching to latest version"
45     rm -f xpdf
46     ln -s $directory xpdf
47 fi
48 EOF
49 ;
50 close(fi);
51 system("chmod a+x switch");
52
53