File: eplibxslt.MAKEPL

package info (click to toggle)
libembperl-perl 2.5.0-17
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,632 kB
  • sloc: ansic: 21,387; perl: 14,497; javascript: 4,280; cpp: 467; xml: 49; makefile: 35; sh: 24
file content (158 lines) | stat: -rwxr-xr-x 3,725 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158

use File::Spec ;
use File::Find ;
use Cwd ;
use ExtUtils::PkgConfig ;

$win32 = ($^O eq 'MSWin32') ;

my $prefix  ;
my $prefix2  ;
my $libs  ;
my $libs2  ;
my $cflags  ;
my $cflags2  ;
my $version ;
my $version2 ;

if (!$win32)
    {
    my $pkg = 'libxml-2.0';
    my %xml2_info = ExtUtils::PkgConfig->find ($pkg) ;
    $version = $xml2_info{modversion} ;
    $libs    = $xml2_info{libs} ;
    $cflags  = $xml2_info{cflags} ;
    $prefix  = ExtUtils::PkgConfig->variable($pkg, 'exec_prefix') ;

    print "Found libxml2 $version installed under $prefix\n" ;

    $pkg = 'libxslt';
    my %xslt_info = ExtUtils::PkgConfig->find ($pkg) ;
    $version2 = $xslt_info{modversion} ;
    $libs2    = $xslt_info{libs} ;
    $cflags2  = $xslt_info{cflags} ;
    $prefix2  = ExtUtils::PkgConfig->variable($pkg, 'exec_prefix') ;

    print "Found libxslt $version2 installed under $prefix2\n" ;
    
    
    return { cflags => "$cflags $cflags2", 
             libs => "$libs $libs2", 
             inc => $prefix eq $prefix2?"-I$prefix/include":"-I$prefix/include -I$prefix2/include",
             defines => '-DLIBXSLT',
             objects => 'driver/eplibxslt$(OBJ_EXT)',
             save    => { '$LIBXSLTVERSION' => $version2 }} ;
    }


$path = $ENV{LIBXSLTPATH} || GetString ("Enter path of the directory where you have extracted libxml2 and libxslt or single dot for not using libxml", $LIBXSLTPATH) ;

return undef if (!$path || $path eq '.') ;

my $currdir = Cwd::fastcwd ;

eval { find (\&libxslt, $path) ; } ;
$@ = '' ;
chdir ($currdir);
if (!$libxslt)
    {
    print "libxslt.lib library not found under $path\n" ;
    return undef ;
    }

eval { find (\&libxml2, $path) ; } ;
$@ = '' ;
chdir ($currdir);
if (!$libxml2)
    {
    print "libxml2.lib library not found under $path\n" ;
    return undef ;
    }

eval { find (\&iconv, $path) ; } ;
$@ = '' ;
chdir ($currdir);
if (!$iconv)
    {
    print "iconv.lib library not found under $path\n" ;
    return undef ;
    }

$path = File::Spec -> canonpath ($path) ;
$inc1 = File::Spec -> canonpath ("$libxsltpath/../include") ;
$inc2 = File::Spec -> canonpath ("$libxml2path/../include") ;
$inc3 = File::Spec -> canonpath ("$iconvpath/../include") ;

print "libxslt and libxml2 found under $libxsltpath and $libxml2path\n" ;

return { 
         libs => "-L\"$libxsltpath\" -L\"$libxml2path\"  -L\"$iconvpath\" -l$libxslt -l$libxml2 -l$iconv", 
         cflags => "-I\"$inc1\" -I\"$inc2\" -I\"$inc3\"",
         defines => '-DLIBXSLT',
         objects => 'driver/eplibxslt$(OBJ_EXT)',
         save    => { 
                    '$LIBXSLTVERSION' => '2x',
                    '$LIBXSLTPATH'    => $path,
                     }} ;



sub libxslt

    {
    if ($File::Find::dir ne $path && (($File::Find::dir =~ m#/\.#) || ($File::Find::dir !~ /libxslt/)))
        {
        $File::Find::prune = 1 ;
        return ;
        } 

    if (/^libxslt\.lib/i)
        {
        $libxsltpath = $File::Find::dir ;
        die $libxslt = $_ ;
        }
    }


sub libxml2

    {
    if ($File::Find::dir ne $path && (($File::Find::dir =~ m#/\.#) || ($File::Find::dir !~ /libxml2/)))
        {
        $File::Find::prune = 1 ;
        return ;
        } 

    if (/^libxml2\.lib/i)
        {
        $libxml2path = $File::Find::dir ;
        die $libxml2 = $_ ;
        }
    }



sub iconv

    {
    if ($File::Find::dir ne $path && (($File::Find::dir =~ m#/\.#) || ($File::Find::dir !~ /iconv/)))
        {
        $File::Find::prune = 1 ;
        return ;
        } 

    if (/^iconv\.lib/i)
        {
        $iconvpath = $File::Find::dir ;
        die $iconv = $_ ;
        }
    }






print "libxml2/libxslt is currently not supported on Win32\n" ;
return undef ;