1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

root/csw/mgar/pkg/postfix/trunk/Makefile

Revision 17422, 12.9 KB (checked in by bonivart, 2 months ago)

postfix/trunk: add alternatives todo

  • Property svn:keywords set to Id
Line 
1#
2#
3# !!! This package can be built in two flavors, a regular one with full
4# !!! features enabled and one with a core feature set, i.e. reduced
5# !!! dependencies (package name suffix: -simple).
6# !!! To build the simplified set, the whole build needs to run with
7# !!! BUILDTYPE=simple. Further details below. By now this needs to be
8# !!! carried out manually. Ideas to automate the process of building
9# !!! the two packages are welcome.
10#
11#
12# TODO (release-critical prefixed with !, non release-critical with *)
13# * Some files collide with CSWsendmail, the following are alternatives lines from
14#   the Sendmail package, they should be adapted to Postfix so Postfix and Sendmail
15#   can co-exist on the same system (and pass checkpkg file collision detection).
16#     ALTERNATIVES_CSWsendmail  = sendmail
17#     ALTERNATIVE_sendmail  = $(bindir)/mailq sendmail $(bindir)/mailq.sendmail 100
18#     ALTERNATIVE_sendmail += $(bindir)/newaliases newaliases $(bindir)/newaliases.sendmail
19#     ALTERNATIVE_sendmail += $(mandir)/man1/mailq.1 mailq.1 $(mandir)/man1/mailq1.1.sendmail
20#     ALTERNATIVE_sendmail += $(mandir)/man1/newaliases.1 newaliases.1 $(mandir)/man1/newaliases.1.sendmail
21#     ALTERNATIVE_sendmail += $(mandir)/man5/aliases.5 aliases.5 $(mandir)/man5/aliases.5.sendmail
22# * Ship simple default configuration (restrict mynetworks to 127.0.0.1?)
23# * alias_database points to /etc/mail/aliases, symlink
24#   /etc/opt/csw/postfix/aliases to /etc/mail/aliases?
25#
26# NICE TO KNOW
27# - 2.4.6,REV=2008.05.28 preserves modified configuration files via
28#   package-shipped CAS class csw_conf.
29#
30# $Id$
31#
32NAME = postfix
33VERSION = 2.8.9
34CATEGORIES = server
35GARTYPE = v2
36
37DESCRIPTION = A high-performance mail transport agent
38define BLURB
39  What is Postfix? It is Wietse Venema's mailer that started life as an
40  alternative to the widely-used Sendmail program.
41 
42  Postfix attempts to be fast, easy to administer, and secure, while at
43  the same time being sendmail compatible enough to not upset existing
44  users. Thus, the outside has a sendmail-ish flavor, but the inside is
45  completely different.
46endef
47
48VENDOR_URL   = http://www.postfix.org
49MASTER_SITES = ftp://ftp.porcupine.org/mirrors/postfix-release/official/
50DISTFILES    = $(NAME)-$(VERSION).tar.gz
51UFILES_REGEX = $(NAME)-(\d+(?:\.\d+)*).tar.gz
52LICENSE      = LICENSE TLS_LICENSE
53
54# Tag configuration files for handling via cswclassutils
55CONFIG_BASE  := /etc/opt/csw/postfix/
56CONFIG_FILES := access
57CONFIG_FILES += aliases
58CONFIG_FILES += canonical
59CONFIG_FILES += generic
60CONFIG_FILES += header_checks
61CONFIG_FILES += main.cf
62CONFIG_FILES += master.cf
63CONFIG_FILES += relocated
64CONFIG_FILES += transport
65CONFIG_FILES += virtual
66SAMPLECONF   := $(addprefix $(CONFIG_BASE), $(CONFIG_FILES))
67
68sysconfdir  = /etc/opt/csw
69INITSMF     = $(sysconfdir)/init.d/csw$(NAME)
70USERGROUP   = $(sysconfdir)/pkg/CSW$(NAME)/cswusergroup
71
72# For the sake of simplicity and user choice we dropped the automatic
73# replacement of the /usr/{lib,bin} sendmail binaries. Ref.
74# http://article.gmane.org/gmane.os.solaris.opencsw.maintainers/5313
75POSTMSG     = $(docdir)/$(NAME)/README.upgradefrom.24
76
77# For file permissions reference and verification purposes, postfix ships
78# /opt/csw/libexec/postfix/postfix-files which contains a list of the
79# desired settings. "postfix check" can be used to verify the permissions,
80# "postfix set-permissions" can be used to adjust them (which shouldn't
81# be necessary from a user standpoint, it's our job to ship the right perms).
82
83# Make postdrop setgid so that it can deliver to $(DEF_QUEUE_DIR)/maildrop
84PROTOTYPE_MODIFIERS = makesgid
85PROTOTYPE_FILES_makesgid = $(sbindir)/post(drop|queue)
86PROTOTYPE_GROUP_makesgid = postdrop
87PROTOTYPE_PERMS_makesgid = 2755
88PROTOTYPE_CLASS_makesgid = ugfiles
89
90# Make $(DEF_QUEUE_DIR) subdirs accessible/writable to postfix only
91PROTOTYPE_MODIFIERS += spooldir
92PROTOTYPE_FILES_spooldir = $(DEF_QUEUE_DIR)/.*
93PROTOTYPE_USER_spooldir  = postfix
94PROTOTYPE_PERMS_spooldir = 0700
95PROTOTYPE_CLASS_spooldir = ugfiles
96
97# Make $(DEF_DATA_DIR) writable by postfix (used for master.lock)
98PROTOTYPE_MODIFIERS += lockdir
99PROTOTYPE_FILES_lockdir = $(DEF_DATA_DIR)
100PROTOTYPE_USER_lockdir  = postfix
101PROTOTYPE_PERMS_lockdir = 0700
102PROTOTYPE_CLASS_lockdir = ugfiles
103
104# Make $(DEF_QUEUE_DIR)/maildrop accessible by postdrop group
105PROTOTYPE_MODIFIERS += maildrop
106PROTOTYPE_FILES_maildrop = $(DEF_QUEUE_DIR)/maildrop
107PROTOTYPE_GROUP_maildrop = postdrop
108PROTOTYPE_PERMS_maildrop = 0730
109PROTOTYPE_CLASS_maildrop = ugfiles
110
111# Make $(DEF_QUEUE_DIR)/public accessible by postdrop group, likely
112# used for IPC with other processes (public contains sockets).
113PROTOTYPE_MODIFIERS += public
114PROTOTYPE_FILES_public = $(DEF_QUEUE_DIR)/public
115PROTOTYPE_GROUP_public = postdrop
116PROTOTYPE_PERMS_public = 2710
117PROTOTYPE_CLASS_public = ugfiles
118
119# IMPORTANT! Make $(DEF_QUEUE_DIR)/pid accessible by root only
120# http://www.openwall.com/lists/oss-security/2009/09/18/6
121PROTOTYPE_MODIFIERS += pid
122PROTOTYPE_FILES_pid = $(DEF_QUEUE_DIR)/pid
123PROTOTYPE_USER_pid  = root
124PROTOTYPE_GROUP_pid = bin
125PROTOTYPE_PERMS_pid = 0755
126PROTOTYPE_CLASS_pid = ugfiles
127
128EXTRA_MERGE_EXCLUDE_FILES  = $(CONFIG_BASE)/LICENSE
129EXTRA_MERGE_EXCLUDE_FILES += $(CONFIG_BASE)/TLS_LICENSE
130EXTRA_MERGE_EXCLUDE_FILES += $(CONFIG_BASE)/makedefs.out
131
132STRIP_DIRS = $(DESTDIR)$(libexecdir)/postfix
133
134CONFIGURE_SCRIPTS = custom
135TEST_SCRIPTS      =
136INSTALL_SCRIPTS   = custom
137
138# Supporting documentation for building postfix
139# - Postfix Installation From Source Code
140#   http://www.postfix.org/INSTALL.html
141# - Guidelines for Package Builders
142#   http://www.postfix.org/PACKAGE_README.html
143
144DEF_COMMAND_DIR    = /opt/csw/sbin
145DEF_CONFIG_DIR     = $(CONFIG_BASE)
146DEF_DAEMON_DIR     = /opt/csw/libexec/postfix
147DEF_MAILQ_PATH     = /opt/csw/bin/mailq
148DEF_HTML_DIR       = /opt/csw/share/doc/postfix/html
149DEF_MANPAGE_DIR    = /opt/csw/share/man
150DEF_NEWALIAS_PATH  = /opt/csw/bin/newaliases
151DEF_QUEUE_DIR      = /var/opt/csw/spool/postfix
152DEF_DATA_DIR       = /var/opt/csw/lib/postfix
153DEF_README_DIR     = /opt/csw/share/doc/postfix/README_FILES
154
155DEFAULTS=\
156        -DDEF_MANPAGE_DIR=\"$(DEF_MANPAGE_DIR)\" \
157        -DDEF_COMMAND_DIR=\"$(DEF_COMMAND_DIR)\" \
158        -DDEF_CONFIG_DIR=\"$(DEF_CONFIG_DIR)\" \
159        -DDEF_DAEMON_DIR=\"$(DEF_DAEMON_DIR)\" \
160        -DDEF_MAILQ_PATH=\"$(DEF_MAILQ_PATH)\" \
161        -DDEF_HTML_DIR=\"$(DEF_HTML_DIR)\" \
162        -DDEF_NEWALIAS_PATH=\"$(DEF_NEWALIAS_PATH)\" \
163        -DDEF_QUEUE_DIR=\"$(DEF_QUEUE_DIR)\" \
164        -DDEF_DATA_DIR=\"$(DEF_DATA_DIR)\" \
165        -DDEF_README_DIR=\"$(DEF_README_DIR)\"
166
167# By setting BUILDTYPE=simple on the command line you can produce a
168# bare-bones postfix package without any dependencies to other CSW pkgs.
169# This is currently for on demand personal use, as Phil insists on the
170# possibility of "pkg-get -i all" and two postfix's would clash.
171# Eventually it might be nice two have a bare-bones postfix in the catalog
172# as not everyone might want to pull in all the extra deps from CSWpostfix.
173ifeq ($(BUILDTYPE),simple)
174PACKAGES = CSW$(NAME)-simple
175CATALOGNAME = $(NAME)_simple
176else
177# Make sure libraries in the default location can be found
178AUXLIBS = $(LDFLAGS)
179
180# Activate support for PCRE
181# http://www.postfix.org/PCRE_README.html
182FEATURES += -DHAS_PCRE
183AUXLIBS  += -lpcre
184BUILD_DEP_PKGS += CSWlibpcre-dev
185RUNTIME_DEP_PKGS += CSWlibpcre1
186
187# Activate support for hash and btree lookup tables
188# http://www.postfix.org/DB_README.html. !! Takeaway: Use same DB as SASL !!
189# "If you compile Postfix with a different Berkeley DB implementation,
190# then every Postfix program will dump core because either the system library,
191# the SASL library, or Postfix itself ends up using the wrong version."
192#
193FEATURES += -DHAS_DB
194INCLUDES += -I/opt/csw/bdb48/include
195AUXLIBS  += -L/opt/csw/bdb48/lib -R/opt/csw/bdb48/lib -ldb-4.8
196BUILD_DEP_PKGS += CSWbdb48devel
197RUNTIME_DEP_PKGS += CSWbdb48
198
199# Activate support for SSL/TLS
200# http://www.postfix.org/TLS_README.html
201FEATURES += -DUSE_TLS
202AUXLIBS  += -lssl -lcrypto
203BUILD_DEP_PKGS += CSWlibssl-dev
204RUNTIME_DEP_PKGS += CSWlibssl0-9-8
205
206# Activate support for Cyrus SASL (dovecot is incl. automatically)
207# http://www.postfix.org/SASL_README.html
208FEATURES += -DUSE_SASL_AUTH -DUSE_CYRUS_SASL
209INCLUDES += -I/opt/csw/include/sasl/
210AUXLIBS  += -lsasl2
211BUILD_DEP_PKGS += CSWsasl-dev
212RUNTIME_DEP_PKGS += CSWlibsasl2-2
213
214# Activate support for OpenLDAP
215# http://www.postfix.org/LDAP_README.html
216FEATURES += -DHAS_LDAP
217AUXLIBS  += -lldap -llber
218BUILD_DEP_PKGS += CSWopenldap-dev
219RUNTIME_DEP_PKGS += CSWlibldap2-4-2
220RUNTIME_DEP_PKGS += CSWliblber2-4-2
221
222# Activate support for MySQL
223# http://www.postfix.org/MYSQL_README.html
224FEATURES += -DHAS_MYSQL
225INCLUDES += -I/opt/csw/include/mysql
226AUXLIBS  += -L/opt/csw/lib -R/opt/csw/mysql5/lib/mysql
227AUXLIBS  += -lmysqlclient
228BUILD_DEP_PKGS += CSWmysql-dev
229RUNTIME_DEP_PKGS += CSWlibmysqlclient15
230
231# Activate support for PostgreSQL
232# http://www.postfix.org/PGSQL_README.html
233FEATURES += -DHAS_PGSQL
234INCLUDES += -I/opt/csw/postgresql/include/
235AUXLIBS  += -L/opt/csw/postgresql/lib/ -R/opt/csw/postgresql/lib/
236AUXLIBS  += -lpq
237BUILD_DEP_PKGS += CSWlibpq
238RUNTIME_DEP_PKGS += CSWlibpq5
239endif
240
241# Postgres package outdated, libs aren't located below /opt/csw/lib/
242CHECKPKG_OVERRIDES_CSWpostfix += bad-rpath-entry
243
244include gar/category.mk
245
246# Postfix's build system relies on CCARGS, populate it with the defaults from
247# GAR. For the bare-bones build don't leak anything located in */csw/* to the
248# build (we want to rely on as little additional CSW pkgs as possible).
249ifeq ($(BUILDTYPE),simple)
250LD_OPTIONS  =
251CCARGS      = $(CFLAGS)
252CCARGS     += $(filter-out -I/opt/csw/include,$(CPPFLAGS))
253CCARGS     += $(filter-out -I/opt/csw/%,$(INCLUDES))
254CCARGS     += -DNO_PCRE         # on by default, would trigger our pcre-config
255CCARGS     += $(DEFAULTS)
256else
257CCARGS=$(CFLAGS) $(CPPFLAGS) $(INCLUDES) $(FEATURES) $(DEFAULTS)
258endif
259
260# Postfix doesn't use autoconf, but it's own tool called makedefs. It's
261# triggered by "gmake makefiles" in the source root and expects it's options
262# via environment variables CC CCARGS AUXLIBS DEBUG OPT. For us there is no
263# need to use DEBUG and OPT. The relevant flags are (amongst others) contained
264# in GAR's CFLAGS which we already pushed into CCARGS (see above).
265configure-custom:
266        echo $(MAKE) -C $(WORKSRC) makefiles CC=$(CC) CCARGS='$(CCARGS)'
267        $(MAKE) -C $(WORKSRC) makefiles \
268                CC=$(CC) \
269                CCARGS='$(CCARGS)' \
270                AUXLIBS='$(AUXLIBS)' \
271                DEBUG= \
272                OPT=
273        @$(MAKECOOKIE)
274
275install-custom:
276        $(MAKE) -C $(WORKSRC) non-interactive-package install_root=$(DESTDIR) \
277                config_directory=$(DEF_CONFIG_DIR) \
278                daemon_directory=$(DEF_DAEMON_DIR) \
279                command_directory=$(DEF_COMMAND_DIR) \
280                queue_directory=$(DEF_QUEUE_DIR) \
281                sendmail_path=$(DEF_COMMAND_DIR)/sendmail \
282                newaliases_path=$(DEF_NEWALIAS_PATH) \
283                mailq_path=$(DEF_MAILQ_PATH) \
284                manpage_directory=$(DEF_MANPAGE_DIR) \
285                setgid_group=postdrop \
286                sample_directory=/opt/csw/share/doc/postfix/samples \
287                readme_directory=$(DEF_README_DIR) \
288                html_directory=$(DEF_HTML_DIR)
289
290        # Files for cswinitsmf and cswusergroup
291        ginstall -Dm 755 $(FILEDIR)/cswpostfix  \
292                $(DESTDIR)/etc/opt/csw/init.d/cswpostfix
293        ginstall -D $(FILEDIR)/cswusergroup \
294                $(DESTDIR)$(sysconfdir)/pkg/CSWpostfix/cswusergroup
295
296    # Helper script for spool location migration (2.4.x -> 2.6.x)
297        ginstall -Dm 755 $(FILEDIR)/migrate-queuefiles.sh \
298                $(DESTDIR)$(docdir)/$(NAME)/scripts/migrate-queuefiles.sh
299
300        # Upgrade notice for users upgrading from the 2.4 package
301        ginstall -Dm 644 $(FILEDIR)/README.upgradefrom.24 \
302                $(DESTDIR)$(docdir)/$(NAME)/README.upgradefrom.24
303
304        # Instructions to replace the system's sendmail
305        ginstall -Dm 644 $(FILEDIR)/README.CSW \
306                $(DESTDIR)$(docdir)/$(NAME)/README.CSW
307        @echo "===> Fixing /usr/local into /opt/csw"
308        find $(DESTDIR)/$(DEF_HTML_DIR) -type f -depth -print | \
309           xargs -n 1 gsed -i -e 's|/usr/local|/opt/csw|g'
310        find $(DESTDIR)/$(DEF_README_DIR) -type f -depth -print | \
311           xargs -n 1 gsed -i -e 's|/usr/local|/opt/csw|g'
312        find $(DESTDIR)/$(DEF_DAEMON_DIR) -type f -name '*.cf' -depth -print | \
313           xargs -n 1 gsed -i -e 's|/usr/local|/opt/csw|g'
314        find $(DESTDIR)/$(CONFIG_BASE) -type f -name '*.cf' -depth -print | \
315           xargs -n 1 gsed -i -e 's|/usr/local|/opt/csw|g'
316        @$(MAKECOOKIE)
317
318# Fails. A subsequent manual verify-config run is successfull,
319# seems as if there might be some delay required.
320#post-merge-modulated: verify-config
321
322# Warn if there are any files in $(sysconfdir)/postfix which are not
323# covered by cswsampleconf. This is a safety net in case new config file
324# get introduced by more recent postfix versions. I know this runs for
325# most bloated awkwardness. Feel free to trim it down.
326#verify-config: SHIPPED_CFGFILES  = $(wildcard $(PKGROOT)$(CONFIG_BASE)*)
327#verify-config: SHIPPED_CFGFILES := $(subst $(PKGROOT),,$(SHIPPED_CFGFILES))
328#verify-config: IGNORE_FILES += /etc/opt/csw/postfix/bounce.cf.default
329#verify-config: IGNORE_FILES += /etc/opt/csw/postfix/main.cf.default
330#verify-config: IGNORE_FILES += $(addsuffix .CSW, $(SAMPLECONF))
331#verify-config: SHELL=/bin/bash
332#verify-config:
333#       @echo "Checking for files in $(CONFIG_BASE) not covered by cswsampleconf"
334#       @gdiff \
335#               <( echo $(IGNORE_FILES) | tr " " "\n" | sort) \
336#               <( echo $(SHIPPED_CFGFILES) | tr " " "\n" | sort )
337#       @echo "OK"
338#       @$(MAKECOOKIE) 
Note: See TracBrowser for help on using the browser.