1#
2# Apple wrapper Makefile for tnftpd
3# Copyright (c) 2008-2010 Apple Inc. All Rights Reserved.
4##
5#
6
7# General project info for use with RC/GNUsource.make makefile
8Project         = tnftpd
9ProjectName     = lukemftpd
10UserType        = Administrator
11ToolType        = Commands
12Submission      = 45
13
14# Environment is passed to BOTH configure AND make, which can cause problems if these
15# variables are intended to help configure, but not override the result.
16Environment	= MAKEOBJDIR="$(BuildDirectory)" \
17			INSTALL_ROOT="$(DSTROOT)"
18Extra_CC_Flags	= -Os -mdynamic-no-pic -Wall -Wno-deprecated-declarations
19# This allows extra variables to be passed _just_ to configure.
20Extra_Configure_Environment	= CFLAGS="$$RC_CFLAGS $(Extra_CC_Flags)" \
21					LDFLAGS="$$RC_CFLAGS $(Extra_CC_Flags)" \
22					EXTRA_LIBS="-lpam"
23
24# The configure flags are ordered to match current output of ./configure --help.
25# Extra indentation represents suboptions.
26Extra_Configure_Flags	= --prefix=$(USRDIR) --sbindir=$(LIBEXECDIR) \
27			--sysconfdir=$(ETCDIR) \
28			--enable-ipv6 --with-pam --with-gssapi
29
30# Additional project info used with AEP
31AEP		= YES
32AEP_Version	= 20100324
33AEP_LicenseFile	= $(Sources)/COPYING
34AEP_Patches	= manpages.patch \
35		PR-3795936.long-username.patch \
36		PR-3886477.ftpd.c.patch \
37		PR-4608716.ls.c.patch \
38		PR-4581099.ftpd.c.patch \
39		PR-4616924.ftpd.c.patch \
40		PR-5815072.ftpd.c.patch \
41		print.c.patch \
42		sacl.patch \
43		gss.patch \
44		PR-10519551.patch \
45		PR-10452181.conf.c.patch \
46		PR-10804931.patch
47AEP_ConfigDir	= $(ETCDIR)
48AEP_ConfigFiles	= ftpd.conf
49AEP_LaunchdConfigs	= ftp.plist
50AEP_Binaries	= $(LIBEXECDIR)/*
51GnuAfterInstall	= install-macosx archive-strip-binaries
52
53# Local targets that must be defined before including the following
54# files to get the dependency order correct
55.PHONY: $(GnuAfterInstall)
56
57# Include common makefile targets for B&I
58include $(MAKEFILEPATH)/CoreOS/ReleaseControl/GNUSource.make
59include AEP.make
60
61# Override settings from above includes
62BuildDirectory	= $(OBJROOT)/Build/$(AEP_Project)
63Install_Target	= install
64# This needs to be overridden because the project properly uses DESTDIR and
65# INSTALL_ROOT (which is included in Environment).
66Install_Flags	= DESTDIR="$(DSTROOT)"
67
68
69# Build rules
70install-macosx:
71	@echo "Cleaning up install for Mac OS X..."
72	$(MV) $(DSTROOT)$(LIBEXECDIR)/tnftpd $(DSTROOT)$(LIBEXECDIR)/ftpd
73	$(LN) $(DSTROOT)$(MANDIR)/man5/ftpusers.5 $(DSTROOT)$(MANDIR)/man5/ftpchroot.5
74	$(LN) $(DSTROOT)$(MANDIR)/man8/tnftpd.8 $(DSTROOT)$(MANDIR)/man8/ftpd.8
75	@echo "Installing PAM configuration file..."
76	$(INSTALL_DIRECTORY) $(DSTROOT)$(ETCDIR)/pam.d/
77	$(INSTALL_FILE) -m 0644 ftpd $(DSTROOT)$(ETCDIR)/pam.d/
78	@echo "Installing sample configuration files..."
79	$(INSTALL_DIRECTORY) $(DSTROOT)$(SHAREDIR)/ftpd/examples
80	$(INSTALL_FILE) -c -m 0644  $(Sources)/examples/ftpd.conf $(DSTROOT)$(SHAREDIR)/ftpd/examples
81	$(INSTALL_FILE) -c -m 0644  $(Sources)/examples/ftpusers $(DSTROOT)$(SHAREDIR)/ftpd/examples
82	$(CHOWN) -R root:wheel $(DSTROOT)/
83	@echo "Mac OS X-specific cleanup complete."
84