Project := samba/source
UserType := Administration
ToolType := Services
GnuNoPatch ?= NO
GnuNoChown ?= YES
GnoNoStrip ?= NO
GnuAfterInstall := install-directories \
install-startup-items \
install-tools \
install-config \
install-application-bundle \
install-testtools \
install-plugins \
install-strip
CommonNoInstallSource := YES
ifeq ($(GnuNoStrip),YES)
STRIP_X := true
else
STRIP_X := strip -x
endif
Environment += \
CONFIG_SITE=$(SRCROOT)/config.site.leopard \
EXTRA_BIN_PROGS='bin/smbget$$(EXEEXT)' \
EXTRA_ALL_TARGETS='bin/smbtorture$$(EXEEXT) \
bin/msgtest$$(EXEEXT) bin/masktest$$(EXEEXT) \
bin/locktest$$(EXEEXT) bin/locktest2$$(EXEEXT) \
bin/vfstest$$(EXEEXT)'
build::
@echo building from `pwd`
$(_v) $(MKDIR) $(OBJROOT)/tools/prefsync
( cd tools/prefsync && $(MAKE) \
SRCROOT=$(SRCROOT)/tools/prefsync \
OBJROOT=$(OBJROOT)/tools/prefsync \
SYMROOT=$(SYMROOT) build )
build:: MAKEFLAGS += -j $(NPROCS)
build:: configure
ifneq ($(GnuNoBuild),YES)
$(_v) for arch in $(RC_ARCHS) ; do \
echo "Building $(Project) headers for $$arch..." ;\
cd $(BuildDirectory)/$$arch && \
$(MAKE) $(Environment) proto && \
$(MAKE) $(Environment) pch && \
$(MAKE) $(Environment) SHOWFLAGS || exit 1; \
done
endif
quick:
./scripts/run-samba.sh QUICKLOOKS 2>&1 | tee quick.log
include GNUSource.make
include make.common
ifneq "$(RC_RELEASE)" "Darwin"
LDFLAGS += -framework ByteRangeLocking
endif
Install_Target := install
install_source:: rsync_source patch autogen
rsync_source:
@echo Installing source for $(Project) using rsync ...
$(_v) $(MKDIR) $(SRCROOT)
$(_v) rsync --archive --cvs-exclude . $(SRCROOT)
ifeq ($(GnuNoPatch), YES)
patch:
@echo skipping patch application phase
else
patch:
@./scripts/apply-patches.sh
endif
autogen:
cd $(Sources) && ./autogen.sh
norejects:
@echo removing patch rejects
@find . -name \*.rej | xargs rm -f
LAUNCH_DAEMONS := $(DSTROOT)/System/Library/LaunchDaemons
SYSTEM_CONFIGURATION := $(DSTROOT)/Library/Preferences/SystemConfiguration
OPENSOURCE_VERSIONS := $(DSTROOT)/usr/local/OpenSourceVersions
DIRECTORY_PREFERENCES := $(DSTROOT)/Library/Preferences/DirectoryService
install-directories:
$(INSTALL) -d -m 755 $(LAUNCH_DAEMONS)
$(INSTALL) -d -m 755 $(OPENSOURCE_VERSIONS)
$(INSTALL) -d -m 755 $(SYSTEM_CONFIGURATION)
$(INSTALL) -d -m 755 $(DSTROOT)$(SMB_CONFDIR)
$(INSTALL) -d -m 755 $(DSTROOT)$(ETCDIR)/pam.d
$(INSTALL) -d -m 755 $(DSTROOT)$(SMB_LOGDIR)
$(INSTALL) -d -m 755 $(DSTROOT)$(SMB_LIBEXEC)
$(INSTALL) -d -m 755 $(DSTROOT)$(SMB_LOCKDIR)/shares
$(INSTALL) -d -m 755 -o root -g admin \
$(DIRECTORY_PREFERENCES)
$(INSTALL) -d -m 700 -o root -g wheel \
$(DSTROOT)$(SMB_LOCKDIR)/winbindd_privileged
$(INSTALL) -d -m 755 -o root -g wheel \
$(DSTROOT)$(SMB_LOCKDIR)/winbindd_public
install-startup-items:
$(INSTALL) -c -m 644 -o root -g wheel \
$(SRCROOT)/org.samba.smbd.plist \
$(LAUNCH_DAEMONS)/smbd.plist
$(INSTALL) -c -m 644 -o root -g wheel \
$(SRCROOT)/org.samba.nmbd.plist \
$(LAUNCH_DAEMONS)/nmbd.plist
$(INSTALL) -c -m 644 -o root -g wheel \
$(SRCROOT)/org.samba.winbindd.plist \
$(LAUNCH_DAEMONS)
$(INSTALL) -c -m 444 -o root -g wheel \
$(SRCROOT)/tools/com.apple.smb.server.preferences.plist \
$(LAUNCH_DAEMONS)
CORE_SERVICES := $(DSTROOT)$(NSLIBRARYDIR)/CoreServices
SMB_BUNDLE := SmbFileServer.bundle
install-application-bundle:
$(INSTALL) -d -m 755 $(CORE_SERVICES)
INSTALL="$(INSTALL)" $(SRCROOT)/scripts/create-bundle.sh \
$(SMB_BUNDLE) $(CORE_SERVICES)
$(INSTALL) -c -m 644 $(SRCROOT)/config/DesktopDefaults.plist \
$(CORE_SERVICES)/$(SMB_BUNDLE)/Resources
$(INSTALL) -c -m 644 $(SRCROOT)/config/ServerDefaults.plist \
$(CORE_SERVICES)/$(SMB_BUNDLE)/Resources
install-config:
$(INSTALL) -c -m 644 -o root -g wheel \
$(SRCROOT)/config/smb.conf.template $(DSTROOT)$(SMB_CONFDIR)
$(INSTALL) -b -c -m 644 -o root -g wheel \
$(SRCROOT)/config/smb.conf.template \
$(DSTROOT)$(SMB_CONFDIR)/smb.conf
$(INSTALL) -b -c -m 644 -o root -g wheel \
$(SRCROOT)/config/samba.pam \
$(DSTROOT)/$(ETCDIR)/pam.d/samba
$(INSTALL) -c -m 644 -o root -g wheel \
$(SRCROOT)/samba.plist $(OPENSOURCE_VERSIONS)
install-tools:
( cd tools/prefsync && $(MAKE) \
SRCROOT=$(SRCROOT)/tools/prefsync \
OBJROOT=$(OBJROOT)/tools/prefsync \
SYMROOT=$(SYMROOT) \
DSTROOT=$(DSTROOT) \
install )
$(INSTALL) -c -m 755 -o root -g wheel \
$(SRCROOT)/tools/synchronize-shares \
$(DSTROOT)$(SMB_LIBEXEC)
$(INSTALL) -c -m 755 -o root -g wheel \
$(SRCROOT)/tools/migrate-preferences \
$(DSTROOT)$(SMB_LIBEXEC)
$(INSTALL) -c -m 755 -o root -g wheel \
$(SRCROOT)/tools/smb-conf-upgrade \
$(DSTROOT)$(SMB_LIBEXEC)
NOSHIP_MANPAGES := \
man8/smbmnt.8 \
man8/smbmount.8 \
man8/smbumount.8 \
man8/mount.cifs.8 \
man8/umount.cifs.8 \
man8/swat.8 \
man1/log2pcap.1 \
man1/vfstest.1 \
man7/libsmbclient.7
install-strip:
( \
cd $(DSTROOT); \
find . -type f | while read f ; do \
$(MKDIR) $(SYMROOT)/`dirname "$$f"` ; \
cp "$$f" "$(SYMROOT)/$$f" ; \
if [ -x "$$f" ] ; then \
dsymutil "$(SYMROOT)/$$f" || true ; \
$(STRIP_X) "$$f" || true ; \
fi ; \
case "$$f" in *.dylib) \
dsymutil "$(SYMROOT)/$$f" || true ; \
$(STRIP_X) "$$f" || true ; \
;; \
esac \
done ; \
)
rmdir $(DSTROOT)$(SMB_PIDDIR) || true
rm -f $(patsubst %,$(DSTROOT)$(SMB_MANDIR)/%,$(NOSHIP_MANPAGES))
( cd $(DSTROOT)$(SMB_PAMDIR) && mv pam_winbind.dylib pam_winbind.so)
find $(DSTROOT) -name \*.old | xargs rm
rmdir $(DSTROOT)/usr/var
rm -rf $(DSTROOT)/usr/include
RC_OBJROOTS := $(addprefix $(OBJROOT)/, $(RC_ARCHS))
TESTTOOLS := smbtorture masktest vfstest msgtest locktest locktest2
install-testtools:
ifneq ($(GnuNoInstall),YES)
$(_v) $(INSTALL) -d -m 755 $(DSTROOT)/usr/local/bin ; \
$(_v) for tool in $(TESTTOOLS) ; do \
$(_v) lipo -create -output $(DSTROOT)/usr/local/bin/$$tool \
$(addsuffix /bin/$$tool, $(RC_OBJROOTS)) && \
$(CHOWN) root:wheel $(DSTROOT)/usr/local/bin/$$tool && \
$(CHMOD) 555 $(DSTROOT)/usr/local/bin/$$tool || exit 1; \
done
endif
install-plugins: auth-opendirectory pdb-opendirectory
auth-opendirectory:
@echo "installing $@";
(cd $(DSTROOT)$(SMB_LIBDIR)/auth && \
ln -s odsam.dylib opendirectory.dylib)
pdb-opendirectory:
@echo "installing $@";
(cd $(DSTROOT)$(SMB_LIBDIR)/pdb && \
ln -s odsam.dylib opendirectorysam.dylib)