summaryrefslogtreecommitdiffstats
path: root/abs/extra/samba/PKGBUILD
blob: 54f5b826397526f097bc1e1efe073d5962d18751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>
# Contributor: Michael Hansen <zrax0111 gmail com>
# Contributor: Marco A Rojas <marquicus at gmail.com>
# Contributor: Netanel Shine <netanel at archlinux.org.il >
# Contributor: ngoonee <ngoonee.talk@gmail.com>
# Contributor: Adam Russell <adamlr6+arch@gmail.com>
# Contributor: Dhananjay Sathe <dhananjaysathe@gmail.com>

pkgbase=samba
pkgname=('libwbclient' 'smbclient' 'samba')
pkgver=4.8.0
pkgrel=1
arch=(x86_64)
url="http://www.samba.org"
license=('GPL3')
makedepends=('python2' 'docbook-xsl' 'pkg-config' 'libbsd' 'db' 'popt' 'libcups' 
             'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb>=1.1.15' 'krb5' 'pam' 'systemd' 
             'gnutls>=2.4.1' 'talloc' 'tdb' 'dbus' 'libaio' 'perl-parse-yapp')
source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar.gz
        http://us1.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar.asc
        samba.logrotate
        samba.pam
        samba.conf)
validpgpkeys=('52FBC0B86D954B0843324CDC6F33915B6568B7EA') #Samba Distribution Verification Key <samba-bugs@samba.org>
### UNINSTALL dmapi package before building!!!

prepare() {
  cd samba-${pkgver}
}

build() {
  # Use samba-pkg as a staging directory for the split packages
  # (This is so RPATHS and symlinks are generated correctly via
  # make install, but the otherwise unsplit pieces can be split)
  _pkgsrc=${srcdir}/samba-pkg
  rm -rf ${_pkgsrc}
  cd ${srcdir}/samba-${pkgver}
  # change to use python2
  SAVEIFS=${IFS}
  IFS=$(echo -en "\n\b")
  PYTHON_CALLERS="$(find ${srcdir}/samba-${pkgver} -name '*.py')
$(find ${srcdir}/samba-${pkgver} -name 'wscript*')
$(find ${srcdir}/samba-${pkgver} -name 'configure.ac')
$(find ${srcdir}/samba-${pkgver} -name 'upgrade_from_s3')
$(find ${srcdir}/samba-${pkgver}/buildtools -type f)
$(find ${srcdir}/samba-${pkgver}/source4/scripting -type f)"
  sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \
         -e "s|python-config|python2-config|" \
         -e "s|bin/python|bin/python2|" \
      ${PYTHON_CALLERS}
  IFS=${SAVEIFS}

  export PYTHON=/usr/bin/python2
_samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
_samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
_samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
 cd ${srcdir}/samba-${pkgver}
  ./configure --enable-fhs \
              --prefix=/usr \
              --sbindir=/usr/bin \
              --libdir=/usr/lib \
	      --libexecdir=/usr/lib/samba \
              --localstatedir=/var \
              --with-configdir=/etc/samba \
              --with-lockdir=/var/cache/samba \
              --with-sockets-dir=/var/run/samba \
              --with-piddir=/var/run \
              --with-ads \
              --with-ldap \
              --with-winbind \
              --with-acl-support \
              --with-systemd \
              --systemd-install-services \
              --enable-gnutls \
              --with-pam \
              --with-pammodulesdir=/usr/lib/security \
              --bundled-libraries=!tdb,!talloc,!pytalloc-util,!tevent,!popt,!ldb,!pyldb-util \
              --with-shared-modules=${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules} \
              --disable-rpath-install

              # Add this to the options once it's working...
               #--with-system-mitkrb5 /opt/heimdal
  make
  make DESTDIR="${_pkgsrc}/" install

  # This gets skipped somehow
  if [ ! -e ${_pkgsrc}/usr/bin/smbtar ]; then
      install -m755 ${srcdir}/samba-${pkgver}/source3/script/smbtar ${_pkgsrc}/usr/bin/
  fi
}

