File: eplibxslt.MAKEPL

package info (click to toggle)
libembperl-perl 2.5.0~rc3-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 5,800 kB
  • sloc: ansic: 21,228; perl: 13,985; cpp: 467; xml: 49; makefile: 27; sh: 24
file content (174 lines) | stat: -rwxr-xr-x 4,244 bytes parent folder | download | duplicates (11)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

use File::Spec ;
use File::Find ;
use Cwd ;

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

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

if (!$win32)
    {
    if (!open (C, "xml2-config --version|"))
        {
        print "Cannot execute xml2-config ($!). libxml2 and libxslt will not be linked into Embperl\n" ;
        return undef ;
        }
    chomp ($version = <C>)  or die ("Cannot execute xml2-config to get version.") ;
    close C ;

    open C, "xml2-config --prefix --libs --cflags|" or die ("Cannot execute xml2-config ($!).") ;
    chomp ($prefix = <C>) ;
    chomp ($libs = <C>) ;
    chomp ($cflags = <C>) ;
    close C ;

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

    if (!open (C, "xslt-config --version|"))
        {
        print "Cannot execute xslt-config ($!). libxml2 and libxslt will not be linked into Embperl\n" ;
        return undef ;
        }
    chomp ($version2 = <C>)  or die ("Cannot execute xslt-config to get version.") ;
    close C ;

    open C, "xslt-config --prefix --libs |" or die ("Cannot execute xslt-config ($!).") ;
    chomp ($prefix2 = <C>) ;
    chomp ($libs2 = <C>) ;
    close C ;

    open C, "xslt-config --cflags|" or die ("Cannot execute xslt-config ($!).") ;
    chomp ($cflags2 = <C>) ;
    close C ;

    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 ;