Makefile.am 6.86 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 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
39
40
	t/tools_data.t \
	t/tools_file.t \
	t/Tools_SMIME.t \
	t/tools_time.t
41
42
43
44
45
46
47
48
49
50
51
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 \
52
53
	t/stub/Sympa/Constants.pm \
	xt/perlcriticrc
54
noinst_SCRIPTS = \
55
	xt/critic.t \
56
57
	xt/fixme.t \
	xt/fixme-todo.t \
58
	xt/pod-coverage.t \
59
	xt/pod-spelling.t
60
61
62
63
64
65
66
67
68

EXTRA_DIST = \
	important_changes.pl \
	META.json.pl \
	META.json \
	sympa.spec.pl \
	sympa.spec \
	etc_README \
	$(check_SCRIPTS) $(check_DATA) \
69
	$(noinst_SCRIPTS)
70

71
CLEANFILES = META.json previous_sympa_version sympa.spec sympa_wizard.pl.inst
72

73
74
75
76
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

77
check-local:
78
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(check_SCRIPTS)"; \
79
	PERL5LIB=src/lib; export PERL5LIB; \
80
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
81

82
authorcheck:
83
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(noinst_SCRIPTS)"; \
84
	PERL5LIB=src/lib; export PERL5LIB; \
85
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
86

87
install-data-hook: installdir installconfig nextstep importantchanges
88
89
90
91
92
if SMTPC
	-chown $(USER) $(DESTDIR)$(libexecdir)/sympa_smtpc
	-chgrp $(GROUP) $(DESTDIR)$(libexecdir)/sympa_smtpc
	-chmod 750 $(DESTDIR)$(libexecdir)/sympa_smtpc
endif
root's avatar
root committed
93

94
installdir:
95
96
97
98
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
99
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
100
101
		fi; \
	done
102
103
	@echo "Creating writable directories"
	@for dir in $(expldir) $(spooldir) $(spooldir)/msg $(spooldir)/digest \
104
		$(spooldir)/moderation $(spooldir)/auth \
105
		$(spooldir)/outgoing $(spooldir)/tmp $(spooldir)/task \
106
		$(spooldir)/bulk \
107
		$(bouncedir) $(arcdir) $(piddir) $(staticdir) $(staticdir)/js $(sysconfdir); do \
108
109
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
110
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
111
112
113
		fi; \
		chown $(USER) $(DESTDIR)$$dir || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$$dir || /bin/true; \
114
	done
115

116
117
118
119
120
121
122
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
123
124
	@echo "Installing basic configuration ..."
	export PERL5LIB=$(DESTDIR)$(modulesdir); \
125
	if [ ! -f  $(DESTDIR)$(confdir)/sympa.conf ]; then \
olivier.salaun's avatar
olivier.salaun committed
126
		echo "This looks like your first Sympa installation. The following wizard will assist you to create your first Sympa configuration.";\
127
128
129
		if [ ! -d $(DESTDIR)$(confdir) ]; then \
			$(INSTALL) -d -m 755 $(DESTDIR)$(confdir); \
		fi; \
130
131
		chown $(USER) $(DESTDIR)$(confdir) || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(confdir) || /bin/true; \
132
		$(PERL) sympa_wizard.pl.inst \
133
			--create sympa.conf \
134
			--target $(DESTDIR)$(confdir)/sympa.conf \
135
			|| /bin/true; \
136
137
		chown $(USER) $(DESTDIR)$(confdir)/sympa.conf || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf || /bin/true; \
138
	fi; \
139
140
	if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
		cd $(DESTDIR)$(sysconfdir); \
141
142
143
		echo "# automatically created file" >> data_structure.version; \
		echo "# you should not modify it" >> data_structure.version; \
		echo $(VERSION) >> data_structure.version; \
144
145
		chown $(USER) data_structure.version || /bin/true; \
		chgrp $(GROUP) data_structure.version || /bin/true; \
sympa-authors's avatar
sympa-authors committed
146
	fi
147
148
149
	@for dir in create_list_templates custom_actions custom_conditions \
		data_sources families global_task_models list_task_models \
		mail_tt2 scenari search_filters web_tt2; do \
150
151
		if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
152
			$(INSTALL) -d -m 755 $(DESTDIR)$(sysconfdir)/$$dir; \
153
154
155
156
157
158
159
160
161
162
163
164
		fi; \
		chown $(USER) $(DESTDIR)$(sysconfdir)/$$dir || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(sysconfdir)/$$dir || /bin/true; \
	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
165

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

importantchanges:
187
188
	if test -f $(top_srcdir)/previous_sympa_version; then \
		export PREVIOUS=`$(CAT) $(top_srcdir)/previous_sympa_version`; \
189
	fi; \
190
191
192
	$(PERL) $(top_srcdir)/important_changes.pl \
		--current=$(VERSION) \
		--previous=$${PREVIOUS};
193
194

uninstall-hook:
195
196
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
197

198
199
200
dist-hook:
	$(MAKE) check

201
META.json: META.json.pl Makefile src/lib/Sympa/ModDef.pm
202
203
204
	cd src/lib; $(MAKE) Sympa/Constants.pm
	$(PERL) META.json.pl > META.json

205
sympa.spec: sympa.spec.pl Makefile src/lib/Sympa/ModDef.pm
206
	cd src/lib; $(MAKE) Sympa/Constants.pm
207
208
	$(PERL) sympa.spec.pl > sympa.spec