-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (68 loc) · 2.43 KB
/
Makefile
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
SRC = $(shell pwd)/.src
GEM_HOME = $(shell pwd)/.gems
FPM_BIN = $(GEM_HOME)/bin/fpm
FPM_EXE = GEM_HOME=$(GEM_HOME) $(FPM_BIN) --force
ARCH = amd64
# versions
POSTSRSD_VERSION = 1.4
SMFSPF_VERSION = 2.4.2
RUBY_JLS_GROK_VERSION = 0.11.2
.PHONY: fpmhelp mrproper
all: postsrsd smf-spf
$(SRC)/postsrsd: $(SRC)
git clone https://github.com/roehling/postsrsd.git $@
postsrsd_$(POSTSRSD_VERSION)_$(ARCH).deb: fpm $(SRC)/postsrsd
sudo apt-get install -yqq cmake
cd $(SRC)/postsrsd && git checkout $(POSTSRSD_VERSION)
mkdir -p $(SRC)/postsrsd/build
cd $(SRC)/postsrsd/build && cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DINIT_FLAVOR=sysv-lsb -DCHROOT_DIR=/var/lib/postsrsd \
-DGENERATE_SRS_SECRET=OFF ..
cd $(SRC)/postsrsd/build && make && make install DESTDIR=../dist
$(FPM_EXE) -s dir -t deb -C $(SRC)/postsrsd/dist \
--name postsrsd \
--version $(POSTSRSD_VERSION) \
--description "Sender Rewriting Scheme daemon for postfix" \
--deb-init $(SRC)/postsrsd/dist/etc/init.d/postsrsd \
--deb-default $(SRC)/postsrsd/dist/etc/default/postsrsd \
--after-install postsrsd/after-install.sh
postsrsd: postsrsd_$(POSTSRSD_VERSION)_$(ARCH).deb
$(SRC)/smf-spf: $(SRC)
git clone https://github.com/jcbf/smf-spf.git $@
smf-spf_$(SMFSPF_VERSION)_$(ARCH).deb: fpm $(SRC)/smf-spf
cd $(SRC)/smf-spf && git checkout v$(SMFSPF_VERSION)
cd $(SRC)/smf-spf && make
sed -e 's@#User\s\+smfs@User nobody@' \
-e 's@#Socket\s\+unix:/var/run/smfs/smf-spf.sock@Socket unix:/var/run/smf-spf/smf-spf.sock@' \
-e 's@#Daemonize\s\+on@Daemonize off@' \
-i $(SRC)/smf-spf/smf-spf.conf
$(FPM_EXE) -s dir -t deb -C $(SRC)/smf-spf \
--name smf-spf \
--version $(SMFSPF_VERSION) \
--description "SPF milter service" \
--depends libmilter1.0.1 \
--depends libspf2-2 \
--deb-systemd smf-spf/systemd/smf-spf.service \
smf-spf=/usr/sbin/ \
smf-spf.conf=/etc/
smf-spf: smf-spf_$(SMFSPF_VERSION)_$(ARCH).deb
ruby-jls-grok_$(RUBY_JLS_GROK_VERSION)_all.deb: fpm
$(FPM_EXE) -s gem -t deb \
--version $(RUBY_JLS_GROK_VERSION) \
--gem-package-name-prefix ruby \
--prefix $(shell gem environment gemdir) \
jls-grok
ruby-jls-grok: ruby-jls-grok_$(RUBY_JLS_GROK_VERSION)_all.deb
$(FPM_BIN):
sudo apt-get install -yqq ruby-dev build-essential
mkdir -p $(GEM_HOME)
gem install --no-ri --no-rdoc --install-dir $(GEM_HOME) fpm
fpm: $(FPM_BIN)
fpmhelp: $(FPM_BIN)
$(FPM_EXE) --help | less
$(SRC):
mkdir -p $(SRC)
clean:
rm -rf $(SRC) *.deb
mrproper: clean
rm -rf $(GEM_HOME)