forked from mailpile/Mailpile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
227 lines (194 loc) · 7.89 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Recipes for stuff
export PYTHONPATH := .
help:
@echo ""
@echo "BUILD"
@echo " dpkg"
@echo " Create a debian package of this service (in a Docker "
@echo " container)."
@echo ""
all: submodules alltests docs web compilemessages transifex
dev:
@echo export PYTHONPATH=`pwd`
arch-dev:
sudo pacman -Syu --needed community/python2-pillow extra/python2-lxml community/python2-jinja \
community/python2-pep8 extra/python2-nose community/phantomjs \
extra/python2-pip community/python2-mock \
extra/ruby community/npm community/spambayes
TMPDIR=`mktemp -d /tmp/aur.XXXXXXXXXX`; \
cd $$TMPDIR; \
pacman -Qs '^yuicompressor$$' > /dev/null; \
if [ $$? -ne 0 ]; then \
sudo pacman -S --needed core/base-devel; \
curl -s https://aur.archlinux.org/cgit/aur.git/snapshot/yuicompressor.tar.gz | tar xzv; \
cd yuicompressor; \
makepkg -si; \
cd $$TMPDIR; \
fi; \
cd /tmp; \
rm -rf $$TMPDIR
sudo pip2 install 'selenium>=2.40.0'
which lessc >/dev/null || sudo gem install therubyracer less
which bower >/dev/null || sudo npm install -g bower
which uglify >/dev/null || sudo npm install -g uglify
fedora-dev:
sudo yum install python-imaging python-lxml python-jinja2 python-pep8 \
ruby ruby-devel python-yui python-nose spambayes \
phantomjs python-pip python-mock npm
sudo yum install rubygems; \
sudo yum install python-pgpdump || pip install pgpdump
sudo pip install 'selenium>=2.40.0'
which lessc >/dev/null || sudo gem install therubyracer less
which bower >/dev/null || sudo npm install -g bower
which uglify >/dev/null || sudo npm install -g uglify
debian-dev:
sudo apt-get install python-imaging python-lxml python-jinja2 pep8 \
ruby-dev yui-compressor python-nose spambayes \
python-pip python-mock python-selenium \
rubygems-integration
dpkg -l|grep -qP ' nodejs .*nodesource' || sudo apt install npm
sudo apt-get install python-pgpdump || pip install pgpdump
which phantomjs >/dev/null || sudo apt-get install phantomjs || sudo npm install -g phantomjs
which lessc >/dev/null || sudo gem install therubyracer less
which bower >/dev/null || sudo npm install -g bower
which uglify >/dev/null || sudo npm install -g uglify
submodules:
git submodule update --remote
docs: submodules
@python2 mailpile/urlmap.py |grep -v ^FIXME: >doc/URLS.md
@ls -l doc/URLS.md
@python2 mailpile/defaults.py |grep -v -e ^FIXME -e ';timestamp' \
>doc/defaults.cfg
@ls -l doc/defaults.cfg
web: less js
@true
alltests: clean pytests
@chmod go-rwx mailpile/tests/data/gpg-keyring
@DISPLAY= nosetests
@DISPLAY= python2 scripts/mailpile-test.py || true
@git checkout mailpile/tests/data/
pytests:
@echo -n 'security ' && python2 mailpile/security.py
@echo -n 'urlmap ' && python2 mailpile/urlmap.py -nomap
@echo -n 'search ' && python2 mailpile/search.py
@echo -n 'mailutils ' && python2 mailpile/mailutils/__init__.py
@echo -n 'mailutils.safe ' && python2 mailpile/mailutils/safe.py
@echo -n 'config/base ' && python2 mailpile/config/base.py
@echo -n 'config/validators' && python2 mailpile/config/validators.py
@echo -n 'config/manager ' && python2 mailpile/config/manager.py
@echo -n 'conn_brokers ' && python2 mailpile/conn_brokers.py
@echo -n 'crypto/mime ' && python2 mailpile/crypto/mime.py
@echo -n 'index.base ' && python2 mailpile/index/base.py
@echo -n 'index.msginfo ' && python2 mailpile/index/msginfo.py
@echo -n 'index.mailboxes ' && python2 mailpile/index/mailboxes.py
@echo -n 'index.search ' && python2 mailpile/index/search.py
@echo -n 'util ' && python2 mailpile/util.py
@echo -n 'vcard ' && python2 mailpile/vcard.py
@echo -n 'workers ' && python2 mailpile/workers.py
@echo -n 'packing ' && python2 mailpile/packing.py
@echo -n 'mailboxes/pop3 ' && python2 mailpile/mailboxes/pop3.py
@echo -n 'mail_source/imap ' && python2 mailpile/mail_source/imap.py
@echo -n 'crypto/aes_utils ' && python2 mailpile/crypto/aes_utils.py
@echo 'crypto/streamer...' && python2 mailpile/crypto/streamer.py
@echo
clean:
@rm -f `find . -name \\*.pyc` \
`find . -name \\*.mo` \
mailpile-tmp.py mailpile.py \
ChangeLog AUTHORS \
.appver MANIFEST .SELF .*deps \
scripts/less-compiler.mk ghostdriver.log
@rm -rf *.egg-info build/ \
mailpile/tests/data/tmp/ testing/tmp/
@rm -f shared-data/multipile/www/admin.cgi
mrproper: clean
@rm -rf shared-data/locale/?? shared-data/locale/??[_@]*
@rm -rf dist/ bower_components/ shared-data/locale/mailpile.pot
@rm -rf mp-virtualenv/
git reset --hard && git clean -dfx
sdist: clean
@python setup.py sdist
#bdist-prep: compilemessages web -- FIXME: Make building web assets work!
bdist-prep: compilemessages
@true
bdist:
@python setup.py bdist_wheel
virtualenv: mp-virtualenv/bin/activate
virtualenv-dev: mp-virtualenv/bin/.dev
mp-virtualenv/bin/activate:
virtualenv -p python2 --system-site-packages mp-virtualenv
bash -c 'source mp-virtualenv/bin/activate && pip install -r requirements.txt && python setup.py install'
@rm -rf mp-virtualenv/bin/.dev
@echo
@echo NOTE: If you want to test/develop with GnuPG 2.1, you might
@echo want to activate the virtualenv and then run this script
@echo to build GnuPG 2.1: ./scripts/add-gpgme-and-gnupg-to-venv
@echo
mp-virtualenv/bin/.dev: virtualenv
rm -rf mp-virtualenv/lib/python2.7/site-packages/mailpile
cd mp-virtualenv/lib/python2.7/site-packages/ && ln -s ../../../../mailpile
rm -rf mp-virtualenv/share/mailpile
cd mp-virtualenv/share/ && ln -s ../../shared-data mailpile
@touch mp-virtualenv/bin/.dev
bower_components:
@bower install
js: bower_components
# Warning: Horrible hack to extract rules from Gruntfile.js
rm -f shared-data/default-theme/js/libraries.min.js
cat `cat Gruntfile.js \
|sed -e '1,/concat:/d ' \
|sed -e '1,/src:/d' -e '/dest:/,$$d' \
|grep / \
|sed -e "s/[',]/ /g"` \
>> shared-data/default-theme/js/mailpile-min.js.tmp
uglify -s shared-data/default-theme/js/mailpile-min.js.tmp \
-o shared-data/default-theme/js/libraries.min.js
#@cp -va shared-data/default-theme/js/mailpile-min.js.tmp \
# shared-data/default-theme/js/libraries.min.js
@rm -f shared-data/default-theme/js/mailpile-min.js.tmp
less: less-compiler bower_components
@make -s -f scripts/less-compiler.mk
less-loop: less-compiler
@echo 'Running less compiler every 15 seconds. CTRL+C quits.'
@while [ 1 ]; do \
make -s less; \
sleep 15; \
done
less-compiler:
bower install
@cp scripts/less-compiler.in scripts/less-compiler.mk
@find shared-data/default-theme/less/ -name '*.less' \
|perl -npe s'/^/\t/' \
|perl -npe 's/$$/\\/' \
>>scripts/less-compiler.mk
@echo >> scripts/less-compiler.mk
@perl -e 'print "\t\@touch .less-deps", $/' >> scripts/less-compiler.mk
genmessages:
@scripts/make-messages.sh
compilemessages:
@scripts/compile-messages.sh
transifex:
tx pull -a --minimum-perc=50
tx pull -l is,en_GB
# -----------------------------------------------------------------------------
# BUILD
# -----------------------------------------------------------------------------
tarball: mrproper js genmessages transifex
git submodule update --init --recursive
git submodule foreach 'git reset --hard && git clean -dfx'
tar --exclude='./packages/debian' --exclude-vcs -czf /tmp/mailpile.tar.gz -C $(shell pwd) .
mv /tmp/mailpile.tar.gz .
dpkg: tarball
if [ ! -d dist ]; then \
mkdir dist; \
fi;
if [ -e ./dist/*.deb ]; then \
sudo rm ./dist/*.deb; \
fi;
sudo docker build \
--file=packages/Dockerfile_debian \
--tag=mailpile-deb-builder \
./
sudo docker run \
--volume=$$(pwd)/dist:/mnt/dist \
mailpile-deb-builder