Makefile revision 5220
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# CDDL HEADER START
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# The contents of this file are subject to the terms of the
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Common Development and Distribution License (the "License").
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# You may not use this file except in compliance with the License.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# or http://www.opensolaris.org/os/licensing.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# See the License for the specific language governing permissions
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# and limitations under the License.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# When distributing Covered Code, include this CDDL HEADER in each
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# If applicable, add the following below this CDDL HEADER, with the
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# fields enclosed by brackets "[]" replaced with your own identifying
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# information: Portions Copyright [yyyy] [name of copyright owner]
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# CDDL HEADER END
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Samba does not work properly on i386 when built by studio with -xO3+.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# standard options
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Both SPRO_VROOT and studio_OPT vars must use the override keyword otherwise
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Userland will ignore it and use its default value.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# To use the older 12.3 compiler instead of the default 12.4 compiler uncomment
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# the following line.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi#override SPRO_VROOT = $(SPRO_ROOT)/solarisstudio12.3
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# parfait seems to spin on us
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCOMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCOMPONENT_PROJECT_URL= http://www.samba.org/
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCOMPONENT_ARCHIVE_HASH= sha256:7aeb5d09e9c84bbeeb4b98d33404e9dbc4d99c54e64a447cc9c4d57e9255cb1d
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCOMPONENT_ARCHIVE_URL= http://us1.samba.org/samba/ftp/stable/$(COMPONENT_ARCHIVE)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiWAF_PATH = PATH=$(BUILD_DIR)/samba/buildtools/bin:$(PROTO_DIR)/usr/bin:$$PATH
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Verbosed waf produces unreadable output if parallelized.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Uncomment to enable verbose build.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi#override WAFOPT1 = -v -j1
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Set build dirs for Samba + Winbind / Winbind (without Samba).
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Depends on S12-only libraries from Desktop to build.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# directory to search for "include" in samba.p5m
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Set the pkg... path to search files in ./Solaris/ dir (mainly the SMF manifests are there)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Oracle HSM is not supported on 12.0 yet but the libsam.so target should rather be commented out than removed
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# (note) change compiler bitness here when Samba became 64bits
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi#$(PROTO_DIR)/opt/SUNWsamfs/lib/$(MACH64)/libsam.so: Solaris/libsam.c
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# $(MKDIR) $(@D)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# $(CC.studio.64) -m64 -G $(studio_PIC) -hlibsam.so Solaris/libsam.c \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# -I$(COMPONENT_DIR)/Solaris/include \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Samba 4 needs extension of krb5 API, which is implemented in a Samba private
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# library libgssapi_krb5.so. Once MIT Kerberos is updated in Solaris 12 to
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# version 1.9 or higher this extension will no longer be needed
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# see Bug 18308792 for details.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(PROTO_DIR)/usr/lib/samba/libgssapi_krb5.so: Solaris/dummy.c
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(CC.studio.32) -m32 -G $(studio_PIC) -hlibgssapi_krb5.so Solaris/dummy.c \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi -M$(COMPONENT_DIR)/Solaris/gssapi_krb5-mapfile-vers \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(PROTO_DIR)/usr/lib/samba/$(MACH64)/libgssapi_krb5.so: Solaris/dummy.c
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(CC.studio.64) -m64 -G $(studio_PIC) -hlibgssapi_krb5.so Solaris/dummy.c \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi -M$(COMPONENT_DIR)/Solaris/gssapi_krb5-mapfile-vers \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(PROTO_DIR)/usr/include/gssapi/gssapi_krb5.h: Solaris/gssapi_krb5.h
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(PROTO_DIR)/usr/bin/krb5-config: Solaris/krb5-config
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi sed -e "s#_SAMBA_BUILD_PROTO_#$(PROTO_DIR)#" \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Compiler settings
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiLIBS += -lrt -lsec -lcrypt -lmd5 -lsocket -lnsl
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# More libs needed by smbd (libavahi, libgamin, ...)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiLIBS4SMBD = -lsendfile -lavahi-common -lavahi-core
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi#CPPFLAGS += -DSAMBA_VERSION_VENDOR_SUFFIX=\\\"Placeholder_for_vendor_suffix\\\"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiLDFLAGS += -R/usr/lib/samba/private$(MACHLIBDIR)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.configured: LDFLAGS += $(LIBS4SMBD)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# --enable-fhs should not be on
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --bindir=/usr/lib/samba/bin
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --sbindir=/usr/lib/samba/sbin
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --libdir=/usr/lib/samba$(MACHLIBDIR)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --with-privatelibdir=/usr/lib/samba/private$(MACHLIBDIR)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --sysconfdir=/etc/samba
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --with-pammodulesdir=/usr/lib/samba/security$(MACHLIBDIR)
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --datarootdir=/usr/lib/samba
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --mandir=/usr/share/man
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --htmldir=/usr/share/samba/swat/help
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --includedir=/usr/include/samba
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --with-privatedir=/etc/samba/private
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --localstatedir=/var/samba
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --with-logfilebase=/var/samba/log
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --sharedstatedir=/var/samba/com
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --libexecdir=/usr/lib/samba
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.configured: CONFIGURE_OPTIONS += \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi --with-shared-modules=vfs_worm,vfs_zfsacl,vfs_prealloc,vfs_cacheprime,vfs_commit,idmap_ldap,idmap_tdb2,idmap_rid,idmap_ad,idmap_hash,idmap_adex,vfs_solarisacl
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.configured: CONFIGURE_OPTIONS += \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi --with-shared-modules=idmap_ldap,idmap_tdb2,idmap_rid,idmap_ad,idmap_hash,idmap_adex
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_OPTIONS += --bundled-libraries=ALL
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi#$(BUILD_DIR_SMB)/.configured: CONFIGURE_OPTIONS += --with-samfs=$(PROTO_DIR)/opt/SUNWsamfs/lib
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += PYTHONDIR="$(PYTHON_VENDOR_PACKAGES)"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += PYTHONARCHDIR="$(PYTHON_VENDOR_PACKAGES)/samba"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += CPPFLAGS="$(CPPFLAGS) -I$(PROTO_DIR)/usr/include -I$(COMPONENT_DIR)/Solaris/include"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += LINKFLAGS="$(LD_OPTIONS) $(LDFLAGS)"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiCONFIGURE_ENV += CUPS_CONFIG=$(USRBINDIR)/cups-config
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Propagation of smb.conf with default settings.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(PROTO_DIR)/etc/samba/smb.conf-example: $(BUILD_DIR_SMB)/.built
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi sed -f $(COMPONENT_DIR)/Solaris/smbconf.sed > $@ \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Build targets for WAF:
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# (motivation) Samba started to use WAF (build system from Google) from the 3.x
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# (as a parallel build system) but Samba4 discontinued the use of auto tools
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# definitively.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# (note) .BDprep target is an additional step between .prep and .configure
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# targets. It was added because there were problems with libtool-like phase of
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# WAF when the not "prepared well". "waf distclean" on CLONEY'ed BUILD_DIR is
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Prepare build dir for Samba + Winbind.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.BDprep: $(SOURCE_DIR)/.prep $(PROTO_DIR)/usr/include/gssapi/gssapi_krb5.h \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # re-create configure dir
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # Clone SOURCE_DIR
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # clenup of clone
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) waf distclean $(WAFOPT1) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Configure of Samba + Winbind.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.configured: $(BUILD_DIR_SMB)/.BDprep $(PROTO_DIR)/usr/lib/samba/$(MACH64)/libgssapi_krb5.so
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) $(CONFIGURE_ENV) $(CONFIGURE_ENV.$(BITS)) \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi waf configure $(WAFOPT1) $(CONFIGURE_OPTIONS) $(CONFIGURE_OPTIONS.$(BITS)) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Depends on S12-only libraries from Desktop to build.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Build of Samba + Winbind.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.built: $(BUILD_DIR_SMB)/.configured
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)" waf build $(WAFOPT1) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Install of Samba + Winbind.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.installed: $(BUILD_DIR_SMB)/.built
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)" waf install $(WAFOPT1) --destdir=$(PROTO_DIR) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(PYTHON) -m compileall $(PROTO_DIR)/$(PYTHON_VENDOR_PACKAGES)/
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Prepare build dir for Winbind (without Samba) for different bitness.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.BDprep: $(SOURCE_DIR)/.prep $(PROTO_DIR)/usr/include/gssapi/gssapi_krb5.h \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # re-create configure dir
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # Clone SOURCE_DIR
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # clenup of clone
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) waf distclean $(WAFOPT1) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Configure of Winbind (without Samba) for different bitness.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.configured: $(BUILD_DIR_WINB)/.BDprep $(PROTO_DIR)/usr/lib/samba/libgssapi_krb5.so
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) $(CONFIGURE_ENV) $(CONFIGURE_ENV.$(BITS)) \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi waf configure $(WAFOPT1) $(CONFIGURE_OPTIONS) $(CONFIGURE_OPTIONS.$(BITS)) )
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Build of Winbind (without Samba) for different bitness.
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiWB_TARGETS = --targets=nss_winbind,pamsmbpass,pamwinbind
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.built: $(BUILD_DIR_WINB)/.configured
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi (cd $(@D) ; $(ENV) $(WAF_PATH) LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)" waf build $(WAFOPT1) \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Installf Winbind (without Samba) for different bitness.
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.installed: $(BUILD_DIR_WINB)/.built
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -d $(PROTO_DIR)/usr/lib/samba$(MACHLIBDIR) ; \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -m 0555 -t $(PROTO_DIR)/usr/lib/samba$(MACHLIBDIR) bin/shared/!(pam_*).so* ; \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -d $(PROTO_DIR)/usr/lib/samba/security$(MACHLIBDIR) ; \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -m 0555 -t $(PROTO_DIR)/usr/lib/samba/security$(MACHLIBDIR) bin/shared/pam_*.so* ; \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -d $(PROTO_DIR)/usr/lib/samba/private$(MACHLIBDIR) ; \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $(INSTALL) -m 0555 -t $(PROTO_DIR)/usr/lib/samba/private$(MACHLIBDIR) bin/shared/private/*.so* \
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# Set appropriate bitnesses for Samba + Winbind / Winbind (without Samba).
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_SMB)/.configured: MACHLIBDIR=/$(MACH64)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi$(BUILD_DIR_WINB)/.configured $(BUILD_DIR_WINB)/.installed: MACHLIBDIR=
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi# common targets
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchibuild: $(BUILD_DIR_SMB)/.built $(BUILD_DIR_WINB)/.built
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchiinstall: $(BUILD_DIR_SMB)/.installed $(BUILD_DIR_WINB)/.installed
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiREQUIRED_PACKAGES += library/file-monitor/gamin
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiREQUIRED_PACKAGES += library/print/cups-libs
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiREQUIRED_PACKAGES += service/security/kerberos-5
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiREQUIRED_PACKAGES += system/library/security/crypto
d14abf155341d55053c76eeec58b787a456b753bRobert MustacchiREQUIRED_PACKAGES += system/library/security/gss