[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Thu May 30 03:38:06 MDT 2013


The branch, v4-0-test has been updated
       via  d4cd828 waf: build PIEs if supported by the compiler
       via  b4378f1 waf: build position independent executables
       via  097ec58 waf: add --with[out]-pie configure arguments
       via  0996e95 build: Add missing new line to replaced python shebang line. (Fix bug #9909)
      from  2aee249 build: Install smbtar in waf build

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit d4cd8284d9f6bdf9ce299648405b729e343da55d
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue May 28 15:00:47 2013 +0200

    waf: build PIEs if supported by the compiler
    
    Currently waf performs a mandatory check for compiler PIE support,
    unless --without-pie is specified.
    This change makes Waf only perform the mandatory check if --with-pie is
    specified. If neither --with-pie nor --without-pie are specified, then
    PIEs are only built if compiler support is available.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    
    The last 3 patches address bug #9910 - PIE builds not supported.
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Thu May 30 11:37:47 CEST 2013 on sn-devel-104

commit b4378f1f3b6c442f3657577fd8f36d6179b2e11d
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon May 27 17:57:01 2013 +0200

    waf: build position independent executables
    
    This patch re-instates support for building Position Independent
    Executables using the '-fPIE' and '-pie' compiler and linker flags
    respectively.
    
    PIE builds are enabled by default, and can be explicitly disabled using
    the '--without-pie' configure argument.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue May 28 02:56:36 CEST 2013 on sn-devel-104

commit 097ec587523df24e6a4d016cd1547de6dac17d67
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon May 27 17:57:00 2013 +0200

    waf: add --with[out]-pie configure arguments
    
    The arguments do not currently have any effect.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0996e95c00ffc468e6482877f21bae3a0f01abe9
Author: Michael Adam <obnox at samba.org>
Date:   Tue May 28 12:19:34 2013 +0200

    build: Add missing new line to replaced python shebang line. (Fix bug #9909)
    
    When configuring with a non-standard python specified in
    the PYTHON environment variable, the shebang lines in various
    python tools like samba-tool and samba_dnsupdate get replaced.
    
    This replace line for the shebang was missing a newline
    which joined the shebang line with the following line,
    rendereing those scripts with a nonempty second line unusuable,
    for example samba_dnsupdate.
    
    This patch fixes this bug which is bug #9909 on bugzilla.
    
    Pair-Programmed-With: Karolin Seeger <kseeger at samba.org>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Signed-off-by: Karolin Seeger <kseeger at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Wed May 29 13:21:51 CEST 2013 on sn-devel-104
    (cherry picked from commit 3f24d694e7e2190d30a17bc13a79a36b49711531)

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/wafsamba.py |   15 +++++++++++----
 wscript                         |   17 +++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 3559cc1..47393ad 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -342,6 +342,13 @@ def SAMBA_BINARY(bld, binname, source,
     else:
         subsystem_group = group
 
+    # only specify PIE flags for binaries
+    pie_cflags = cflags
+    pie_ldflags = TO_LIST(ldflags)
+    if bld.env['ENABLE_PIE'] == True:
+        pie_cflags += ' -fPIE'
+        pie_ldflags.extend(TO_LIST('-pie'))
+
     # first create a target for building the object files for this binary
     # by separating in this way, we avoid recompiling the C files
     # separately for the install binary and the build binary
@@ -349,7 +356,7 @@ def SAMBA_BINARY(bld, binname, source,
                         source         = source,
                         deps           = deps,
                         includes       = includes,
-                        cflags         = cflags,
+                        cflags         = pie_cflags,
                         group          = subsystem_group,
                         autoproto      = autoproto,
                         subsystem_name = subsystem_name,
@@ -379,7 +386,7 @@ def SAMBA_BINARY(bld, binname, source,
         install_path   = None,
         samba_inst_path= install_path,
         samba_install  = install,
-        samba_ldflags  = TO_LIST(ldflags)
+        samba_ldflags  = pie_ldflags
         )
 
     if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
@@ -699,9 +706,9 @@ sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
     shebang = None
 
     if task.env["PYTHON"][0] == "/":
-        replacement_shebang = "#!%s" % task.env["PYTHON"]
+        replacement_shebang = "#!%s\n" % task.env["PYTHON"]
     else:
-        replacement_shebang = "#!/usr/bin/env %s" % task.env["PYTHON"]
+        replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PYTHON"]
 
     installed_location=task.outputs[0].bldpath(task.env)
     source_file = open(task.inputs[0].srcpath(task.env))
diff --git a/wscript b/wscript
index a9954ed..087e950 100644
--- a/wscript
+++ b/wscript
@@ -56,6 +56,14 @@ def set_options(opt):
                    help='disable AD DC functionality (enables Samba 4 client and Samba 3 code base).',
                    action='store_true', dest='without_ad_dc', default=False)
 
+    opt.add_option('--with-pie',
+                  help=("Build Position Independent Executables " +
+                        "(default if supported by compiler)"),
+                  action="store_true", dest='enable_pie')
+    opt.add_option('--without-pie',
+                  help=("Disable Position Independent Executable builds"),
+                  action="store_false", dest='enable_pie')
+
     gr = opt.option_group('developer options')
 
     opt.add_option('--disable-ntdb',
@@ -168,6 +176,15 @@ def configure(conf):
     
     conf.SAMBA_CONFIG_H('include/config.h')
 
+    if Options.options.enable_pie != False:
+        if Options.options.enable_pie == True:
+                need_pie = True
+        else:
+                # not specified, only build PIEs if supported by compiler
+                need_pie = False
+        if conf.check_cc(cflags='-fPIE', ldflags='-pie', mandatory=need_pie,
+                         msg="Checking compiler for PIE support"):
+		conf.env['ENABLE_PIE'] = True
 
 def etags(ctx):
     '''build TAGS file using etags'''


-- 
Samba Shared Repository


More information about the samba-cvs mailing list