# # Environment class # # Samba Build Environment # # (C) 2005 Jelmer Vernooij # # Published under the GNU GPL package smb_build::env; use smb_build::input; use strict; sub new($$) { my ($name, $config) = @_; my $self = { }; bless $self, $name; $self->set_config($config); return $self; } sub set_config($$) { my ($self, $config) = @_; $self->{config} = $config; $self->{config}->{srcdir} = '.'; $self->{config}->{builddir} = '.'; if ($self->{config}->{prefix} eq "NONE") { $self->{config}->{prefix} = $self->{config}->{ac_default_prefix}; } if ($self->{config}->{exec_prefix} eq "NONE") { $self->{config}->{exec_prefix} = $self->{config}->{prefix}; } if ($self->{config}->{developer} eq "yes") { $self->{developer} = 1; } else { $self->{developer} = 0; } } sub PkgConfig($$$$$$) { my ($self,$path,$name,$libs,$cflags,$version) = @_; print __FILE__.": creating $path\n"; open(OUT, ">$path") or die("Can't open $path: $!"); print OUT <<"__EOF__"; prefix=$self->{config}->{prefix} exec_prefix=$self->{config}->{exec_prefix} libdir=$self->{config}->{libdir} includedir=$self->{config}->{includedir} __EOF__ print OUT "Name: $name\n"; print OUT "Version: $version\n"; print OUT "Libs: $libs\n"; print OUT "Cflags: $cflags\n"; close(OUT); } 1;