Web inteface: nicer system error page, and introduced a bug (OK, a photo of a bug :-)
[openxpki.git] / trunk / package / freebsd / get-final-plist.pl
blob8063792fefbfea3586091f3f09119461e2f7ff5b
1 #!/usr/bin/perl
2 ##
3 ## Written 2006 by Julia Dubenskaya
4 ## for the OpenXPKI project
5 ## (C) Copyright 2006 by The OpenXPKI Project
7 use strict;
8 use warnings;
9 use Cwd;
11 my $man1 = "MAN1=";
12 my $man3 = "MAN3=";
13 my $line = "";
14 my ${PORT_NAME}=$ARGV[0];
15 my ${PKGNAME_PREFIX}="p5-";
16 my ${PORT_PATH}=cwd;
18 open(SOURCE_FILE,"<${PORT_PATH}/pkg-plist.0");
19 open(TARGET_FILE,">${PORT_PATH}/pkg-plist");
20 while ($line = <SOURCE_FILE>) {
21 chomp($line);
22 $line =~ s/\.gz$//;
23 $line =~ s/lib\/perl5\/5.8.8\/man\/man3\//\t/;
24 $line =~ s/man\/man1\//\t/;
25 $line =~ s/lib\/perl5\/site_perl\/5.8.8/\%\%SITE_PERL\%\%/;
26 $line =~ s/\/mach\//\/\%\%PERL_ARCH\%\%\//;
27 $line =~ s/share\/${PORT_NAME}/\%\%DATADIR\%\%/;
28 $line =~ s/(dirrm)([^t])/$1try$2/;
29 $line =~ s/share\/examples\/${PORT_NAME}/\%\%EXAMPLESDIR\%\%/;
30 $line =~ s/share\/doc\/${PORT_NAME}/\%\%DOCSDIR\%\%/;
32 $line =~ s/\A(.*\%\%DOCSDIR\%\%)/\%\%PORTDOCS\%\%$1/;
33 $line =~ s/\A(.*\%\%DATADIR\%\%)/\%\%PORTDATA\%\%$1/;
34 $line =~ s/\A(.*\%\%EXAMPLESDIR\%\%)/\%\%PORTEXAMPLES\%\%$1/;
36 if ($line =~ m/\.1$/) {
37 $man1 .= $line." \\\n";
39 elsif ($line =~ m/\.3$/) {
40 $man3 .= $line." \\\n" if ($line =~ m/\.3$/);
42 else {
43 print TARGET_FILE "$line\n" if (($line !~ m/share\/nls/) and
44 (($line !~ m/dirrm/) or
45 ($line =~ m/openxpki/i) or ($line =~ m/DATADIR/i) or
46 ($line =~ m/DOCSDIR/i) or
47 ($line =~ m/EXAMPLESDIR/) or ($line =~ m/share/)
52 close(SOURCE_FILE);
53 close(TARGET_FILE);
55 $man1 =~ s/ \\$//;
56 $man3 =~ s/ \\$//;
58 open(SOURCE_MAKEFILE,"<${PORT_PATH}/Makefile.bak");
59 open(TARGET_MAKEFILE,">${PORT_PATH}/Makefile");
61 my $MAKEFILE_DATA = "";
62 while ($line = <SOURCE_MAKEFILE>) {
63 chomp($line);
64 $MAKEFILE_DATA .= $line."\n";
67 $MAKEFILE_DATA =~ s/MAN1=(.*\s*)*\.1\s/$man1/m;
68 $MAKEFILE_DATA =~ s/MAN3=(.*\s*)*\.3\s/$man3/m;
70 print TARGET_MAKEFILE $MAKEFILE_DATA;
72 close(SOURCE_MAKEFILE);
73 close(TARGET_MAKEFILE);