$(call PKG_INIT_BIN, 3.4.3)
$(PKG)_SOURCE:=$(pkg)-$($(PKG)_VERSION).tar.gz
$(PKG)_SITE:=http://samba.org/samba/ftp/stable
$(PKG)_DIR:=$(SOURCE_DIR)/$(pkg)-$($(PKG)_VERSION)/source3
$(PKG)_SMBP_BINARY:=$($(PKG)_DIR)/bin/smbpasswd
$(PKG)_SMBP_TARGET_BINARY:=$($(PKG)_DEST_DIR)/sbin/smbpasswd
$(PKG)_SMBD_BINARY:=$($(PKG)_DIR)/bin/smbd
$(PKG)_SMBD_TARGET_BINARY:=$($(PKG)_DEST_DIR)/sbin/smbd
$(PKG)_NMBD_BINARY:=$($(PKG)_DIR)/bin/nmbd
$(PKG)_NMBD_TARGET_BINARY:=$($(PKG)_DEST_DIR)/sbin/nmbd
$(PKG)_STARTLEVEL=80
#$(PKG)_CONFIG_SUBOPTS += FREETZ_PACKAGE_NMBD
#$(PKG)_CONFIGURE_PRE_CMDS *= cd source 3;
$(PKG)_CONFIGURE_ENV += samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
$(PKG)_CONFIGURE_ENV += ac_cv_func_prctl=no
$(PKG)_CONFIGURE_ENV += libreplace_cv_HAVE_IPV6=no
#$(PKG)_CONFIGURE_ENV += CC="$(TARGET_CC)"
#$(PKG)_CONFIGURE_ENV += LDFLAGS="$(if $(FREETZ_$(PKG)_STATIC),-static)"
$(PKG)_CONFIGURE_OPTIONS += --disable-swat
$(PKG)_CONFIGURE_OPTIONS += --disable-cups
$(PKG)_CONFIGURE_OPTIONS += --disable-iprint
$(PKG)_CONFIGURE_OPTIONS += --disable-pie
$(PKG)_CONFIGURE_OPTIONS += --disable-relro
$(PKG)_CONFIGURE_OPTIONS += --disable-fam
$(PKG)_CONFIGURE_OPTIONS += --disable-avahi
$(PKG)_CONFIGURE_OPTIONS += --without-ldap
$(PKG)_CONFIGURE_OPTIONS += --without-ads
$(PKG)_CONFIGURE_OPTIONS += --without-cifsmount
$(PKG)_CONFIGURE_OPTIONS += --without-cifsupcall
$(PKG)_CONFIGURE_OPTIONS += --without-sys-quotas
$(PKG)_CONFIGURE_OPTIONS += --without-utmp
#$(PKG)_CONFIGURE_OPTIONS += --without-libtalloc
#$(PKG)_CONFIGURE_OPTIONS += --without-libtdb
#$(PKG)_CONFIGURE_OPTIONS += --without-libnetapi
#$(PKG)_CONFIGURE_OPTIONS += --without-libsmbclient
$(PKG)_CONFIGURE_OPTIONS += --without-libsmbsharemodes
$(PKG)_CONFIGURE_OPTIONS += --without-cluster-support
$(PKG)_CONFIGURE_OPTIONS += --without-acl-support
$(PKG)_CONFIGURE_OPTIONS += --without-sendfile-support
$(PKG)_CONFIGURE_OPTIONS += --without-wbclient
$(PKG)_CONFIGURE_OPTIONS += --without-winbind
$(PKG_SOURCE_DOWNLOAD)
$(PKG_UNPACKED)
$(PKG_CONFIGURED_CONFIGURE)
$($(PKG)_SMBP_BINARY) $($(PKG)_SMBD_BINARY) $($(PKG)_NMBD_BINARY): $($(PKG)_DIR)/.configured
PATH="$(TARGET_PATH)" \
$(MAKE) -C $(SAMBA_DIR) \
CODEPAGEDIR="/mod/usr/share/samba"
$($(PKG)_SMBP_TARGET_BINARY): $($(PKG)_SMBP_BINARY)
$(INSTALL_BINARY_STRIP)
$($(PKG)_SMBD_TARGET_BINARY): $($(PKG)_SMBD_BINARY)
$(INSTALL_BINARY_STRIP)
$($(PKG)_NMBD_TARGET_BINARY): $($(PKG)_NMBD_BINARY)
$(INSTALL_BINARY_STRIP)
$($(PKG)_LIB_STAGING_BINARY): $($(PKG)_LIB_BINARY)
cp -a $(SAMBA_DIR)/bin/libtalloc.so* $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib
cp -a $(SAMBA_DIR)/bin/libtdb.so* $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib
cp -a $(SAMBA_DIR)/bin/libwbclient.so* $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib
$($(PKG)_LIB_TARGET_BINARY): $($(PKG)_LIB_STAGING_BINARY)
cp -a $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libtalloc.so* $(SAMBA_DEST_DIR)/usr/lib
cp -a $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libtdb.so* $(SAMBA_DEST_DIR)/usr/lib
cp -a $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libwbclient.so* $(SAMBA_DEST_DIR)/usr/lib
$(TARGET_STRIP) $@
$(pkg):
ifeq ($(strip $(FREETZ_PACKAGE_NMBD)),y)
$(pkg)-precompiled: $($(PKG)_SMBP_TARGET_BINARY) $($(PKG)_SMBD_TARGET_BINARY) $($(PKG)_NMBD_TARGET_BINARY)
else
$(pkg)-precompiled: $($(PKG)_SMBP_TARGET_BINARY) $($(PKG)_SMBD_TARGET_BINARY) $(pkg)-clean-nmbd
endif
$(pkg)-clean-nmbd:
$(RM) $(SAMBA_NMBD_TARGET_BINARY)
$(pkg)-clean:
-$(MAKE) -C $($(PKG)_DIR) clean
$(RM) -r $($(PKG)_DIR)/bin
$(pkg)-uninstall:
$(RM) $(SAMBA_SMBP_TARGET_BINARY) \
$(SAMBA_SMBD_TARGET_BINARY) \
$(SAMBA_NMBD_TARGET_BINARY)
$(PKG_FINISH)