Files
chromebrew/packages/smbclient.rb
satmandu 65bce4cddf More gnome 40.1 updates, fix speex/speexdsp; webkit2gtk, wpebackend_fdo, waypipe, smbclient updates (#5798)
* add some packages

* Fixup speex & speexdsp and dependent packages, + more updates

* py3_pip => 21.1.1
2021-05-19 15:39:37 -05:00

153 lines
6.4 KiB
Ruby

# Adapted from Arch Linux samba PKGBUILD at:
# https://github.com/archlinux/svntogit-packages/raw/packages/samba/trunk/PKGBUILD
require 'package'
class Smbclient < Package
description 'Tools to access a servers filespace and printers via SMB'
homepage 'https://www.samba.org'
version '4.14.4'
license 'GPLv3'
compatibility 'all'
source_url "https://us1.samba.org/samba/ftp/stable/samba-#{version}.tar.gz"
source_sha256 '89af092a0b00f5354ed287f0aa37b8c2cf9ba2ce67ea6464192e2c18528f89b9'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/smbclient/4.14.4_armv7l/smbclient-4.14.4-chromeos-armv7l.tpxz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/smbclient/4.14.4_armv7l/smbclient-4.14.4-chromeos-armv7l.tpxz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/smbclient/4.14.4_i686/smbclient-4.14.4-chromeos-i686.tpxz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/smbclient/4.14.4_x86_64/smbclient-4.14.4-chromeos-x86_64.tpxz'
})
binary_sha256({
aarch64: '22d24a7a51efc97853ed1b7b110a84b099efd7b465dbf46194a406fc9af6b8d5',
armv7l: '22d24a7a51efc97853ed1b7b110a84b099efd7b465dbf46194a406fc9af6b8d5',
i686: '2e50aa2792825d119143bd9cbeae10d167623d2ffee50f4e4b7d64ff69251b7e',
x86_64: '8f0f6e9e37d39b8893034af1e019bcf4c1c4fcf0c689edbb37da967658c7c1f4'
})
depends_on 'avahi'
depends_on 'cmocka'
depends_on 'cups'
depends_on 'docbook_xsl'
depends_on 'gpgme' => :build
depends_on 'jansson'
depends_on 'ldb'
depends_on 'libbsd'
depends_on 'libcap'
depends_on 'libunwind'
depends_on 'liburing' => :build
depends_on 'linux_pam'
depends_on 'lmdb' => :build
depends_on 'perl_parse_yapp' => :build
depends_on 'popt'
depends_on 'talloc'
depends_on 'tdb'
depends_on 'tevent'
@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'
@smbclient_bins = %w[smbclient rpcclient smbspool smbtree smbcacls
smbcquotas smbget net nmblookup smbtar]
@smbclient_pkgconfig = %w[smbclient netapi wbclient]
@python_deps = %w[Markdown dnspython]
@xml_catalog_files = ENV['XML_CATALOG_FILES']
def self.patch
system "sed -e 's:<gpgme\.h>:<gpgme/gpgme.h>:' \
-i source4/dsdb/samdb/ldb_modules/password_hash.c"
system "sed -i 's,/etc/xml/catalog,#{@xml_catalog_files},g' docs-xml/Makefile"
system "sed -i 's,file:///etc/xml/catalog,#{@xml_catalog_files},g' buildtools/wafsamba/wafsamba.py"
end
def self.prebuild
@python_deps.each do |item|
system "pip install --upgrade #{item}"
end
end
def self.build
system './configure --help'
system "env CFLAGS='-pipe -flto=auto -fuse-ld=gold' \
CXXFLAGS='-pipe -flto=auto -fuse-ld=gold' \
LDFLAGS='-flto=auto' \
./configure --enable-fhs \
#{CREW_OPTIONS.sub(/--program-suffix.*/, '')} \
--sysconfdir=#{CREW_PREFIX}/etc \
--sbindir=#{CREW_PREFIX}/bin \
--libdir=#{CREW_LIB_PREFIX} \
--libexecdir=#{CREW_LIB_PREFIX}/samba \
--localstatedir=#{CREW_PREFIX}/var \
--with-configdir=#{CREW_PREFIX}/etc/samba \
--with-lockdir=#{CREW_PREFIX}/var/cache/samba \
--builtin-libraries=NONE \
--bundled-libraries=!tdb,!talloc,!pytalloc-util,!tevent,!popt,!ldb,!pyldb-util,NONE \
--disable-rpath \
--disable-rpath-install \
--with-acl-support \
--with-ads \
--with-ldap \
--with-pam \
--with-pammodulesdir=#{CREW_LIB_PREFIX}/security \
--with-piddir=/run \
--with-profiling-data \
--with-shared-modules=#{@samba4_idmap_modules},#{@samba4_pdb_modules},#{@samba4_auth_modules},vfs_io_uring \
--with-sockets-dir=/run/samba \
--without-ad-dc \
--with-winbind \
--without-systemd"
system 'make'
# We only need some files from the build, so just install into a
# staging directory during build.
FileUtils.mkdir_p 'staging'
system 'make V=1 DESTDIR=staging install'
FileUtils.cp 'source3/script/smbtar', "staging/#{CREW_PREFIX}/bin/"
@python_deps.each do |item|
system "pip uninstall --yes #{item}"
end
end
def self.install
@dest_dirs = ["#{CREW_DEST_PREFIX}/bin", "#{CREW_DEST_LIB_PREFIX}/samba",
"#{CREW_DEST_LIB_PREFIX}/pkgconfig", "#{CREW_DEST_MAN_PREFIX}/man1",
"#{CREW_DEST_MAN_PREFIX}/man7", "#{CREW_DEST_MAN_PREFIX}/man8",
"#{CREW_DEST_PREFIX}/include/samba-4.0", "#{CREW_DEST_LIB_PREFIX}/cups/backend",
"#{CREW_DEST_PREFIX}/etc/samba"]
@dest_dirs.each do |dir|
FileUtils.mkdir_p dir
end
@smbclient_bins.each do |item|
FileUtils.install "staging#{CREW_PREFIX}/bin/#{item}", "#{CREW_DEST_PREFIX}/bin/#{item}",
mode: 0o755
end
FileUtils.mv Dir.glob("staging#{CREW_LIB_PREFIX}/lib*.so*"), "#{CREW_DEST_LIB_PREFIX}/"
FileUtils.mv Dir.glob("staging#{CREW_LIB_PREFIX}/samba/lib*.so*"), "#{CREW_DEST_LIB_PREFIX}/samba/"
@smbclient_pkgconfig.each do |item|
FileUtils.mv Dir.glob("staging#{CREW_LIB_PREFIX}/pkgconfig/#{item}.pc"), "#{CREW_DEST_LIB_PREFIX}/pkgconfig/"
end
@smbclient_bins.each do |item|
if File.exist?("staging#{CREW_MAN_PREFIX}/man1/#{item}.1")
FileUtils.mv "staging#{CREW_MAN_PREFIX}/man1/#{item}.1",
"#{CREW_DEST_MAN_PREFIX}/man1/#{item}.1"
end
if File.exist?("staging#{CREW_MAN_PREFIX}/man8/#{item}.8")
FileUtils.mv "staging#{CREW_MAN_PREFIX}/man8/#{item}.8",
"#{CREW_DEST_MAN_PREFIX}/man8/#{item}.8"
end
end
FileUtils.mv "staging#{CREW_MAN_PREFIX}/man7/libsmbclient.7",
"#{CREW_DEST_MAN_PREFIX}/man7/libsmbclient.7"
FileUtils.mv "staging#{CREW_PREFIX}/include/samba-4.0/libsmbclient.h",
"#{CREW_DEST_PREFIX}/include/samba-4.0/"
FileUtils.mv "staging#{CREW_PREFIX}/include/samba-4.0/netapi.h",
"#{CREW_DEST_PREFIX}/include/samba-4.0/"
FileUtils.mv "staging#{CREW_PREFIX}/include/samba-4.0/wbclient.h",
"#{CREW_DEST_PREFIX}/include/samba-4.0/"
FileUtils.ln_s "#{CREW_PREFIX}/bin/smbspool", "#{CREW_DEST_LIB_PREFIX}/cups/backend/smb"
FileUtils.touch "#{CREW_DEST_PREFIX}/etc/samba/smb.conf"
end
end