Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 21:27:05 GMT
From:      "Bradley T. Hughes" <bradleythughes@fastmail.fm>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/183872: net/samba4 does not need to pull in lang/gcc
Message-ID:  <201311112127.rABLR5Zi013238@oldred.freebsd.org>
Resent-Message-ID: <201311112130.rABLU0P3083881@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         183872
>Category:       ports
>Synopsis:       net/samba4 does not need to pull in lang/gcc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 11 21:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Bradley T. Hughes
>Release:        10.0-BETA3
>Organization:
>Environment:
FreeBSD freebsd10.local 10.0-BETA3 FreeBSD 10.0-BETA3 #0 r257580: Sun Nov  3 19:43:01 UTC 2013     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
net/samba4 has USE_GCC in its Makefile, but it doesn't really need to. The source3/wscript incorrectly assumes that if a compiler (like clang in the base system) can optimize out 'if (0) { some_undefined_function() }', then it can optimize out the more complex methods in lib/util/string_wrappers.h. This is not the case. The attached patch updates source3/wscript to test that the compiler can optimize out the same kind of construct used in lib/util/string_wrapper.h, which correctly detects that clang cannot, and the build succeeds with the base system compiler.
>How-To-Repeat:

>Fix:
See attached.

Patch attached with submission follows:

diff -ur /usr/ports/net/samba4/Makefile samba4-without-gcc/Makefile
--- /usr/ports/net/samba4/Makefile	2013-09-21 00:10:23.000000000 +0200
+++ samba4-without-gcc/Makefile	2013-11-11 20:53:24.725461436 +0100
@@ -68,7 +68,6 @@
 USE_PYTHON_BUILD=	-2.7
 USE_PERL5=		build
 
-USE_GCC=		4.2+
 USE_PYTHON=		yes
 USES=			pkgconfig gettext iconv perl5
 USE_LDCONFIG=		${SAMBA4_LIBDIR}
diff -ur /usr/ports/net/samba4/files/patch-source3__wscript samba4-without-gcc/files/patch-source3__wscript
--- /usr/ports/net/samba4/files/patch-source3__wscript	2013-02-18 15:24:56.000000000 +0100
+++ samba4-without-gcc/files/patch-source3__wscript	2013-11-11 20:47:09.117296396 +0100
@@ -1,6 +1,17 @@
---- ./source3/wscript.orig	2013-02-05 12:25:26.000000000 +0000
-+++ ./source3/wscript	2013-02-15 17:54:40.099886239 +0000
-@@ -475,7 +475,7 @@
+--- source3/wscript.orig	2013-05-21 08:48:46.000000000 +0200
++++ source3/wscript	2013-11-11 20:46:22.508193334 +0100
+@@ -312,7 +312,9 @@
+ 
+     # Check if the compiler will optimize out functions
+     conf.CHECK_CODE('''
+-if (0) {
++char s = "string";
++int len = 6;
++if (sizeof(s) != len && sizeof(s) != sizeof(char *)) {
+     this_function_does_not_exist();
+ } else {
+     return 1;
+@@ -502,7 +504,7 @@
              conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt')
              conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt')
              conf.CHECK_CODE('struct aiocb a; return aio_cancel(1, &a);', 'HAVE_AIO_CANCEL', msg='Checking for aio_cancel', headers='aio.h', lib='aio rt')
@@ -9,7 +20,7 @@
          if not conf.CONFIG_SET('HAVE_AIO'):
              conf.DEFINE('HAVE_NO_AIO', '1')
      else:
-@@ -1644,26 +1644,8 @@
+@@ -1671,26 +1673,8 @@
  
      if PTHREAD_LDFLAGS == 'error':
          if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
@@ -37,7 +48,7 @@
  
      if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
          conf.ADD_CFLAGS(PTHREAD_CFLAGS)
-@@ -1693,8 +1675,8 @@
+@@ -1720,8 +1704,8 @@
                                        auth_script vfs_readahead vfs_xattr_tdb vfs_posix_eadb
                                        vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb
                                        vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly
@@ -48,7 +59,7 @@
                                        vfs_crossrename vfs_linux_xfs_sgid
                                        vfs_time_audit idmap_autorid idmap_tdb2
                                        idmap_rid idmap_hash'''))
-@@ -1707,7 +1689,7 @@
+@@ -1734,7 +1718,7 @@
  
      if Options.options.enable_selftest or Options.options.developer:
          default_shared_modules.extend(TO_LIST('vfs_fake_acls'))
@@ -57,12 +68,12 @@
  
      if conf.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
          default_static_modules.extend(TO_LIST('pdb_samba_dsdb auth_samba4 vfs_dfs_samba4'))
-@@ -1740,7 +1722,7 @@
+@@ -1767,7 +1751,7 @@
          default_static_modules.extend(TO_LIST('charset_macosxfs'))
  
      if conf.CONFIG_SET('HAVE_GPFS'):
 -	default_shared_modules.extend(TO_LIST('vfs_gpfs'))
 +        default_shared_modules.extend(TO_LIST('vfs_gpfs'))
  
-     explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
-     explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
+     if conf.CONFIG_SET('SAMBA_FAM_LIBS'):
+         default_shared_modules.extend(TO_LIST('vfs_notify_fam'))


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311112127.rABLR5Zi013238>