1 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
2 # Contributor: judd <jvinet@zeroflux.org>
3 # Contributor: Michael Hansen <zrax0111 gmail com>
4 # Contributor: Marco A Rojas <marquicus at gmail.com>
5 # Contributor: Netanel Shine <netanel at archlinux.org.il >
6 # Contributor: ngoonee <ngoonee.talk@gmail.com>
7 # Contributor: Adam Russell <adamlr6+arch@gmail.com>
8 # Contributor: Dhananjay Sathe <dhananjaysathe@gmail.com>
11 pkgname=('libwbclient' 'smbclient' 'samba')
15 url="https://www.samba.org"
17 makedepends=('python' 'python-markdown' 'python-dnspython' 'docbook-xsl' 'pkg-config' 'libbsd' 'popt' 'libcups'
18 'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb' 'krb5' 'pam'
19 'systemd' 'gnutls' 'talloc' 'tdb' 'dbus'
20 'perl-parse-yapp' 'libnsl' 'libtirpc' 'rpcsvc-proto' 'jansson'
21 'liburing' 'perl-json' 'glusterfs')
23 'python-dnspython: samba_dnsupdate and samba_upgradedns in AD setup'
24 'python-markdown: for samba-tool domain schemeupgrade'
25 'glusterfs: for vfs_glusterfs support'
27 source=(https://us1.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar{.gz,.asc}
31 validpgpkeys=('81F5E2832BD2545A1897B713AA99442FB680B620') #Samba Distribution Verification Key <samba-bugs@samba.org>
32 sha512sums=('e13f1313ae23c65580f3d9eec8ba556f77327d4876f09387a1701dc62df5c7c18955ed42a50250c0ebd53d90afcfdea2743dc6776b63c900c47239afacfa4aba'
34 '2ba0691ded467e4d6e40821f6de58c00f8962209efe2e60284c0c87756ab471c22c3d63b77d506e48c90ed0d852a2a24e41be1d499cf74a73cb99da0b503c858'
35 '1e6183ab0eb812b3ef687ac2c26ce78f7cb30540f606d20023669ac00ba04075487fb72e4dc89cc05dab0269ff6aca98fc1167cc75669c225b88b592482fbf67'
36 'e46ee848baabb261e7468ecee43aba4d001a24f86f5322ae522abdb75030fd0ebd9063b9df0be3576c4d1654d81331f5e389aee16ec2fa138259ae4728e94efc')
37 ### UNINSTALL dmapi package before building!!!
39 # Use samba-pkg as a staging directory for the split packages
40 # (This is so RPATHS and symlinks are generated correctly via
41 # make install, but the otherwise unsplit pieces can be split)
43 _pkgsrc="${srcdir}"/samba-pkg
45 _samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
46 _samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
47 _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
49 ./configure --enable-fhs \
54 --libexecdir=/usr/lib/samba \
55 --localstatedir=/var \
56 --with-configdir=/etc/samba \
57 --with-lockdir=/var/cache/samba \
58 --with-sockets-dir=/run/samba \
65 --systemd-install-services \
67 --with-pammodulesdir=/usr/lib/security \
68 --bundled-libraries=!tdb,!talloc,!pytalloc-util,!tevent,!popt,!ldb,!pyldb-util \
69 --with-shared-modules=${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules},vfs_io_uring \
70 --disable-rpath-install \
73 # Add this to the options once it's working...
74 #--with-system-mitkrb5 /opt/heimdal
76 make DESTDIR="${_pkgsrc}/" install
78 # This gets skipped somehow
79 if [ ! -e "${_pkgsrc}"/usr/bin/smbtar ]; then
80 install -m755 "${srcdir}"/samba-${pkgver}/source3/script/smbtar "${_pkgsrc}"/usr/bin/
84 package_libwbclient() {
85 pkgdesc="winbind client library"
88 _pkgsrc="${srcdir}"/samba-pkg
89 install -d -m755 "${pkgdir}"/usr/lib
90 for lib in "${_pkgsrc}"/usr/lib/libwbclient.so*; do
91 mv ${lib} "${pkgdir}"/usr/lib/
93 install -d -m755 "${pkgdir}"/usr/lib/pkgconfig
94 mv "${_pkgsrc}"/usr/lib/pkgconfig/wbclient.pc "${pkgdir}"/usr/lib/pkgconfig/
95 install -d -m755 "${pkgdir}"/usr/include/samba-4.0
96 mv "${_pkgsrc}"/usr/include/samba-4.0/wbclient.h "${pkgdir}"/usr/include/samba-4.0/
100 pkgdesc="Tools to access a server's filespace and printers via SMB"
101 depends=('popt' 'cifs-utils' 'tdb' 'ldb'
102 'tevent' 'python' 'talloc' 'readline' 'gnutls'
103 'libbsd' 'libldap' 'libcups' 'libarchive' 'libnsl' 'jansson'
104 'libldb.so' 'libtdb.so' 'libtevent.so' 'libreadline.so' 'icu'
107 _smbclient_bins=('smbclient' 'rpcclient' 'smbspool'
108 'smbtree' 'smbcacls' 'smbcquotas' 'smbget' 'net'
109 'nmblookup' 'smbtar')
110 _pkgsrc="${srcdir}"/samba-pkg
111 install -d -m755 "${pkgdir}"/usr/bin
112 for bin in ${_smbclient_bins[@]}; do
113 mv "${_pkgsrc}"/usr/bin/${bin} "${pkgdir}"/usr/bin/
116 # smbclient binaries link to the majority of the samba
117 # libs, so this is a shortcut instead of resolving the
118 # whole dependency tree by hand
119 install -d -m755 "${pkgdir}"/usr/lib
120 for lib in "${_pkgsrc}"/usr/lib/lib*.so*; do
121 mv ${lib} "${pkgdir}"/usr/lib/
124 install -d -m755 "${pkgdir}"/usr/lib/samba
125 for lib in "${_pkgsrc}"/usr/lib/samba/lib*.so*; do
126 mv ${lib} "${pkgdir}"/usr/lib/samba/
129 install -d -m755 "${pkgdir}"/usr/lib/pkgconfig
130 mv "${_pkgsrc}"/usr/lib/pkgconfig/smbclient.pc "${pkgdir}"/usr/lib/pkgconfig/
131 mv "${_pkgsrc}"/usr/lib/pkgconfig/netapi.pc "${pkgdir}"/usr/lib/pkgconfig/
133 install -d -m755 "${pkgdir}"/usr/share/man/man1
134 install -d -m755 "${pkgdir}"/usr/share/man/man7
135 install -d -m755 "${pkgdir}"/usr/share/man/man8
136 for bin in ${_smbclient_bins[@]}; do
137 if [ -e "${_pkgsrc}"/usr/share/man/man1/${bin}.1 ]; then
138 mv "${_pkgsrc}"/usr/share/man/man1/${bin}.1 "${pkgdir}"/usr/share/man/man1/
140 if [ -e "${_pkgsrc}"/usr/share/man/man8/${bin}.8 ]; then
141 mv "${_pkgsrc}"/usr/share/man/man8/${bin}.8 "${pkgdir}"/usr/share/man/man8/
144 mv "${_pkgsrc}"/usr/share/man/man7/libsmbclient.7 "${pkgdir}"/usr/share/man/man7/
146 install -d -m755 "${pkgdir}"/usr/include/samba-4.0
147 mv "${_pkgsrc}"/usr/include/samba-4.0/libsmbclient.h "${pkgdir}"/usr/include/samba-4.0/
148 mv "${_pkgsrc}"/usr/include/samba-4.0/netapi.h "${pkgdir}"/usr/include/samba-4.0/
150 mkdir -p "${pkgdir}"/usr/lib/cups/backend
151 ln -sf /usr/bin/smbspool "${pkgdir}"/usr/lib/cups/backend/smb
155 pkgdesc="SMB Fileserver and AD Domain server"
156 depends=('popt' 'libcups' 'libcap>=2.16' 'gnutls>=2.4.1'
157 'talloc' 'ldb' 'libbsd' 'python' 'tdb' "smbclient>=$pkgver" 'gpgme'
158 'libldb.so' 'libtdb.so' 'libtevent.so' 'liburing' 'libwbclient' )
159 optdepends=('python-dnspython: netads_dns.py, dnsresolver.py and traffic_packets.py '
160 'python-markdown: ms_schema_markdown.py and ms_forest_updates_markdown.py'
161 "python-cryptography: lockout_tests.py gp_cert_auto_enroll_ext.py \
162 gpo.py and kcrypto.py")
163 backup=(etc/logrotate.d/samba
166 install=samba.install
168 # Everything that libwbclient and smbclient didn't install goes
169 # into the samba package...
170 mv "${_pkgsrc}"/* "${pkgdir}"
173 # Make admin scripts look in the right place for the samba python module
174 for script in bin/samba_dnsupdate bin/samba_kcc bin/samba_spnupdate \
175 bin/samba_upgradedns bin/samba-tool
177 sed -i "/^sys\.path\.insert/ a\
178 sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
179 "${pkgdir}"/usr/${script}
182 # packaging/wscript_build to use /etc/conf.d
183 sed -i -e '/^EnvironmentFile/ s/sysconfig/conf.d/' "${pkgdir}"/usr/lib/systemd/system/*.service
184 install -d -m755 "${pkgdir}"/etc/conf.d
185 install -m644 "${srcdir}"/samba-${pkgver}/packaging/systemd/samba.sysconfig "${pkgdir}"/etc/conf.d/samba
187 # create ephemeral dirs via tmpfiles rather than shipping them in package
188 install -D -m644 "${srcdir}"/samba.conf "${pkgdir}"/usr/lib/tmpfiles.d/samba.conf
190 install -d -m755 "${pkgdir}"/etc/samba
192 mkdir -p "${pkgdir}"/etc/samba/private
193 chmod 700 "${pkgdir}"/etc/samba/private
195 install -D -m644 "${srcdir}"/samba.logrotate "${pkgdir}"/etc/logrotate.d/samba
196 install -D -m644 "${srcdir}"/samba.pam "${pkgdir}"/etc/pam.d/samba
199 install -d -m1777 "${pkgdir}"/var/spool/samba
201 rm -rf "${pkgdir}"/run
202 rm -rf "${pkgdir}"/var/run
203 rm -rf "${pkgdir}"/etc/sysconfig
206 install -D -m644 "${srcdir}"/samba-${pkgver}/examples/LDAP/samba.schema "${pkgdir}"/usr/share/doc/samba/examples/LDAP/samba.schema