wongsyrone / openwrt-addpack

Additional packages for OpenWRT, mainly NAS devices
0 stars 0 forks source link

samba4 upgrade #1

Closed wongsyrone closed 8 years ago

wongsyrone commented 9 years ago

需要精简部分用不到的代码,调整配置开关和编译选项,研究samba4的waf和op的编译机制以及自己的重要变量 https://vivekian2.wordpress.com/2007/03/28/building-your-own-package-for-openwrt/ http://wiki.openwrt.org/doc/devel/packages http://wiki.openwrt.org/doc/devel/dependencies

wongsyrone commented 9 years ago

对4.2系列,使用op toolchain,使用部分预定义的op参数传进samba的waf里面 看样子只能使用cross-compile开关结合应答文件了,应答文件应该是不同架构不同,所以不具备通用性 对4.0系列由于没有删掉configure的东西,可以修改configure flag和make flag,使用通用的op package Makefile模板 为op写waf的wrapper,使用新wrapper传进必要开关和参数

wongsyrone commented 9 years ago

waf 1.5.x不支持python3,必须 export PYTHON=python2 http://www.linuxfromscratch.org/blfs/view/svn/basicnet/samba.html https://wiki.gentoo.org/wiki/Samba/Guide https://wiki.gentoo.org/wiki/Samba http://buildroot.uclibc.org/downloads/manual/manual.chunked/ch06.html 两个示例,看样子要使用cross compile应答文件了 http://git.buildroot.net/buildroot/tree/package/samba4 https://github.com/maximeh/buildroot/tree/master/package/samba4 ((oilder than 1st one http://git.buildroot.net/buildroot/commit/?id=dee1cf0cdf9db351fd94ccd864e09b3f1ec122f9 http://lists.busybox.net/pipermail/buildroot/2014-March/091107.html

wongsyrone commented 9 years ago

https://wiki.samba.org/index.php/Waf

Using waf to build Samba

As of March 2010, the waf build of Samba4 is now complete. We also have waf build rules for libreplace, talloc, tdb, tevent, ldb and Samba4. Kai is working on the waf build for Samba3. Main features: rpath is used so the binaries can be run directly building and configuring is fast full dependencies are checked, so much less need for make clean wrappers are provided for ./configure and make builds are much smaller (around 110M versus 1.1G for the old Samba4 build) project rules are checked to ensure no object duplication supports creation of working tarballs for our standalone libraries builds on more build-farm hosts than the existing build system much cleaner build rules (in wscript files). Should be easy to learn

wongsyrone commented 9 years ago

Other commands

Try "waf --help" for help on using waf. Try "waf configure --help" for the equivalent of "./configure --help". I haven't added all of our Samba configuration options yet, but I've put in the most commonly used ones (such as --enable-developer). You may also find "waf -v" useful for seeing the build commands. Or use "waf -v clean build" to clean and build a tree, with the commands shown. Use "waf -p" to show a progress bar on the build.

wongsyrone commented 9 years ago
cd samba-4.0.3 
./configure \ 
    --enable-debug \ 
    --enable-selftest \ 
    --disable-cups \ 
    --disable-gnutls \ 
    --enable-fhs \ 
    --prefix=/usr/local \ 
    --sysconfdir=/etc \ 
    --localstatedir=/var \ 
    --datarootdir=/usr/share \ 
    --with-privatedir=/etc/samba/private 
#   --with-aio-support 
make && make install 
wongsyrone commented 9 years ago
./configure  --prefix=/usr/local/samba
         --build=i686-linux 
         --host=mipsel-linux 
         --target=mipsel-linux \
         --includedir=/Cross/target/local/mipsel-linux/include \
         --oldincludedir=/Cross/target/local/mipsel-linux/include \
         --disable-largefile    \
         --enable-swat=no \
         --enable-cups=no \
         --enable-iprint=no \
         --enable-pie=no \
         --enable-fam=no \
         --enable-static=yes \
         --enable-shared-libs=no \
         --enable-dnssd=no \
         --with-ldap=no \
         --with-ads=no \
         --with-cifsmount=no \
         --with-utmp=no \
         --with-libtalloc=no \
         --with-libtdb=no \
         --with-libnetapi=no \
         --with-libaddns=no \
         --with-libsmbclient=no \
         --with-libsmbsharemodes=no \
         --with-acl-support=no \
         --with-sendfile-support=no \
         --with-winbind=no \
         --with-static-modules=nmbd,smbd,smbclient,smbpasswd \
         --bindir=$MQARMDIR/bin \
         --sbindir=$MQARMDIR/bin \
         --localstatedir=$MQUSERDIR/samba/var \
         --libdir=$MQARMDIR/lib \
         --with-privatedir=$MQUSERDIR/samba/private \
         --with-rootsbindir=$MQARMDIR/bin \
         --with-lockdir=$MQUSERDIR/samba/var/locks \
         --with-configdir=$MQUSERDIR/samba \
         --with-logfilebase=$MQUSERDIR/samba/var \
         --with-piddir=$MQUSERDIR/samba/var \
         --cache-file=mipsel-linux.cache
wongsyrone commented 9 years ago

In this example VER is checked for greater than 4

ifeq ($(shell test $(VER) -gt 4; echo $$?),0) IFLAGS += -I$(TOPDIR)/include LIBS += -L$(TOPDIR)/libs -lpcap endif

wongsyrone commented 9 years ago
#must use python version 2 cause waf integrated in samba4 doesn't support python3 yet.
empty:=
space:= $(empty) $(empty)

PYTHON :=python
# lines above in rule.mk
python_version_full := $(wordlist 2,4,$(subst .,$(space),$(shell python2 --version 2>&1)))
python_version_major := $(word 1,${python_version_full})
python_version_minor := $(word 2,${python_version_full})
python_version_patch := $(word 3,${python_version_full})

ifeq ($(shell test $(python_version_major) -eq 3; echo $$?),0)
    python_warning := you are using python3!
    override PYTHON := python2
endif

all :
    @echo ${python_version_full}
    @echo ${python_version_major}
    @echo ${python_version_minor}
    @echo ${python_version_patch}
    @echo ${python_warning}
    @echo ${PYTHON}

.PHONY : all 
wongsyrone commented 9 years ago

configurable config switch

define Package/libsodium/config
menu "Configuration"
    depends on PACKAGE_libsodium
    config LIBSODIUM_MINIMAL
        bool "Compile only what is required for the high-level API (no aes128ctr), should be fine in most cases."
        default y
endmenu
endef

CONFIGURE_ARGS+= \
    --disable-ssp \
    $(if $(CONFIG_LIBSODIUM_MINIMAL),--enable-minimal=yes,--enable-minimal=no)
wongsyrone commented 9 years ago

deps of samba 4.2.1 in archlinux packages repo

cifs-utils
gnutls
ldb
libbsd
libcups
libgcrypt
libldap
libwbclient>=4.2.1
popt
python2
readline
talloc
tdb
tevent
acl (make)
db (make)
dbus (make)
docbook-xsl (make)
gamin (make)
gnutls>=2.4.1 (make)
krb5 (make)
ldb>=1.1.15 (make)
libbsd (make)
libcap (make)
libcups (make)
libldap (make)
pam (make)
pkg-config (make)
popt (make)
python2 (make)
readline (make)
systemd (make)
talloc (make)
tdb (make)
tevent (make)