Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f73d0a863d
Fetching contributors…

Cannot retrieve contributors at this time

file 212 lines (166 sloc) 5.351 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
at_franz = $(shell if test -d /fi/cl/8.2/acl; then echo t; else echo nil; fi)

Makefile_local = \
$(shell if test -f Makefile.local; then echo Makefile.local; fi)

ifneq ($(Makefile_local),)
include $(Makefile_local)
endif

ARCH ?= $(shell uname -i)

ifeq ($(at_franz),t)
LISPROOT ?= /fi/cl/8.2
LISP ?= $(LISPROOT)/bin/$(shell if [ $(ARCH) = x86_64 ]; then echo mlisp-64; else echo mlisp; fi)
endif

LISP ?= mlisp

ROOT ?= /
prefix ?= $(ROOT)/usr
libdir ?= $(prefix)/lib
bindir ?= $(prefix)/bin
sbindir ?= $(prefix)/sbin

version := $(shell grep 'allegro-maild-version' version.cl | sed -e 's,.*"v\([0-9.]*\)".*,\1,')

ifeq ($(FI_APPS_COMMON),t)
release ?= $(shell . fi-apps-common/rpm-utils.sh && \
rpm_next_release_number \
/net/$(REPOHOST)$(REPOBASE)/$(ARCH)/maild-$(version)-*.$(ARCH).rpm)
else
release ?= 1
endif

installer-package := maild-$(version)-installer.tar.gz

REDHAT73 := $(shell rpm -q redhat-release-7.3 >/dev/null && echo yes)
SUSE92 := $(shell rpm -q suse-release-9.2 >/dev/null && echo yes)

SRCFILES=Makefile \
maild.init maild.init.suse9 maild.sysconfig \
maild.pam maild.pam.suse maild.pam.rh73 \
aliases.cl auth.cl blacklist.cl bounce.cl checkers.cl \
config.cl deliver.cl deliver-smtp.cl dns.cl emailaddr.cl \
greylist.cl headers.cl input.cl ipaddr.cl lex.cl load.cl \
lock.cl log.cl maild.cl mailer.cl queue.cl queue-process.cl \
recips.cl rep-server.cl rewrite.cl sasl.cl security.cl smtp.cl \
smtp-server-checkers.cl smtp-server.cl utils.cl version.cl www.cl

DOCFILES=ALIASES MAILERS.txt NOTES STATS greylist.sql greylist.sql.notes

GREYADMINSRCFILES=Makefile greyadmin.cl login.clp menu.clp super.clp

ifeq ($(at_franz),t)
ALL_EXTRA = repo_check
endif

all: $(ALL_EXTRA) clean maild/maild
(cd greyadmin; ACL=$(LISP) make)

ifeq ($(at_franz),t)
repo_check: FORCE
@if test ! -d fi-apps-common; then \
git clone git:/repo/git/fi-apps-common; \
fi
endif

maild/maild: *.cl
rm -fr maild
$(LISP) -W -batch -L load.cl -e "(build)" -kill

check-mail-virus/check-mail-virus: check-mail-virus.cl
rm -fr check-mail-virus
$(LISP) -batch -L check-mail-virus.cl -e '(build)' -kill

install: install-system install-maild install-greyadmin

install-stop: FORCE
-/etc/init.d/maild stop

install-start: FORCE
/etc/init.d/maild start

install-common:
mkdir -p $(libdir) $(sbindir)

install-maild: maild/maild install-common
rm -fr $(libdir)/maild.old
-mv $(libdir)/maild $(libdir)/maild.old
cp -r maild $(libdir)
chmod +s $(libdir)/maild/maild
rm -f $(sbindir)/maild
ln -s $(libdir)/maild/maild $(sbindir)/maild

