summaryrefslogtreecommitdiff
path: root/packages/net-fs/samba/samba.exlib
blob: cdf9f85b3da53d6dada4b20b1f5892907639c952 (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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Copyright 2011-2012 Pierre Lejeune <superheron@gmail.com>
# Copyright 2013-2017 Wulf C. Krueger <philantrop@exherbo.org>
# Distributed under the terms of the GNU General Public License v2

require pam wafsamba systemd-service

export_exlib_phases src_prepare src_configure src_install

SUMMARY="Samba provides seamless file and print services to SMB/CIFS clients, e. g. Windows"
DESCRIPTION="
Samba is a free software implementation of the SMB/CIFS networking protocol that
can be run on many platforms other than Microsoft Windows. Samba uses the TCP/IP
protocol that is installed on the host. When correctly configured, it allows
that host to interact with a Microsoft Windows client or server as if it is a Windows
file and print server. Additionally, it can act as a PDC, a domain member server
or as a part of an Active Directory.
"
HOMEPAGE="https://www.${PN}.org"
DOWNLOADS="mirror://samba/stable/${PNV}.tar.gz"

BUGS_TO="tgurr@exherbo.org"

LICENCES="GPL-3"
SLOT="0"
MYOPTIONS="
    acl
    addc [[
        description = [ Allow Samba to act as an Active Directory Domain Controller ]
        requires = [ gnutls ]
    ]]
    ads [[
        description = [ Enable Active Directory support ]
        requires = [ acl gnutls ldap winbind ]
    ]]
    avahi [[ description = [ Enable Avahi support ] ]]
    cluster [[ description = [ Enable the Samba cluster extensions ] ]]
    cups
    gnutls
    gpg [[
        description = [ Store cleartext passwords in a PGP/OpenGPG encrypted form ]
        requires = [ addc ]
    ]]
    ldap
    pam
    quotas [[ description = [ Enables support for user quotas ] ]]
    syslog [[ description = [ Enables support for syslog ] ]]
    system-krb5 [[ description = [ Use krb5 instead of the bundled heimdal ] ]]
    systemd
    winbind [[ description = [ Enables support for the winbind auth daemon ] ]]
"

# The test are simply broken.
RESTRICT="test"

# !system-krb5? ( app-crypt/heimdal[>=1.5] )
DEPENDENCIES="
    build+run:
        app-arch/libarchive[>=3.1.2]
        dev-db/ldb[>=1.3.3][python_abis:*(-)?]
        dev-db/tdb[>=1.3.15][python_abis:*(-)?]
        dev-lang/perl:=
        dev-libs/iniparser
        dev-libs/libbsd [[ note = [ automagic ] ]]
        dev-libs/libgcrypt
        dev-libs/libgpg-error
        dev-libs/popt
        dev-libs/talloc[>=2.1.11][python_abis:*(-)?]
        dev-libs/tevent[>=0.9.36][python_abis:*(-)?]
        dev-perl/Parse-Yapp
        dev-python/iso8601[python_abis:*(-)?]
        dev-util/subunit[python_abis:*(-)?]
        net-libs/cyrus-sasl
        sys-apps/attr
        sys-apps/dbus
        sys-libs/libcap
        pam? ( sys-libs/pam )
        sys-libs/readline:=
        acl? ( sys-apps/acl )
        addc? ( dev-python/pycrypto[python_abis:*(-)?] )
        ads? ( dev-python/dnspython[python_abis:*(-)?] )
        avahi? ( net-dns/avahi )
        cluster? ( dev-libs/ctdb )
        cups? ( net-print/cups )
        gnutls? ( dev-libs/gnutls )
        gpg? (
            app-crypt/gpgme
            dev-python/pygpgme[python_abis:*(-)?]
        )
        ldap? ( net-directory/openldap )
        syslog? ( virtual/syslog )
        system-krb5? ( app-crypt/krb5[>=1.15.1] )
        systemd? ( sys-apps/systemd )
    test:
        dev-util/cmocka[>=1.1.1]
        sys-libs/nss_wrapper[>=1.1.3]
        sys-libs/pam_wrapper[>=1.0.4]
        sys-libs/resolv_wrapper[>=1.1.4]
        sys-libs/socket_wrapper[>=1.1.9]
        sys-libs/uid_wrapper[>=1.2.4]
    suggestion:
        app-antivirus/clamav [[
            description = [ vfs_virusfilter can use ClamAV to scan for viruses ]
        ]]
        media-gfx/graphviz [[
            description = [ samba-tool utilizes Graphviz for dot output and text-based heatmaps ]
        ]]
"

WAF_SRC_CONFIGURE_PARAMS+=(
    --builtin-libraries=NONE
    --nopyc
    --nopyo
    --sbindir=/usr/x86_64-pc-linux-gnu/bin
    --systemd-install-services
    --enable-fhs
    --enable-pthreadpool
    --disable-cephfs
    --disable-glusterfs
    --with-iconv
    --with-libarchive
    --with-lockdir=/run/lock/samba
    --with-modulesdir=/usr/$(exhost --target)/lib/samba
    --with-piddir=/run
    --with-privatedir=/var/lib/${PN}/private
    --with-sendfile-support
    --with-sockets-dir=/run/samba
    --with-systemddir=${SYSTEMDSYSTEMUNITDIR}
    --with-utmp
    --without-automount
    --without-dmapi
    --without-fam
    --without-lttng
    --without-ntvfs-fileserver
)

if ever is_scm; then
    DEPENDENCIES+="
        build+run:
            dev-db/ldb[>=1.4.0][python_abis:*(-)?]

    "
    WAF_SRC_CONFIGURE_PARAMS+=(
        --without-json-audit
    )
fi

WAF_SRC_CONFIGURE_OPTION_ENABLES=(
    avahi
    cups
    gnutls
)

WAF_SRC_CONFIGURE_OPTION_WITHS=(
    "acl acl-support"
    ads
    "ads dnsupdate"
    "cluster cluster-support"
    "gpg gpgme"
    ldap
    quotas
    syslog
    systemd
    winbind
)

WAF_SRC_CONFIGURE_TESTS=(
    --enable-selftest
)

# Build failed: -> missing file: '[...]/bin/default/docs-xml/smbdotconf/parameters.all.xml'
#WAF_SRC_COMPILE_PARAMS+=( -j1 )

samba_src_prepare() {
    default

    # adjust to /run
    edo sed \
        -e "s:/var/run:/run:g" \
        -i packaging/systemd/samba.conf.tmp

    # rpcgen hardcodes the cpp command
    local dir=${WORKBASE}/symlinked-build-tools
    edo mkdir -p ${dir}
    edo ln -s /usr/host/bin/$(exhost --target)-cpp ${dir}/cpp
    edo sed \
        -e "s:rpcgen:rpcgen -Y ${WORKBASE}/symlinked-build-tools:g" \
        -i source3/modules/wscript_build \
        -i ctdb/wscript

#    # ensure system heimdal is used
#    if ever at_least 4.3.0; then
#        edo rm source4/heimdal_build/krb5-types.h
#        edo rm source4/heimdal/kdc/kdc.h
#    fi
}

samba_src_configure() {
    WAF_SRC_CONFIGURE_PARAMS+=(
        $(option system-krb5 && echo --with-system-mitkrb5)
        $(option !addc && echo --without-ad-dc)
    )

    # Samba doesn't build with heimdal 1.5.3, 1.6_rc2 or git master
    if ! option system-krb5; then
        WAF_SRC_CONFIGURE_PARAMS+=(
            --bundled-libraries=NONE,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,com_err,compile_et,asn1_compile
        )
    else
        WAF_SRC_CONFIGURE_PARAMS+=(
            --bundled-libraries=NONE
        )
    fi
    if option pam; then
        WAF_SRC_CONFIGURE_PARAMS+=(
            --with-pam
            --with-pammodulesdir=$(getpam_mod_dir)
        )
    else
        WAF_SRC_CONFIGURE_PARAMS+=(
            --without-pam
        )
    fi

    waf_src_configure
}

samba_src_install() {
    waf_src_install

    python_bytecompile

    option addc || edo rm "${IMAGE}"/${SYSTEMDSYSTEMUNITDIR}/samba.service
    option winbind || edo rm "${IMAGE}"/${SYSTEMDSYSTEMUNITDIR}/winbind.service

    # tmpfile is included but doesn't get installed, last checked: 4.8.0
    insinto /usr/$(exhost --target)/lib/tmpfiles.d
    hereins ${PN}.conf <<EOF
d /run/samba 0755 root root -
EOF

    if option cluster; then
        insinto /usr/$(exhost --target)/lib/tmpfiles.d
        hereins ctdb.conf <<EOF
d /run/ctdb 0755 root root -
EOF
    fi

    if option cups; then
        dodir $(cups-config --serverbin)/backend
        dosym /usr/$(exhost --target)/bin/smbspool $(cups-config --serverbin)/backend/smb
    fi

    keepdir /var/{cache,lib,log}/samba
    edo rmdir "${IMAGE}"/run/{lock/{samba,},{samba,}}

    keepdir /var/lib/samba/bind-dns
    keepdir /var/lib/samba/private/smbd.tmp/messaging

    insinto /etc/${PN}
    doins "${WORK}"/examples/smb.conf.default
}