r11307: Add support for generating pkg-config files
authorJelmer Vernooij <jelmer@samba.org>
Wed, 26 Oct 2005 20:06:26 +0000 (20:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:45:17 +0000 (13:45 -0500)
source/build/smb_build/env.pm
source/build/smb_build/makefile.pm
source/build/smb_build/smb_build_h.pm
source/main.mk

index 86632bdb891d2e44bc4f33b8772b79387e58cf88..9e52e1974d7b2f92a75cbf130b878e3aa3d6941a 100644 (file)
@@ -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;
index 929c4add18c000a8ddf1d30c529b82b583db7efa..c0b9e36e4f049e8ef131c55c3047ea61b5e371dc 100644 (file)
@@ -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;
index 932f566bdf6899ec28c09c6cdea48c0703b80926..b31cf8b9d9aba69088afb470cb42825eb4deedbd 100644 (file)
@@ -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;
index 3dc93748ffd7a5ffedc4aab013db671d4d509f36..4fb330b943651128d14a1c29d11dc27a23b10869 100644 (file)
@@ -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 */*/*/*~