Makefile.am 6.85 KB
Newer Older
1
2
# $Id$

3
# Sympa - SYsteme de Multi-Postage Automatique
4
5
6
7
#
# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
8
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
9
10
11
12
13
14
15
16
17
18
19
20
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
21
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22

23
24
25
26
SUBDIRS = src default doc po www
if SMTPC
SUBDIRS += src/smtpc
endif
27

28
29
30
31
32
33
34
35
check_SCRIPTS = \
	t/Language.t \
	t/LockedFile.t \
	t/Regexps.t \
	t/compile_modules.t \
	t/compile_executables.t \
	t/Database_LDAP.t \
	t/parse_templates.t \
36
	t/pod-syntax.t \
37
38
	t/tools_data.t \
	t/tools_file.t \
39
	t/Tools_Password.t \
40
	t/Tools_SMIME.t \
41
	t/Tools_Text.t \
42
	t/tools_time.t
43
44
45
46
47
48
49
50
51
52
53
check_DATA = \
	t/locale/cs/LC_MESSAGES/sympa.mo \
	t/locale/cs/LC_MESSAGES/web_help.mo \
	t/locale/zh_TW/LC_MESSAGES/sympa.mo \
	t/pki/cnf/ca.cnf \
	t/pki/cnf/rousse.cnf \
	t/pki/crt/ca.pem \
	t/pki/crt/rousse.pem \
	t/pki/key/ca.pem \
	t/pki/key/rousse_nopassword.pem \
	t/pki/key/rousse_password.pem \
54
55
	t/stub/Sympa/Constants.pm \
	xt/perlcriticrc
56
noinst_SCRIPTS = \
57
	xt/critic.t \
58
59
	xt/fixme.t \
	xt/fixme-todo.t \
60
	xt/pod-coverage.t \
61
	xt/pod-spelling.t
62
63

EXTRA_DIST = \
64
	AUTHORS.md \
65
	important_changes.pl \
66
	INSTALL.md \
67
68
	META.json.pl \
	META.json \
69
70
71
	NEWS.md \
	OChangeLog \
	ONEWS \
72
	README.md \
73
74
75
76
	sympa.spec.pl \
	sympa.spec \
	etc_README \
	$(check_SCRIPTS) $(check_DATA) \
77
	$(noinst_SCRIPTS)
78

79
CLEANFILES = META.json previous_sympa_version sympa.spec sympa_wizard.pl.inst
80

81
82
83
84
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

85
check-local:
86
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(check_SCRIPTS)"; \
87
	PERL5LIB=src/lib; export PERL5LIB; \
88
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
89

90
authorcheck:
91
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(noinst_SCRIPTS)"; \
92
	PERL5LIB=src/lib; export PERL5LIB; \
93
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
94

95
install-data-hook: installdir installconfig nextstep importantchanges
96
if SMTPC
97
98
99
	-@chown $(USER) $(DESTDIR)$(libexecdir)/sympa_smtpc
	-@chgrp $(GROUP) $(DESTDIR)$(libexecdir)/sympa_smtpc
	-@chmod 750 $(DESTDIR)$(libexecdir)/sympa_smtpc
100
endif
root's avatar
root committed
101

102
installdir:
103
104
105
106
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
107
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
108
109
		fi; \
	done
110
	@echo "Creating writable directories"
111
	-@for dir in $(expldir) $(spooldir) $(spooldir)/msg $(spooldir)/digest \
112
		$(spooldir)/moderation $(spooldir)/auth \
113
		$(spooldir)/outgoing $(spooldir)/tmp $(spooldir)/task \
114
		$(spooldir)/bulk \
115
		$(bouncedir) $(arcdir) $(piddir) $(staticdir) $(staticdir)/js $(sysconfdir); do \
116
117
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
118
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
119
		fi; \
120
121
		chown $(USER) $(DESTDIR)$$dir; \
		chgrp $(GROUP) $(DESTDIR)$$dir; \
122
	done
123

124
125
126
127
128
129
130
sympa_wizard.pl.inst: $(top_srcdir)/src/sbin/sympa_wizard.pl.in Makefile
	$(SED) \
		-e 's|--PERL--|$(PERL)|' \
		-e 's|--modulesdir--|$(top_srcdir)/src/lib|' \
		< $(top_srcdir)/src/sbin/sympa_wizard.pl.in > $@

installconfig: installdir sympa_wizard.pl.inst
131
	@echo "Installing basic configuration ..."
132
	-@export PERL5LIB=$(DESTDIR)$(modulesdir); \
