usr/src/cmd/samba/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 195 7a28aa6136c4
permissions -rw-r--r--
Bash patch catchup including shellshock

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
#ident	"@(#)Makefile.sfw	1.39	10/08/10 SMI"
#

include ../Makefile.cmd

VER =		$(COMPONENT_NAME:sh)-$(COMPONENT_VERSION:sh)
VER64 =		$(VER)-64
SAMBA30VER =	samba-3.0.37
TARBALL =	$(VER).tar.gz
PATCHES:sh =	echo Patches/*.diff

DESTDIR=$(ROOT)

AS =	/usr/sfw/bin/gas

# There are no 64 bits "avahi" libs
LIBS   = -lrt -lsendfile -lsocket -lnsl
LIBS32 = $(LIBS) -lavahi-common -lavahi-core
LIBS64 = $(LIBS)

CPPFLAGS += -I/usr/include/kerberosv5
CPPFLAGS += -I$(ROOTINCLUDE)/ldap6
CPPFLAGS += -I$(COMPONENT_TOP)/Solaris

LDFLAGS32 = -L$(ROOTLIB) -R/usr/lib
LDFLAGS32 += -R/usr/lib/samba
LDFLAGS32 += $(LIBS32)

LDFLAGS64 = -L$(ROOTLIB64) -R/usr/lib/$(MACH64)
LDFLAGS64 += -R/usr/lib/samba/$(MACH64)
LDFLAGS64 += $(LIBS64)

LDFLAGS += -L$(COMPONENT_TOP)
LDFLAGS += -M $(SRC)/cmd/mapfile_noexstk

#       configure(1) options to use
# default:	--prefix=/usr
#		--mandir=/usr/share/man
# are set in Makefile.master
# use the targets "SHOWFLAGS" and "showlayout" to check
# after the configure
CONFIGURE32_OPTIONS +=	--libdir=/usr/lib/samba
CONFIGURE64_OPTIONS +=	--libdir=/usr/lib/samba/64
CONFIGURE_OPTIONS +=	--includedir=/usr/include/samba
CONFIGURE_OPTIONS +=	--sysconfdir=/etc/samba
CONFIGURE_OPTIONS +=	--with-configdir=/etc/samba
CONFIGURE_OPTIONS +=	--with-privatedir=/etc/samba/private
CONFIGURE_OPTIONS +=	--with-swatdir=/usr/share/samba/swat
CONFIGURE_OPTIONS +=	--localstatedir=/var/samba
CONFIGURE_OPTIONS +=	--with-lockdir=/var/samba/locks
CONFIGURE_OPTIONS +=	--with-piddir=/var/samba/locks
CONFIGURE_OPTIONS +=	--with-logfilebase=/var/samba/log
CONFIGURE_OPTIONS +=	--enable-shared=yes
CONFIGURE_OPTIONS +=	--enable-static=no
CONFIGURE_OPTIONS +=	--with-shared-modules=vfs_zfsacl,vfs_samfs,vfs_prealloc,vfs_cacheprime,vfs_commit,idmap_ldap,idmap_tdb2,idmap_rid,idmap_ad,idmap_hash,idmap_adex
CONFIGURE_OPTIONS +=	--with-readline
CONFIGURE_OPTIONS +=	--with-aio-support
CONFIGURE_OPTIONS +=	--with-acl-support
CONFIGURE_OPTIONS +=	--with-ads
CONFIGURE_OPTIONS +=	--with-ldap
CONFIGURE_OPTIONS +=	--with-automount
CONFIGURE_OPTIONS +=	--with-dnsupdate
CONFIGURE_OPTIONS +=	--with-pam
CONFIGURE_OPTIONS +=	--with-winbind

#####################################################
# in case of using the $(CCSMAKE) samba configure
# generates the Makefile.in -> Makefile-noincludes.in
# than it generated the Makefile-noincludes so the
#   $(CCSMAKE) -f Makefile-noincludes ...
# command should be used in such case
TARGET_ENV +=	"MAKE=$(GMAKE)"

TARGET_ENV +=	"PERL=$(PERL)"
TARGET_ENV +=	"PATH=$(SFW_PATH)"
TARGET_ENV +=	"CUPS_CONFIG=$(ROOTBIN)/cups-config"
TARGET_ENV +=	"INSTALLCMD=$(GINSTALL)"
TARGET_ENV +=	"CPPFLAGS=$(CPPFLAGS)"
TARGET_ENV +=	"LDAP_LIBS=-lldap60"
TARGET_ENV +=	"INSTALL=$(INSTALL_PROTO)"
TARGET_ENV +=	"SAMFS_LIBS=-R/opt/SUNWsamfs/lib -lsam"

TARGET32_ENV +=	"CC=$(CC)"
TARGET32_ENV +=	"CFLAGS=$(CFLAGS)"
TARGET32_ENV +=	"LDFLAGS=$(LDFLAGS32) $(LDFLAGS)"
TARGET32_ENV +=	"LIBS=$(LIBS32)"
TARGET32_ENV += $(TARGET_ENV)

TARGET64_ENV +=	"CC=$(CC64)"
TARGET64_ENV +=	"CFLAGS=$(CFLAGS64)"
TARGET64_ENV +=	"LDFLAGS=$(LDFLAGS64) $(LDFLAGS)"
TARGET64_ENV +=	"LIBS=$(LIBS64)"
TARGET64_ENV += $(TARGET_ENV)

build:=		TARGET = showlayout everything
build64:=	TARGET = ../nsswitch/libnss_winbind.so wins pam_winbind
install:=	TARGET = install

prebuild:
	env
	-touch .built

all: prebuild build build64 docs-xml build30libsmbclient

#####################################################
#
# 32 bit version
#
#####################################################
build $(VER)/source3/bin/smbd: $(VER)/source3/config.status
	(cd $(VER)/source3 ; env - $(GMAKE) $(TARGET))
	# Cripple man installation, since we want to install it by our way
	echo exit > $(VER)/source3/script/installman.sh

$(VER)/source3/config.status: libsam.so $(VER)/source3/configure
	(cd $(VER)/source3/ ; env - $(TARGET32_ENV) ./configure $(CONFIGURE32_OPTIONS) $(CONFIGURE_OPTIONS))

$(VER)/source3/configure: $(VER)/.patched
	(cd $(VER)/source3/ ; $(SH) autogen.sh )


#####################################################
#
# 64 bit version
#
#####################################################
build64 $(VER64)/source3/bin/smbd: $(VER64)/source3/config.status
	(cd $(VER64)/source3 ; env - $(GMAKE) $(TARGET))

$(VER64)/source3/config.status: $(VER64)/source3/configure
	(cd $(VER64)/source3/ ; env - $(TARGET64_ENV) ./configure $(CONFIGURE64_OPTIONS) $(CONFIGURE_OPTIONS))

$(VER64)/source3/configure: $(VER64)/.patched
	(cd $(VER64)/source3/ ; $(SH) autogen.sh )


#####################################################
#
# libsmbclient
#
#####################################################
build30libsmbclient $(SAMBA30VER)/source/bin/libsmbclient.so: $(SAMBA30VER)/source/config.status
	(cd $(SAMBA30VER)/source; mkdir -p bin; env - $(GMAKE) libsmbclient )

$(SAMBA30VER)/source/config.status: $(SAMBA30VER)/source/configure
	(cd $(SAMBA30VER)/source; env - \
	    "PATH=$(SFW_PATH)" \
	    "CC=$(CC)" "MAKE=$(MAKE)" \
	    "CPPFLAGS=-I$(ROOTINCLUDE)/ldap6 $(CPPFLAGS)" \
	    "LDFLAGS=-L$(ROOTLIB) -M $(SRC)/cmd/mapfile_noexstk" \
	    "LIBS=-lrt -lsocket -lnsl" \
	    "LDAP_LIBS=-lldap60" \
	    "CUPS_CONFIG=$(ROOTBIN)/cups-config" \
	    ./configure --prefix=/usr/sfw \
		--with-configdir=/etc/sfw \
		--with-privatedir=/etc/sfw/private \
		--with-lockdir=/var/samba/locks \
		--with-piddir=/var/samba/locks \
		--with-logfilebase=/var/samba/log \
		--without-readline \
		--enable-shared=yes \
		--enable-static=no \
		--with-static-modules= \
		--with-shared-modules=vfs_zfsacl,idmap_rid,idmap_ad,idmap_ldap \
		--with-acl-support \
		--with-ldap \
		--with-krb5 \
		--with-ads \
		--with-pam \
		--with-automount \
		--with-libsmbclient \
		--with-sys-quotas=no \
		--with-acl-support \
		--with-aio-support \
		--with-samfs-support=yes \
		--with-winbind)

$(SAMBA30VER)/source/configure: $(SAMBA30VER)/source/configure.in
	(cd $(SAMBA30VER)/source ; ./autogen.sh )

$(SAMBA30VER)/source/configure.in: $(SAMBA30VER).tar.gz
	gzip -dc $(SAMBA30VER).tar.gz | gtar xopf -
	find $(SAMBA30VER) -type d | xargs chmod 755
	(cd $(SAMBA30VER) ; gpatch -p1 < ../Solaris/configure.in-diff )
	(cd $(SAMBA30VER) ; gpatch -p1 < ../samba-3.0.37-CVE-2010-2063.patch )
	(cd $(SAMBA30VER) ; gpatch -p1 < ../login_cache-diff )


#####################################################
#
# documentation
#
#####################################################
docs-xml $(VER)/docs-xml/catalog.xml: $(VER)/source3/config.status
	(cd $(VER) ; gzip -dc ../Solaris/docs-xml-built.tar.gz | tar xf - )

#####################################################
#
# libsam
#
#####################################################
libsam.so: Solaris/libsam.c
	cd Solaris; $(CC) -G -Kpic -hlibsam.so libsam.c -o ../libsam.so


#####################################################
#
# install
#
#####################################################
install: install-protofix
	(cd $(ROOT); find usr/bin usr/sbin usr/lib/samba -name '*.old' -exec rm -f {} \; )

install-target: all
	(cd $(VER)/source3/ ; env - INSTALLCMD=$(GINSTALL) $(GMAKE) DESTDIR=$(DESTDIR) $(TARGET))
	VER=$(VER) VER64=$(VER64) VER30=$(SAMBA30VER) MACH64=$(MACH64) $(SH) ./install-sfw

install-protofix: install-target
	for pkg in $(COMPONENT_PACKAGES:sh) ; do \
		$(SRC)/tools/protofix --pkg $$pkg --perm ; \
	done
	

#####################################################
#
# clean
#
#####################################################
clean:
	-rm -rf $(VER) $(VER64) $(SAMBA30VER) prototmp libsam.so .built

include ../Makefile.targ