3 # Samba Build Environment
5 # (C) 2005 Jelmer Vernooij <jelmer@samba.org>
7 # Published under the GNU GPL
9 package smb_build::env;
18 my ($name, $config) = @_;
25 $self->_set_config($config);
32 my ($self, $config) = @_;
34 $self->{config} = $config;
36 if (not defined($self->{config}->{srcdir})) {
37 $self->{config}->{srcdir} = '.';
40 if (not defined($self->{config}->{builddir})) {
41 $self->{config}->{builddir} = '.';
44 if ($self->{config}->{prefix} eq "NONE") {
45 $self->{config}->{prefix} = $self->{config}->{ac_default_prefix};
48 if ($self->{config}->{exec_prefix} eq "NONE") {
49 $self->{config}->{exec_prefix} = $self->{config}->{prefix};
52 $self->{developer} = ($self->{config}->{developer} eq "yes");
53 $self->{automatic_deps} = ($self->{config}->{automatic_dependencies} eq "yes");
56 sub PkgConfig($$$$$$$$)
58 my ($self,$path,$name,$libs,$cflags,$version,$desc,$hasmodules) = @_;
60 print __FILE__.": creating $path\n";
62 if ($self->{config}->{samba_cv_immediate_structures} eq "yes") {
63 $cflags .= " -DHAVE_IMMEDIATE_STRUCTURES=1";
66 mkpath(dirname($path),0,0755);
67 open(OUT, ">$path") or die("Can't open $path: $!");
69 print OUT <<"__EOF__";
70 prefix=$self->{config}->{prefix}
71 exec_prefix=$self->{config}->{exec_prefix}
72 libdir=$self->{config}->{libdir}
73 includedir=$self->{config}->{includedir}
77 print OUT "modulesdir=$self->{config}->{modulesdir}/$name\n" ;
82 print OUT "Name: $name\n";
84 print OUT "Description: $desc\n";
86 print OUT "Version: $version\n";
87 print OUT "Libs: -L\${libdir} $libs\n";
88 print OUT "Cflags: -I\${includedir} $cflags\n";
95 my ($self,$items) = @_;
97 foreach (keys %$items) {
98 if (defined($self->{items})) {
99 print "Warning: Importing $_ twice!\n";
101 $self->{items}->{$_} = $items->{$_};
107 my ($self,$name) = @_;
109 unless (defined($self->{info}->{$name}))
111 $self->{info}->{$name} = $self->{items}->Build($self);
114 return $self->{info}->{$name};