133
	if [ ! -f  $(DESTDIR)$(confdir)/sympa.conf ]; then \
olivier.salaun's avatar
olivier.salaun committed
134
		echo "This looks like your first Sympa installation. The following wizard will assist you to create your first Sympa configuration.";\
135
136
137
		if [ ! -d $(DESTDIR)$(confdir) ]; then \
			$(INSTALL) -d -m 755 $(DESTDIR)$(confdir); \
		fi; \
138
139
		chown $(USER) $(DESTDIR)$(confdir); \
		chgrp $(GROUP) $(DESTDIR)$(confdir); \
140
		$(PERL) sympa_wizard.pl.inst \
141
			--create sympa.conf \
142
143
144
145
146
			--target $(DESTDIR)$(confdir)/sympa.conf; \
		chown $(USER) $(DESTDIR)$(confdir)/sympa.conf; \
		chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf; \
	fi
	-@if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
147
		cd $(DESTDIR)$(sysconfdir); \
148
149
150
		echo "# automatically created file" >> data_structure.version; \
		echo "# you should not modify it" >> data_structure.version; \
		echo $(VERSION) >> data_structure.version; \
151
152
		chown $(USER) data_structure.version; \
		chgrp $(GROUP) data_structure.version; \
sympa-authors's avatar
sympa-authors committed
153
	fi
154
	-@for dir in create_list_templates custom_actions custom_conditions \
155
156
		data_sources families global_task_models list_task_models \
		mail_tt2 scenari search_filters web_tt2; do \
157
158
		if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
159
			$(INSTALL) -d -m 755 $(DESTDIR)$(sysconfdir)/$$dir; \
160
		fi; \
161
162
		chown $(USER) $(DESTDIR)$(sysconfdir)/$$dir; \
		chgrp $(GROUP) $(DESTDIR)$(sysconfdir)/$$dir; \
163
164
165
166
167
168
169
170
171
	done
	@if [ ! -e $(DESTDIR)$(sysconfdir)/README ]; then \
		echo "Creating $(DESTDIR)$(sysconfdir)/README"; \
		$(SED) \
			-e 's|--sysconfdir--|$(sysconfdir)|' \
			-e 's|--defaultdir--|$(defaultdir)|' \
			etc_README > $(DESTDIR)$(sysconfdir)/README; \
		chmod 444 $(DESTDIR)$(sysconfdir)/README; \
	fi
sympa-authors's avatar
sympa-authors committed
172

olivier.salaun's avatar
olivier.salaun committed
173
nextstep: 
174
175
	@echo ""
	@echo "** You can find documentation at:"
176
	@echo "** http://www.sympa.org/documentation/manual/sympa-$(VERSION).pdf"
olivier.salaun's avatar
olivier.salaun committed
177
178
	@echo ""
	@echo "#########################################################"
179
180
181
182
	@echo "# CHECK YOU HAVE ALL THE NEEDED MODULES:"
	@echo "#    * Check the required perl modules are installed:"
	@echo "#        $(sbindir)/sympa_wizard.pl --check"
	@echo "#"
183
	@echo "# FIRST INSTALLATION:"
184
	@echo "#    * Check the INSTALL.md file."
185
186
	@echo "#    * Run the wizard to define some required parameters that can't be guessed."
	@echo "#        $(sbindir)/sympa_wizard.pl"
187
	@echo "#"
188
189
190
	@echo "# UPGRADING"
	@echo "#    * Run this script to upgrade your data structures:"
	@echo "#        $(sbindir)/sympa.pl --upgrade"
olivier.salaun's avatar
olivier.salaun committed
191
	@echo "#######################################################"
192
193

importantchanges:
194
	@if test -f $(top_srcdir)/previous_sympa_version; then \
195
		export PREVIOUS=`$(CAT) $(top_srcdir)/previous_sympa_version`; \
196
	fi; \
197
198
199
	$(PERL) $(top_srcdir)/important_changes.pl \
		--current=$(VERSION) \
		--previous=$${PREVIOUS};
200
201

uninstall-hook:
202
203
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
204

205
206
207
dist-hook:
	$(MAKE) check

208
META.json: META.json.pl Makefile src/lib/Sympa/ModDef.pm
209
210
211
	cd src/lib; $(MAKE) Sympa/Constants.pm
	$(PERL) META.json.pl > META.json

212
sympa.spec: sympa.spec.pl Makefile src/lib/Sympa/ModDef.pm
213
	cd src/lib; $(MAKE) Sympa/Constants.pm
214
215
	$(PERL) sympa.spec.pl > sympa.spec