diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/smb_build/header.pm | 1 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 16 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 68 | ||||
-rw-r--r-- | source4/build/smb_build/output.pm | 7 |
4 files changed, 42 insertions, 50 deletions
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index b52464922b..93240f1d17 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -82,4 +82,5 @@ sub create_smb_build_h($$) print __FILE__.": creating $file\n"; } + 1; diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index ff540215f7..a85eab32de 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -63,16 +63,15 @@ foreach my $key (values %$OUTPUT) { if (defined($key->{PC_FILE})) { push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}"); } - $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and + $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if ($key->{TYPE} eq "LIBRARY" and ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") { $shared_libs_used = 1; } - $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or + $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or $key->{TYPE} eq "PYTHON") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES}); $mkenv->Manpage($key) if defined($key->{MANPAGE}); $mkenv->Header($key) if defined($key->{PUBLIC_HEADERS}); @@ -80,6 +79,17 @@ foreach my $key (values %$OUTPUT) { defined($key->{PUBLIC_PROTO_HEADER}); } +foreach my $key (values %$OUTPUT) { + next unless defined $key->{OUTPUT_TYPE}; + + $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and + grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or + $key->{TYPE} eq "PYTHON") and + grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); +} + $mkenv->write("data.mk"); header::create_smb_build_h($OUTPUT, "include/build.h"); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 50a16c543f..9c5ae9ea1d 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -45,8 +45,6 @@ sub new($$$) $self->output("################################################\n"); $self->output("\n"); - $self->_prepare_compiler_linker(); - if (!$self->{automatic_deps}) { $self->output("ALL_PREDEP = proto\n"); $self->output(".NOTPARALLEL:\n"); @@ -62,36 +60,6 @@ sub output($$) $self->{output} .= $text; } -sub _prepare_compiler_linker($) -{ - my ($self) = @_; - - my $builddir_headers = ""; - my $libdir; - my $extra_link_flags = ""; - - if ($self->{config}->{USESHARED} eq "true") { - $libdir = "\$(builddir)/bin/shared"; - $extra_link_flags = "-Wl,-rpath-link,\$(builddir)/bin/shared"; - } else { - $libdir = "\$(builddir)/bin/static"; - } - - if (!(abs_path($self->{config}->{srcdir}) eq abs_path($self->{config}->{builddir}))) { - $builddir_headers= "-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib "; - } - - $self->output(<< "__EOD__" - -CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS} - -INSTALL_LINK_FLAGS=$extra_link_flags - -INTERN_LDFLAGS = -L$libdir -__EOD__ -); -} - sub _prepare_mk_files($) { my $self = shift; @@ -166,6 +134,13 @@ sub Integrated($$) $self->_prepare_list($ctx, "LINK_FLAGS"); } +sub SharedModulePrimitives($$) +{ + my ($self,$ctx) = @_; + + #FIXME +} + sub SharedModule($$) { my ($self,$ctx) = @_; @@ -245,22 +220,27 @@ __EOD__ $self->output("\n"); } -sub SharedLibrary($$) +sub SharedLibraryPrimitives($$) { my ($self,$ctx) = @_; - my $has_static_lib = 0; - - push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION})); - push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION})); - - $has_static_lib = 1 if grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}}); + $self->output("$ctx->{NAME}_SOVERSION = $ctx->{SO_VERSION}\n") if (defined($ctx->{SO_VERSION})); + $self->output("$ctx->{NAME}_VERSION = $ctx->{VERSION}\n") if (defined($ctx->{VERSION})); - if (not $has_static_lib) { + if (not grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}})) { $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "FULL_OBJ_LIST"); } +} + +sub SharedLibrary($$) +{ + my ($self,$ctx) = @_; + + push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION})); + push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION})); + $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); # $self->_prepare_list_ex($ctx, "LINK_FLAGS", "-Wl,--whole-archive", "-Wl,--no-whole-archive"); @@ -367,13 +347,13 @@ __EOD__ if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") { $self->output(<< "__EOD__" - \@\$(HOSTLD) \$(HOSTLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ + \@\$(HOSTLD) \$(HOSTLD_FLAGS) -L\${builddir}/bin/static -o \$\@ \$(INSTALL_LINK_FLAGS) \\ \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) __EOD__ ); } else { $self->output(<< "__EOD__" - \@\$(BNLD) \$(BNLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ + \@\$(BNLD) \$(BNLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) __EOD__ @@ -444,9 +424,9 @@ sub ProtoHeader($$) sub write($$) { - my ($self,$file) = @_; + my ($self, $file) = @_; - $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n"); + $self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n"); $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n"); $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n"); $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n"); diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index fbf14f7e91..855d03ade2 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -81,8 +81,8 @@ sub generate_shared_library($) $lib->{LIBRARY_DEBUGNAME} = $lib->{LIBRARY_REALNAME}; if (defined($lib->{VERSION}) and $config::config{SONAMEFLAG} ne "#") { - $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.$lib->{SO_VERSION}"; - $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.$lib->{VERSION}"; + $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION)"; + $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)"; } $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}"; @@ -104,10 +104,11 @@ sub generate_static_library($) if (defined($lib->{OBJ_FILES})) { $lib->{TARGET_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}"; $lib->{STATICDIR} = 'bin/static'; + $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name); } else { $lib->{TARGET_STATIC_LIBRARY} = ""; + $lib->{OUTPUT_STATIC_LIBRARY} = ""; } - $lib->{OUTPUT_STATIC_LIBRARY} = $lib->{TARGET_STATIC_LIBRARY}; } sub generate_binary($) |