package_libwbclient() {
pkgdesc="Samba winbind client library"
depends=('glibc' 'libbsd')
  # Use samba-pkg as a staging directory for the split packages
  # (This is so RPATHS and symlinks are generated correctly via
  # make install, but the otherwise unsplit pieces can be split)
  _pkgsrc=${srcdir}/samba-pkg
  install -d -m755 ${pkgdir}/usr/lib
  mv ${_pkgsrc}/usr/lib/libwbclient*.so* ${pkgdir}/usr/lib/

  install -d -m755 ${pkgdir}/usr/lib/samba
  mv ${_pkgsrc}/usr/lib/samba/libwinbind-client*.so* ${pkgdir}/usr/lib/samba/
  mv ${_pkgsrc}/usr/lib/samba/libreplace-samba4.so* ${pkgdir}/usr/lib/samba/

  install -d -m755 ${pkgdir}/usr/lib/pkgconfig
  mv ${_pkgsrc}/usr/lib/pkgconfig/wbclient.pc ${pkgdir}/usr/lib/pkgconfig/

  install -d -m755 ${pkgdir}/usr/include/samba-4.0
  mv ${_pkgsrc}/usr/include/samba-4.0/wbclient.h ${pkgdir}/usr/include/samba-4.0/
}

package_smbclient() {
pkgdesc="Tools to access a server's filespace and printers via SMB"
depends=('popt' 'cifs-utils' 'tdb' "libwbclient>=$pkgver" 'ldb'
         'tevent' 'libgcrypt' 'python2' 'talloc' 'readline' 'gnutls' 
         'libbsd' 'libldap' 'libcups')

    _smbclient_bins=('smbclient' 'rpcclient' 'smbspool'
                     'smbtree' 'smbcacls' 'smbcquotas' 'smbget' 'net'
                     'nmblookup' 'smbtar')
    # Use samba-pkg as a staging directory for the split packages
    # (This is so RPATHS and symlinks are generated correctly via
    # make install, but the otherwise unsplit pieces can be split)
    _pkgsrc=${srcdir}/samba-pkg
    install -d -m755 ${pkgdir}/usr/bin
    for bin in ${_smbclient_bins[@]}; do
        mv ${_pkgsrc}/usr/bin/${bin} ${pkgdir}/usr/bin/
    done

    # smbclient binaries link to the majority of the samba
    # libs, so this is a shortcut instead of resolving the
    # whole dependency tree by hand
    install -d -m755 ${pkgdir}/usr/lib
    for lib in ${_pkgsrc}/usr/lib/lib*.so*; do
        mv ${lib} ${pkgdir}/usr/lib/
    done

    install -d -m755 ${pkgdir}/usr/lib/samba
    for lib in ${_pkgsrc}/usr/lib/samba/lib*.so*; do
        mv ${lib} ${pkgdir}/usr/lib/samba/
    done

    install -d -m755 ${pkgdir}/usr/lib/pkgconfig
    mv ${_pkgsrc}/usr/lib/pkgconfig/smbclient.pc ${pkgdir}/usr/lib/pkgconfig/
    mv ${_pkgsrc}/usr/lib/pkgconfig/netapi.pc ${pkgdir}/usr/lib/pkgconfig/

    install -d -m755 ${pkgdir}/usr/share/man/man1
    install -d -m755 ${pkgdir}/usr/share/man/man7
    install -d -m755 ${pkgdir}/usr/share/man/man8
    for bin in ${_smbclient_bins[@]}; do
        if [ -e ${_pkgsrc}/usr/share/man/man1/${bin}.1 ]; then
            mv ${_pkgsrc}/usr/share/man/man1/${bin}.1 ${pkgdir}/usr/share/man/man1/
        fi
        if [ -e ${_pkgsrc}/usr/share/man/man8/${bin}.8 ]; then
            mv ${_pkgsrc}/usr/share/man/man8/${bin}.8 ${pkgdir}/usr/share/man/man8/
        fi
    done
    mv ${_pkgsrc}/usr/share/man/man7/libsmbclient.7 ${pkgdir}/usr/share/man/man7/

    install -d -m755 ${pkgdir}/usr/include/samba-4.0
    mv ${_pkgsrc}/usr/include/samba-4.0/libsmbclient.h ${pkgdir}/usr/include/samba-4.0/
    mv ${_pkgsrc}/usr/include/samba-4.0/netapi.h ${pkgdir}/usr/include/samba-4.0/

    mkdir -p ${pkgdir}/usr/lib/cups/backend
    ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb
}

