~ubuntu-branches/ubuntu/utopic/libxml-bare-perl/utopic

« back to all changes in this revision

Viewing changes to Makefile.PL

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur, Jonathan Yu, Ryan Niebur, Nathan Handler
  • Date: 2009-08-12 09:42:24 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090812094224-bo487a59xgom7d8l
Tags: 0.45-1
[ Jonathan Yu ]
* New upstream release
  + UTF-8 handling fixed
  + Self-closing nodes are now printed by the XML function
* Added myself to Uploaders and Copyright
* Use new debhelper 7 short rules format
* Standards-Version 3.8.2 (no changes)
* Rewrote control description
* New upstream release
  + Prevent XML corruption during XML saving
  + Fix strange compilation problems by removing line number defines

[ Ryan Niebur ]
* add debian/clean
* Add myself to Uploaders

[ Nathan Handler ]
* debian/watch: Update to ignore development releases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
               NAME         => 'XML::Bare',
7
7
               VERSION_FROM => 'Bare.pm',
8
8
               PREREQ_PM    => { Carp => 0, Exporter => 0, DynaLoader => 0 },
 
9
               XSOPT        => '-nolinenumbers', # line number defines were causing issues on some platforms
9
10
               #OPTIMIZE     => '-O3 -msse2 -march=pentium4 --omit-frame-pointer',
10
11
             );
 
12
my $cc = getcc();
 
13
if( $cc ) {
 
14
  push( @basics, CC => $cc );
 
15
}
11
16
if( $ExtUtils::MakeMaker::VERSION >= 6.31 ) {
12
17
  push( @basics, LICENSE => 'perl' );
13
18
}
14
19
 
15
 
if( $^O eq 'MSWin32' && !has_cc() ) {
 
20
if( $^O eq 'MSWin32' && !$cc ) {
16
21
  gen_msvc(); # special case for msvc
17
22
}
18
23
elsif( $^O eq 'darwin' ) {
19
 
  gen_darwin(); # darwin
 
24
  gen_darwin();
 
25
}
 
26
elsif( $^O eq 'solaris' ) {
 
27
  gen_solaris();
20
28
}
21
29
else {
22
30
  gen_cc(); # all others
24
32
sub gen_msvc {
25
33
  require Config;
26
34
  my $libpath = Config->{'archlibexp'};
27
 
  my $ver = $]*1000; # correct for possibile division problems
28
 
  my ($major,$minor,$sub) = unpack("AA3xA3","$ver");
29
 
  $major *= 1; $minor *= 1; $sub *= 1;
 
35
  my $ver = $]*1000000;
 
36
  my $sub = $ver % 1000;
 
37
  $ver -= $sub;
 
38
  $ver /= 1000;
 
39
  my $minor = $ver % 1000;
 
40
  $ver -= $minor;
 
41
  my $major = $ver / 1000;
30
42
  WriteMakefile( @basics,
31
43
    CCFLAGS   => "/MT /DWIN32 /TP /DNOSTRING",
32
44
    LIBS      => ["$libpath\\core\\perl$major$minor.lib"],
33
45
    OBJECT    => 'Bare.o parser.o',
34
 
    LDDLFLAGS => '/DLL',
 
46
    LDDLFLAGS => '/DLL /NODEFAULTLIB:libcmt',
 
47
    #OPTIMIZE  => '-Zl -DNDEBUG -O1', # Because -MD is included by default BLEH
35
48
  );
36
49
}
37
50
sub gen_cc {
41
54
    LDDLFLAGS => '-shared -L/usr/local/lib',
42
55
  );
43
56
}
 
57
sub gen_solaris {
 
58
  WriteMakefile( @basics,
 
59
    LIBS      => ['-lm'],
 
60
    OBJECT    => 'Bare.o parser.o',
 
61
    LDDLFLAGS => '-G -L/usr/local/lib', # -G is equiv of -shared
 
62
  );
 
63
}
44
64
sub gen_darwin {
45
65
  if( substr(`which gcc`,0,2) eq 'no' ) {
46
66
    print "XCode must be installed.\n";
53
73
    LDDLFLAGS => '',
54
74
  );
55
75
}
56
 
sub has_cc {
 
76
sub getcc {
57
77
  my $div = (substr($ENV{'PATH'},0,1) eq '/') ? ':' : ';';
58
78
  my @path = split($div,$ENV{'PATH'});
59
79
  foreach my $dir ( @path ) {
60
 
    return 1 if( -e "$dir/cc" ||
61
 
                 -e "$dir/gcc" ||
62
 
                 -e "$dir/cc.exe" ||
63
 
                 -e "$dir/gcc.exe" ); }
 
80
    return 'gcc' if( -e "$dir/gcc" || -e "$dir/gcc.exe" ); # prefer gcc
 
81
    return 'cc'  if( -e "$dir/cc"  || -e "$dir/cc.exe"  );
 
82
  }               
64
83
  return 0;
65
84
}
 
85
 
 
86
# The following are hacks to force static linking and so remove need for msvcr## dll
 
87
package MY;
 
88
 
 
89
sub cflags {
 
90
  my $res = shift->SUPER::cflags( @_ );
 
91
  if( $^O eq 'MSWin32' ) {
 
92
    $res =~ s/-O1/-O2/g;
 
93
    $res =~ s/-MD/-MT/g;
 
94
  }
 
95
  return $res;
 
96
}
 
97
 
 
98
sub const_loadlibs {
 
99
  my $res = shift->SUPER::const_loadlibs( @_ );
 
100
  if( $^O eq 'MSWin32' ) {
 
101
    $res =~ s/msvcrt\.lib/libcmt\.lib/gi;
 
102
  }
 
103
  return $res;
 
104
}
 
105