install-check-mail-virus: check-mail-virus/check-mail-virus install-common
rm -fr $(libdir)/check-mail-virus
cp -r check-mail-virus $(libdir)
chown root $(libdir)/check-mail-virus/*
ln -sf ../lib/check-mail-virus/check-mail-virus \
$(sbindir)/check-mail-virus

ifeq ($(SUSE92),yes)
pamsrc=maild.pam.suse
else
ifeq ($(REDHAT73),yes)
pamsrc=maild.pam.rh73
else
pamsrc=maild.pam
endif
endif

install-system: FORCE
mkdir -p $(ROOT)/etc
ifeq ($(SUSE92),yes)
cp maild.init.suse9 $(ROOT)/etc/init.d/maild
else
cp maild.init $(ROOT)/etc/rc.d/init.d/maild
endif
if [ ! -e $(ROOT)/etc/sysconfig/maild ]; then \
cp maild.sysconfig $(ROOT)/etc/sysconfig/maild; \
fi
if [ ! -e $(ROOT)/etc/pam.d/smtp ]; then \
cp $(pamsrc) $(ROOT)/etc/pam.d/smtp; \
fi

install-greyadmin: FORCE
(cd greyadmin; make install)

clean: FORCE
rm -fr BUILD SPECS RPMS BUILDROOT SRPMS
rm -f *.fasl maild.tar.gz maild-*.tar.gz autoloads.out
rm -fr maild check-mail-virus
(cd greyadmin; make clean)

realclean: clean
rm -f *~

tarball: all
tar zcf maild.tar.gz maild

dist: tarball
tar zcf $(installer-package) \
maild.tar.gz \
maild.init \
maild-installer

src-tarball: FORCE
rm -fr maild-$(version) maild-$(version).tar.gz
mkdir maild-$(version)
cp $(SRCFILES) $(DOCFILES) maild-$(version)
if test -f Makefile.local; then \
cp Makefile.local maild-$(version); \
fi
mkdir maild-$(version)/greyadmin
(cd greyadmin && cp $(GREYADMINSRCFILES) ../maild-$(version)/greyadmin)
tar zcf maild-$(version).tar.gz maild-$(version)
rm -fr maild-$(version)

%.spec: %.spec.in version.cl
sed -e "s/__VERSION__/$(version)/" < $< > $@

rpm-setup: FORCE
mkdir -p BUILD RPMS SRPMS

%-rpm: maild-%.spec src-tarball rpm-setup
rpmbuild --define "_sourcedir $(CURDIR)" \
--define "_topdir $(CURDIR)" \
--define "release $(release)" \
--target $(ARCH) -ba $<

SIGN ?= --sign

# This is the "normal" target (non-redhat 7.3, non-suse)
redhat-rpm: maild.spec src-tarball rpm-setup
rpmbuild $(SIGN) --define "_sourcedir $(CURDIR)" \
--define "_topdir $(CURDIR)" \
--define "_builddir $(CURDIR)/BUILD" \
--define "_rpmdir $(CURDIR)/RPMS" \
--define "_srcrpmdir $(CURDIR)/SRPMS" \
--define "release $(release)" \
--target $(ARCH) -ba maild.spec

REMOVE_PREVIOUS_VERSIONS ?= no
REPOHOST ?= fs1
REPOBASE ?= /storage1/franz/common

REPODIR=$(REPOBASE)/$(ARCH)

install-repo:
ifeq ($(REMOVE_PREVIOUS_VERSIONS),yes)
ssh root@$(REPOHOST) "rm -f $(REPODIR)/maild-*"
endif
scp -p RPMS/$(ARCH)/maild-$(version)-*.rpm root@$(REPOHOST):$(REPODIR)
ssh root@$(REPOHOST) "createrepo -s sha -q --update $(REPODIR)"

ifeq ($(SUSE92),yes)
rpm: suse-rpm

else
ifeq ($(REDHAT73),yes)
rpm: rh73-rpm

else
rpm: redhat-rpm

endif
endif

test: FORCE
test/test.sh

FORCE:
Something went wrong with that request. Please try again.