package_samba() {
pkgdesc="SMB Fileserver and AD Domain server"
depends=('db>=4.7' 'popt' 'libcups' 'libcap>=2.16' 'gamin' 'gnutls>=2.4.1'
         'talloc' 'ldb' 'libbsd' 'python2' 'iniparser' 'tdb' 'libaio' 'perl-parse-yapp' "smbclient>=$pkgver")
backup=(etc/logrotate.d/samba
        etc/pam.d/samba
        etc/samba/smb.conf
        etc/xinetd.d/swat
        etc/conf.d/samba)
install=samba.install
    # Use samba-pkg as a staging directory for the split packages
    # (This is so RPATHS and symlinks are generated correctly via
    # make install, but the otherwise unsplit pieces can be split)
    _pkgsrc=${srcdir}/samba-pkg
    # Everything that libwbclient and smbclient didn't install goes
    # into the samba package...
    mv ${_pkgsrc}/* ${pkgdir}/
    rmdir ${_pkgsrc}

    _pyver=`python2 -c 'import sys; print(sys.version[:3])'`

    find ${pkgdir}/usr/lib/python${_pyver}/site-packages/ -name '*.py' | \
         xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|"
    find ${pkgdir}/usr/bin ${pkgdir}/usr/bin -type f -executable | \
         xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|"

    # Make admin scripts look in the right place for the samba python module
    for script in bin/samba_dnsupdate bin/samba_kcc bin/samba_spnupdate \
                  bin/samba_upgradedns bin/samba-tool
    do
        sed -i "/^sys\.path\.insert/ a\
sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
               ${pkgdir}/usr/${script}
    done

  # packaging/wscript_build to use /etc/conf.d
  sed -i -e '/^EnvironmentFile/ s/sysconfig/conf.d/' "${pkgdir}"/usr/lib/systemd/system/*.service
  install -d -m755  "${pkgdir}"/etc/conf.d
  install -m644 "${srcdir}"/samba-${pkgver}/packaging/systemd/samba.sysconfig "${pkgdir}"/etc/conf.d/samba

  # create ephemeral dirs via tmpfiles rather than shipping them in package
  install -D -m644 ${srcdir}/samba.conf ${pkgdir}/usr/lib/tmpfiles.d/samba.conf
  # create config dir
  install -d -m755 ${pkgdir}/etc/samba

  mkdir -p ${pkgdir}/etc/samba/private
  chmod 700 ${pkgdir}/etc/samba/private

  install -D -m644 ${srcdir}/samba.logrotate ${pkgdir}/etc/logrotate.d/samba
  install -D -m644 ${srcdir}/samba.pam ${pkgdir}/etc/pam.d/samba 

  # winbind krb5 locator
  mkdir -p ${pkgdir}/usr/lib/krb5/plugins/libkrb5
  mv  ${pkgdir}/usr/lib/*.so ${pkgdir}/usr/lib/krb5/plugins/libkrb5/
  
  # spool directory
  install -d -m1777 ${pkgdir}/var/spool/samba
  
  rm -rf ${pkgdir}/var/run
  
  # copy ldap example
  install -D -m644 ${srcdir}/samba-${pkgver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema
}
md5sums=('3724c1d3d1befe12ecf7bb86ed7e3463'
         'SKIP'
         '995621522c6ec9b68c1b858ceed627ed'
         '96f82c38f3f540b53f3e5144900acf17'
         '49abd7b719e3713a3f75a8a50958e381')