2018-01-31 13:17:11 +00:00
# Based partially on (wongsyrone/hbl0307106015) versions
i n c l u d e $( TOPDIR ) / r u l e s . m k
PKG_NAME := samba
2018-08-14 15:42:30 +00:00
PKG_VERSION := 4.8.4
PKG_RELEASE := 1
2018-01-31 13:17:11 +00:00
PKG_MAINTAINER := Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE := GPL-3.0-only
PKG_LICENSE_FILES := COPYING
PKG_SOURCE_URL := https://download.samba.org/pub/samba/stable/
PKG_SOURCE := $( PKG_NAME) -$( PKG_VERSION) .tar.gz
2018-08-14 15:42:30 +00:00
PKG_HASH := f5044d149e01894a08b1d114b8b69aed78171a7bb19608bd1fd771453b9a5406
2018-01-31 13:17:11 +00:00
# Buildroot bug? Can't add target deps via '+SAMBA4_SERVER_AD_DC:python-crypto' (as work-around we select via config.in)
2018-08-14 15:42:30 +00:00
PKG_BUILD_DEPENDS := SAMBA4_SERVER_AD_DC:python-crypto nfs-kernel-server/host
2018-01-31 13:17:11 +00:00
PKG_CONFIG_DEPENDS := \
CONFIG_SAMBA4_SERVER_NETBIOS \
CONFIG_SAMBA4_SERVER_AVAHI \
CONFIG_SAMBA4_SERVER_VFS \
CONFIG_SAMBA4_SERVER_VFSX \
CONFIG_SAMBA4_SERVER_QUOTAS \
CONFIG_SAMBA4_SERVER_ACL \
CONFIG_SAMBA4_SERVER_AD_DC \
CONFIG_SAMBA4_SERVER_WINBIND \
CONFIG_PACKAGE_kmod-fs-btrfs \
CONFIG_PACKAGE_kmod-fs-xfs
i n c l u d e $( INCLUDE_DIR ) / p a c k a g e . m k
2018-08-03 16:41:21 +00:00
i n c l u d e $( INCLUDE_DIR ) / k e r n e l . m k
i n c l u d e $( INCLUDE_DIR ) / v e r s i o n . m k
2018-01-31 13:17:11 +00:00
d e f i n e P a c k a g e / s a m b a 4 / D e f a u l t
SECTION:= net
CATEGORY:= Network
TITLE:= Samba $( PKG_VERSION)
URL:= http://www.samba.org/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 / D e f a u l t / d e s c r i p t i o n
The Samba software suite is a collection of programs that implements the
SMB/CIFS protocol for UNIX systems, allowing you to serve files and printers.
Samba 4 implements up-to protocol version SMB v3.1.1 ( Win10) , supports mDNS via AVAHI and a AD-DC setup via krb5.
NOTE: No cluster and printer support.
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - l i b s
$( call Package/samba4/Default)
TITLE += libs
DEPENDS:= +zlib +libtirpc +krb5-libs +libpopt \
2018-08-01 11:59:00 +00:00
+PACKAGE_libcap:libcap +PACKAGE_jansson:jansson +PACKAGE_libpthread:libpthread +PACKAGE_libnettle:libnettle \
2018-08-14 15:42:30 +00:00
+PACKAGE_libarchive:libarchive +PACKAGE_libgcrypt:libgcrypt +PACKAGE_libpam:libpam +PACKAGE_dbus:dbus +PACKAGE_libavahi-client:libavahi-client \
2018-08-03 16:41:21 +00:00
+SAMBA4_SERVER_VFS:attr \
2018-01-31 13:17:11 +00:00
+SAMBA4_SERVER_ACL:acl +SAMBA4_SERVER_ACL:attr \
+SAMBA4_SERVER_AVAHI:libavahi-client \
+SAMBA4_SERVER_AD_DC:python-base +SAMBA4_SERVER_AD_DC:libopenssl +SAMBA4_SERVER_AD_DC:libgnutls +SAMBA4_SERVER_AD_DC:libopenldap
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - s e r v e r
$( call Package/samba4/Default)
TITLE += server
DEPENDS:= +samba4-libs
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - s e r v e r / d e s c r i p t i o n
installs: smbd ( daemon) smbpasswd pdbedit testparm
This provides the basic fileserver service and is the minimum needed to serve file shares.
HINT: https://fitzcarraldoblog.wordpress.com/2016/10/17/a-correct-method-of-configuring-samba-for-browsing-smb-shares-in-a-home-network/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - s e r v e r / c o n f i g
select PACKAGE_wsdd2
source " $( SOURCE) /Config.in "
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - c l i e n t
$( call Package/samba4/Default)
TITLE += client
DEPENDS:= +samba4-libs
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - c l i e n t / d e s c r i p t i o n
installs: smbclient cifsdd
The smbclient program implements a simple ftp-like client for accessing SMB shares
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - a d m i n
$( call Package/samba4/Default)
TITLE += admin tools
DEPENDS:= +samba4-libs
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - a d m i n / d e s c r i p t i o n
installs: net smbcontrol profiles rpcclient smbcacls smbcquotas
Administration tools collection
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - u t i l s
$( call Package/samba4/Default)
TITLE += utils
DEPENDS:= +samba4-libs
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - u t i l s / d e s c r i p t i o n
installs: smbstatus smbtree smbget nmblookup mvxattr
Utilities collection
e n d e f
TARGET_CFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
CONFIGURE_VARS += \
CPP = " $( TARGET_CROSS) cpp "
CONFIGURE_CMD = ./buildtools/bin/waf
# Strip options that WAF configure script does not recognize
CONFIGURE_ARGS := $( filter-out \
--host= % \
--build= % \
--program-suffix= % \
--disable-nls \
--disable-ipv6 \
, $( CONFIGURE_ARGS) )
CONFIGURE_ARGS += \
--hostcc= " $( HOSTCC) " \
--cross-compile \
2018-08-03 16:41:21 +00:00
--cross-answers= cross-answers.txt \
2018-01-31 13:17:11 +00:00
--disable-cups \
--disable-iprint \
--disable-cephfs \
--disable-fault-handling \
--disable-glusterfs \
--disable-rpath \
--disable-rpath-install \
--disable-rpath-private-install \
--enable-fhs \
--without-automount \
--without-iconv \
--without-lttng \
--without-ntvfs-fileserver \
--without-pam \
--without-systemd \
--without-utmp \
--without-dmapi \
--without-fam \
--without-gettext \
--without-regedit \
--without-gpgme
# Optional AES-NI support - https://lists.samba.org/archive/samba-technical/2017-September/122738.html
# Support for Nettle wasn't comitted
CONFIGURE_ARGS += --accel-aes= none
CONFIGURE_ARGS += \
--with-lockdir= /var/lock \
--with-logfilebase= /var/log \
--with-piddir= /var/run \
--with-privatedir= /etc/samba
CONFIGURE_ARGS += \
--with-system-mitkrb5 " $( STAGING_DIR) /usr " \
--with-system-mitkdc= /usr/sbin/krb5kdc
## embedded-heimdal
# --bundled-libraries=talloc,tevent,tdb,ldb,com_err,cmocka,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,NONE
i f e q ( $( CONFIG_SAMBA 4_SERVER_AVAHI ) , y )
CONFIGURE_ARGS += --enable-avahi
e l s e
CONFIGURE_ARGS += --disable-avahi
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_QUOTAS ) , y )
CONFIGURE_ARGS += --with-quotas
e l s e
CONFIGURE_ARGS += --without-quotas
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_ACL ) , y )
CONFIGURE_ARGS += --with-acl-support
e l s e
CONFIGURE_ARGS += --without-acl-support
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , y )
CONFIGURE_ARGS += --enable-gnutls --with-dnsupdate --with-ads --with-ldap
TARGET_CFLAGS := -I$( STAGING_DIR) /usr/include/python2.7 $( TARGET_CFLAGS)
e l s e
CONFIGURE_ARGS += --without-ad-dc --disable-python --nopyc --nopyo --disable-gnutls --without-dnsupdate --without-ads --without-ldap
CONFIGURE_VARS += \
python_LDFLAGS = "" \
python_LIBDIR = ""
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_WINBIND ) , y )
CONFIGURE_ARGS += --with-winbind
e l s e
CONFIGURE_ARGS += --without-winbind
e n d i f
SAMBA4_IDMAP_MODULES :=
SAMBA4_IDMAP_MODULES_SHARED :=
SAMBA4_PDB_MODULES := pdb_smbpasswd,pdb_tdbsam,
SAMBA4_AUTH_MODULES := auth_builtin,auth_sam,auth_unix,auth_script,
SAMBA4_VFS_MODULES := vfs_default,
i f e q ( $( CONFIG_SAMBA 4_SERVER_VFS ) , y )
2018-08-03 16:41:21 +00:00
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_fruit,vfs_shadow_copy2,vfs_recycle,vfs_fake_perms,vfs_readonly,vfs_cap,vfs_offline,vfs_crossrename,vfs_catia,vfs_streams_xattr,
2018-01-31 13:17:11 +00:00
i f e q ( $( CONFIG_PACKAGE_kmod -fs -btrfs ) , y )
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_btrfs,
e n d i f
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_VFSX ) , y )
2018-08-03 16:41:21 +00:00
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_virusfilter,vfs_shell_snap,vfs_commit,vfs_worm,vfs_xattr_tdb,vfs_aio_fork,vfs_aio_pthread,vfs_netatalk,vfs_dirsort,vfs_fileid,
2018-01-31 13:17:11 +00:00
i f e q ( $( CONFIG_PACKAGE_kmod -fs -xfs ) , y )
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_linux_xfs_sgid,
e n d i f
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_QUOTAS ) , y )
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_default_quota,
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_ACL ) , y )
SAMBA4_VFS_MODULES := $( SAMBA4_VFS_MODULES) vfs_posixacl,vfs_acl_xattr,vfs_acl_tdb,
# vfs_zfsacl needs https://github.com/zfsonlinux/zfs/tree/master/include/sys/zfs_acl.h
# vfs_nfs4acl_xattr needs https://github.com/notriddle/libdrpc/blob/master/rpc/xdr.h
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , y )
SAMBA4_PDB_MODULES := $( SAMBA4_PDB_MODULES) pdb_samba_dsdb,
SAMBA4_AUTH_MODULES := $( SAMBA4_AUTH_MODULES) auth_samba4,
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_WINBIND ) , y )
SAMBA4_IDMAP_MODULES := $( SAMBA4_IDMAP_MODULES) idmap_passdb,idmap_nss,idmap_tdb,idmap_tdb2,idmap_script,nss_info_template,
SAMBA4_IDMAP_MODULES_SHARED := $( SAMBA4_IDMAP_MODULES_SHARED) idmap_autorid,idmap_rid,idmap_ad,idmap_rfc2307,
# idmap_ad needs --with-ads
# idmap_rfc2307 needs ldap headers
SAMBA4_AUTH_MODULES := $( SAMBA4_AUTH_MODULES) auth_winbind,
e n d i f
SAMBA4_MODULES := ${ SAMBA4_AUTH_MODULES } ${ SAMBA4_PDB_MODULES } ${ SAMBA4_IDMAP_MODULES } ${ SAMBA4_VFS_MODULES }
SAMBA4_MODULES_SHARDED := ${ SAMBA4_IDMAP_MODULES_SHARED }
CONFIGURE_ARGS += \
--with-static-modules= $( SAMBA4_MODULES) !DEFAULT,!FORCED \
--with-shared-modules= $( SAMBA4_MODULES_SHARDED) !DEFAULT,!FORCED
# Setup build/install targets
# CONFIG_PACKAGE_samba4-server
BUILD_TARGETS_SERVER := smbd/smbd,smbpasswd,pdbedit,testparm
# Optional server targets
i f e q ( $( CONFIG_SAMBA 4_SERVER_ACL ) , y )
BUILD_TARGETS_SERVER := $( BUILD_TARGETS_SERVER) ,sharesec
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_NETBIOS ) , y )
BUILD_TARGETS_SERVER := $( BUILD_TARGETS_SERVER) ,nmbd
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , y )
BUILD_TARGETS_SERVER := $( BUILD_TARGETS_SERVER) ,samba,nsstest,ntlm_auth
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_WINBIND ) , y )
BUILD_TARGETS_SERVER := $( BUILD_TARGETS_SERVER) ,winbindd,wbinfo,winbind_krb5_locator
e n d i f
# CONFIG_PACKAGE_samba4-client
BUILD_TARGETS_CLIENT := client/smbclient,client/cifsdd
# CONFIG_PACKAGE_samba4-admin
BUILD_TARGETS_ADMIN := net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas
# CONFIG_PACKAGE_samba4-utils
BUILD_TARGETS_UTILS := smbstatus,smbtree,smbget,mvxattr,nmblookup
# lib bundling
# NOTE: Compile some unique libs into related bins, so we end-up with a unified samba4-libs base, mainly to allow package separation (server, client, admin, utils)
CONFIGURE_ARGS += --builtin-libraries= smbclient,netapi,samba-passdb,ads,auth,cli-spoolss,libcli-lsa3,gpext,talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace
#CONFIGURE_ARGS += --nonshared-binary=$(BUILD_TARGETS_SERVER)
# NOTE: bundle + make private, we want to avoid version configuration (build, link) conflicts
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , y )
CONFIGURE_ARGS += --bundled-libraries= talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace,pytalloc-util,pyldb-util,NONE
e l s e
CONFIGURE_ARGS += --bundled-libraries= talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace,NONE
e n d i f
CONFIGURE_ARGS += --private-libraries= talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace
d e f i n e B u i l d / P r e p a r e
$( Build/Prepare/Default)
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , )
# un-bundle dnspython
$( SED) '/"dns.resolver":/d' $( PKG_BUILD_DIR) /third_party/wscript
# unbundle iso8601
$( SED) '/"iso8601":/d' $( PKG_BUILD_DIR) /third_party/wscript
e n d i f
e n d e f
d e f i n e B u i l d / C o n f i g u r e
2018-08-03 16:41:21 +00:00
$( CP) ./waf-cross-answers/$( ARCH) .txt $( PKG_BUILD_DIR) /cross-answers.txt
echo 'Checking uname machine type: "$(ARCH)"' >> $( PKG_BUILD_DIR) /cross-answers.txt
echo 'Checking uname release type: "$(LINUX_VERSION)"' >> $( PKG_BUILD_DIR) /cross-answers.txt
echo 'Checking uname version type: "$(VERSION_DIST) Linux-$(LINUX_VERSION) $(shell date +%Y-%m-%d)"' >> $( PKG_BUILD_DIR) /cross-answers.txt
# NOTE: For some unknown reason this answer is not needed on some hosts/distros, yet needed on others?
echo 'Checking whether POSIX capabilities are available: OK' >> $( PKG_BUILD_DIR) /cross-answers.txt
2018-01-31 13:17:11 +00:00
$( call Build/Configure/Default,configure)
e n d e f
# BUG: We need to use "waf install --targets=" otherwise a "make install" or "waf install" will retrigger a full recompile of all possible targets!
d e f i n e B u i l d / C o m p i l e
( cd $( PKG_BUILD_DIR) ; \
./buildtools/bin/waf install -j$( shell nproc) \
--targets= $( SAMBA4_MODULES) $( SAMBA4_MODULES_SHARDED) $( BUILD_TARGETS_SERVER) ,$( BUILD_TARGETS_UTILS) ,$( BUILD_TARGETS_ADMIN) ,$( BUILD_TARGETS_CLIENT) \
--destdir= " $( PKG_INSTALL_DIR) " \
)
e n d e f
# No default install see above
d e f i n e B u i l d / I n s t a l l
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - l i b s / i n s t a l l
$( INSTALL_DIR) $( 1) /usr/lib
$( CP) $( PKG_INSTALL_DIR) /usr/lib/*.so* $( 1) /usr/lib/
$( CP) $( PKG_INSTALL_DIR) /usr/lib/samba/*.so* $( 1) /usr/lib/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - c l i e n t / i n s t a l l
$( INSTALL_DIR) $( 1) /usr/bin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/{ smbclient,cifsdd} $( 1) /usr/bin/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - a d m i n / i n s t a l l
$( INSTALL_DIR) $( 1) /usr/bin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/{ net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas} $( 1) /usr/bin/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - u t i l s / i n s t a l l
$( INSTALL_DIR) $( 1) /usr/bin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/{ smbstatus,smbtree,smbget,mvxattr,nmblookup} $( 1) /usr/bin/
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - s e r v e r / i n s t a l l
$( INSTALL_DIR) $( 1) /usr/lib/samba
if [ -d $( PKG_INSTALL_DIR) /usr/lib/samba/idmap ] ; then \
$( CP) $( PKG_INSTALL_DIR) /usr/lib/samba/idmap $( 1) /usr/lib/samba/; \
fi
if [ -d $( PKG_INSTALL_DIR) /usr/lib/samba/auth ] ; then \
$( CP) $( PKG_INSTALL_DIR) /usr/lib/samba/auth $( 1) /usr/lib/samba/; \
fi
if [ -d $( PKG_INSTALL_DIR) /usr/lib/samba/vfs ] ; then \
$( CP) $( PKG_INSTALL_DIR) /usr/lib/samba/vfs $( 1) /usr/lib/samba/; \
fi
if [ -d $( PKG_INSTALL_DIR) /usr/lib/samba/pdb ] ; then \
$( CP) $( PKG_INSTALL_DIR) /usr/lib/samba/pdb $( 1) /usr/lib/samba/; \
fi
$( INSTALL_DIR) $( 1) /usr/bin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/{ smbpasswd,pdbedit,testparm} $( 1) /usr/bin/
$( INSTALL_DIR) $( 1) /usr/sbin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/sbin/smbd $( 1) /usr/sbin/
i f e q ( $( CONFIG_SAMBA 4_SERVER_AD_DC ) , y )
$( CP) $( PKG_INSTALL_DIR) /usr/lib/python2.7 $( 1) /usr/lib/
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/{ samba-tool,ntlm_auth} $( 1) /usr/bin
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/sbin/{ samba,samba_gpoupdate,samba_dnsupdate,samba_kcc,samba_spnupdate,samba_upgradedns} $( 1) /usr/sbin/
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_NETBIOS ) , y )
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/sbin/nmbd $( 1) /usr/sbin/
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_WINBIND ) , y )
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/wbinfo $( 1) /usr/bin/
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/sbin/winbindd $( 1) /usr/sbin/
e n d i f
i f e q ( $( CONFIG_SAMBA 4_SERVER_ACL ) , y )
$( INSTALL_BIN) $( PKG_INSTALL_DIR) /usr/bin/sharesec $( 1) /usr/bin/
e n d i f
$( INSTALL_DIR) $( 1) /etc/config $( 1) /etc/samba $( 1) /etc/init.d
$( INSTALL_DATA) ./files/samba.config $( 1) /etc/config/samba4
$( INSTALL_DATA) ./files/smb.conf.template $( 1) /etc/samba
$( INSTALL_BIN) ./files/samba.init $( 1) /etc/init.d/samba4
e n d e f
d e f i n e P a c k a g e / s a m b a 4 - s e r v e r / c o n f f i l e s
/ e t c / c o n f i g / s a m b a 4
/ e t c / s a m b a / s m b . c o n f . t e m p l a t e
/ e t c / s a m b a / s m b . c o n f
/ e t c / s a m b a / s m b p a s s w d
/ e t c / s a m b a / s e c r e t s . t d b
/ e t c / s a m b a / p a s s d b . t d b
/ e t c / s a m b a / i d m a p . l d b
/ e t c / s a m b a / l m h o s t s
/ e t c / n s s w i t c h . c o n f
e n d e f
$( eval $ ( call BuildPackage ,samba 4-libs ) )
$( eval $ ( call BuildPackage ,samba 4-server ) )
$( eval $ ( call BuildPackage ,samba 4-client ) )
$( eval $ ( call BuildPackage ,samba 4-admin ) )
$( eval $ ( call BuildPackage ,samba 4-utils ) )