r19881: Add private library flags when linking to static libraries.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 24 Nov 2006 16:45:42 +0000 (16:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:28:31 +0000 (14:28 -0500)
(This used to be commit 72f1ffc0ef56753deba716cf9d31d44c95e7cc33)

source4/build/smb_build/env.pm
source4/build/smb_build/makefile.pm

index 1466a8679c515c8f604e6080d700e9dc5ff4e83f..eb798f5ad034d425c124e1126246a0da3ce55808 100644 (file)
@@ -53,9 +53,9 @@ sub _set_config($$)
        $self->{automatic_deps} = ($self->{config}->{automatic_dependencies} eq "yes");
 }
 
-sub PkgConfig($$$$$$$$$$$)
+sub PkgConfig($$$$$$$$$$$$)
 {
-       my ($self,$path,$name,$libs,$cflags,$version,$desc,$hasmodules,$pubdep,$privdep,$dirs) = @_;
+       my ($self,$path,$name,$libs,$privlibs,$cflags,$version,$desc,$hasmodules,$pubdep,$privdep,$dirs) = @_;
 
        print __FILE__.": creating $path\n";
 
@@ -83,6 +83,7 @@ sub PkgConfig($$$$$$$$$$$)
        print OUT "Requires.private: $privdep\n" if defined($privdep);
        print OUT "Version: $version\n";
        print OUT "Libs: $libs\n";
+       print OUT "Libs.private: $privlibs\n" if (defined($privlibs));
        print OUT "Cflags: -I\${includedir} $cflags\n";
 
        close(OUT);
index 63bf3c09169e5c0bea388026487895285f43f0c2..3d5b5223d542a8b50ea74f1f4ea3249cd93f3ac6 100644 (file)
@@ -411,6 +411,7 @@ sub PkgConfig($$$)
 
        my $pubs;
        my $privs;
+       my $privlibs;
 
        if (defined($ctx->{PUBLIC_DEPENDENCIES})) {
                foreach (@{$ctx->{PUBLIC_DEPENDENCIES}}) {
@@ -425,12 +426,17 @@ sub PkgConfig($$$)
 
        if (defined($ctx->{PRIVATE_DEPENDENCIES})) {
                foreach (@{$ctx->{PRIVATE_DEPENDENCIES}}) {
-                       next unless ($other->{$_}->{TYPE} eq "LIBRARY");
+                       if ($other->{$_}->{TYPE} eq "LIBRARY") {
+                               s/^LIB//g;
+                               $_ = lc($_);
 
-                       s/^LIB//g;
-                       $_ = lc($_);
+                               $privs .= "$_ ";
+                       } else {
+                               s/^LIB//g;
+                               $_ = lc($_);
 
-                       $privs .= "$_ ";
+                               $privlibs .= "-l$_ ";
+                       }
                }
        }
 
@@ -438,6 +444,7 @@ sub PkgConfig($$$)
                $path,
                $link_name,
                "-L\${libdir} -l$link_name",
+               $privlibs,
                "",
                "$ctx->{VERSION}",
                $ctx->{DESCRIPTION},
@@ -455,6 +462,7 @@ sub PkgConfig($$$)
                "bin/pkgconfig/$link_name-uninstalled.pc",
                $link_name,
                "-Lbin/shared -Lbin/static -l$link_name",
+               $privlibs,
                "-I. -Iinclude -Ilib -Ilib/replace",
                "$ctx->{VERSION}",
                $ctx->{DESCRIPTION},