summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-10-26 20:06:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:17 -0500
commitb89c019824cb14621da6a8dd8b016063945cfecf (patch)
tree83a49e34a8e1d40a76131da1f312f902eba7cf33
parent344a0ebb431936766c06043a8030e7475ebf2d13 (diff)
downloadsamba-b89c019824cb14621da6a8dd8b016063945cfecf.tar.gz
samba-b89c019824cb14621da6a8dd8b016063945cfecf.tar.bz2
samba-b89c019824cb14621da6a8dd8b016063945cfecf.zip
r11307: Add support for generating pkg-config files
(This used to be commit 9c211507c15092ce09fd519cd0ffadf4b9f69492)
-rw-r--r--source4/build/smb_build/env.pm23
-rw-r--r--source4/build/smb_build/makefile.pm18
-rw-r--r--source4/build/smb_build/smb_build_h.pm2
-rw-r--r--source4/main.mk1
4 files changed, 40 insertions, 4 deletions
diff --git a/source4/build/smb_build/env.pm b/source4/build/smb_build/env.pm
index 86632bdb89..9e52e1974d 100644
--- a/source4/build/smb_build/env.pm
+++ b/source4/build/smb_build/env.pm
@@ -45,5 +45,28 @@ sub set_config($$)
}
}
+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;
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 929c4add18..c0b9e36e4f 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -26,6 +26,7 @@ sub new($$$$)
$self->{static_libs} = [];
$self->{shared_libs} = [];
$self->{headers} = [];
+ $self->{pc_files} = [];
$self->{output} = "";
$self->{mkfile} = $mkfile;
@@ -60,6 +61,8 @@ sub new($$$$)
$self->MergedObj($key) if $key->{OUTPUT_TYPE} eq "MERGEDOBJ";
$self->ObjList($key) if $key->{OUTPUT_TYPE} eq "OBJLIST";
$self->StaticLibrary($key) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
+ $self->PkgConfig($key) if ($key->{OUTPUT_TYPE} eq "SHARED_LIBRARY") and
+ defined($key->{MAJOR_VERSION});
$self->SharedLibrary($key) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
$self->Binary($key) if $key->{OUTPUT_TYPE} eq "BINARY";
$self->Manpage($key) if defined($key->{MANPAGE});
@@ -405,6 +408,17 @@ sub Manpage($$)
push (@{$self->{manpages}}, "$dir/$ctx->{MANPAGE}");
}
+sub PkgConfig($$)
+{
+ my ($self,$ctx) = @_;
+
+ my $path = "$ctx->{BASEDIR}/$ctx->{NAME}.pc";
+
+ push (@{$self->{pc_files}}, $path);
+
+ smb_build::env::PkgConfig($self,$path,$ctx->{NAME},"FIXME",join(' ', @{$ctx->{CFLAGS}}), "$ctx->{MAJOR_VERSION}.$ctx->{MINOR_VERSION}.$ctx->{RELEASE_VERSION}");
+}
+
sub write($$)
{
my ($self,$file) = @_;
@@ -415,6 +429,7 @@ sub write($$)
$self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
$self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
$self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
+ $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
if ($self->{developer}) {
$self->output(<<__EOD__
@@ -433,8 +448,7 @@ __EOD__
print MAKEFILE $self->{output};
close(MAKEFILE);
- print "build/smb_build/main.pl: creating $file\n";
- return;
+ print __FILE__.": creating $file\n";
}
1;
diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm
index 932f566bdf..b31cf8b9d9 100644
--- a/source4/build/smb_build/smb_build_h.pm
+++ b/source4/build/smb_build/smb_build_h.pm
@@ -108,7 +108,7 @@ sub create_smb_build_h($$)
print SMB_BUILD_H $output;
close(SMB_BUILD_H);
- print "build/smb_build/main.pl: creating $file\n";
+ print __FILE__.": creating $file\n";
return;
}
1;
diff --git a/source4/main.mk b/source4/main.mk
index 3dc93748ff..4fb330b943 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -199,7 +199,6 @@ distclean: clean
-rm -f config.log config.cache
-rm -f samba4-deps.dot
-rm -f config.pm config.mk
- -rm -f lib/registry/winregistry.pc
removebackup:
-rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~