105 lines
4.2 KiB
Bash
105 lines
4.2 KiB
Bash
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
# The build function is executed in the source directory
|
|
# This function is used to compile the source code
|
|
build() {
|
|
local _samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
|
|
local _samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
|
|
local _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
|
|
|
|
./configure --prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--libexecdir=/usr/libexec/samba \
|
|
--localstatedir=/var \
|
|
--with-configdir=/etc/samba \
|
|
--with-lockdir=/var/cache/samba \
|
|
--with-sockets-dir=/run/samba \
|
|
--with-piddir=/run \
|
|
--with-ads \
|
|
--with-ldap \
|
|
--with-winbind \
|
|
--with-acl-support \
|
|
--with-pam \
|
|
--with-pammodulesdir=/usr/lib/security \
|
|
--without-systemd \
|
|
--enable-fhs \
|
|
--private-libraries='!ldb' \
|
|
--bundled-libraries='!tdb,!talloc,!pytalloc-util,!tevent,!popt,!pyldb-util' \
|
|
--with-shared-modules="${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules},vfs_io_uring" \
|
|
--disable-rpath-install \
|
|
--with-profiling-data
|
|
|
|
make
|
|
}
|
|
|
|
_pick() {
|
|
local p="$1" f d; shift
|
|
for f; do
|
|
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
|
|
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
|
|
mkdir -p "$(dirname "$d")"
|
|
mv "$f" "$d"
|
|
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
|
|
done
|
|
}
|
|
|
|
# The package function is executed in the source directory
|
|
# This function is used to move the compiled files into the output directory
|
|
package_samba() {
|
|
make DESTDIR="$BPM_OUTPUT" install
|
|
|
|
cd "$BPM_OUTPUT"
|
|
|
|
# Move ldb files into split package
|
|
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
|
|
_pick ldb usr/bin/ldb*
|
|
_pick ldb usr/lib/libldb*
|
|
_pick ldb usr/lib/samba/ldb
|
|
_pick ldb usr/lib/pkgconfig/ldb.pc
|
|
_pick ldb usr/include/samba-4.0/ldb*
|
|
_pick ldb ./${site_packages}/{_ldb_text.py,ldb.cpython-$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')-$CARCH-linux-gnu.so}
|
|
_pick ldb usr/share/man/man1/ldb*
|
|
_pick ldb usr/share/man/man3
|
|
|
|
# Move libwbclient files into split package
|
|
_pick libwbclient usr/lib/libwbclient.so*
|
|
_pick libwbclient usr/lib/pkgconfig/wbclient.pc
|
|
_pick libwbclient usr/include/samba-4.0/wbclient.h
|
|
|
|
# Move smbclient files into split package
|
|
_pick smbclient usr/bin/{smbclient,rpcclient,smbspool,smbtree,smbcacls,smbcquotas,smbget,net,nmblookup,smbtar}
|
|
_pick smbclient usr/lib/lib*.so*
|
|
_pick smbclient usr/lib/samba/lib*.so
|
|
_pick smbclient usr/lib/pkgconfig/{smbclient,netapi}.pc
|
|
_pick smbclient usr/include/samba-4.0/{libsmbclient,netapi}.h
|
|
_pick smbclient usr/share/man/man1/{smbclient,rpcclient,smbtree,smbcacls,smbcquotas,smbget,nmblookup,smbtar}.1
|
|
_pick smbclient usr/share/man/man7/libsmbclient.7
|
|
_pick smbclient usr/share/man/man8/{smbspool,net}.8
|
|
|
|
# Install esvm service
|
|
install -Dm644 "$BPM_WORKDIR"/samba.esv "$BPM_OUTPUT"/etc/esvm/services/samba.esv
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/samba/COPYING
|
|
}
|
|
|
|
package_ldb() {
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/ldb/COPYING
|
|
}
|
|
|
|
package_libwbclient() {
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/libwbclient/COPYING
|
|
}
|
|
|
|
package_smbclient() {
|
|
install -d "$BPM_OUTPUT"/usr/lib/cups/backend
|
|
ln -sf /usr/bin/smbspool "$BPM_OUTPUT"/usr/lib/cups/backend/smb
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/smbclient/COPYING
|
|
}
|