Makefile.am 6.49 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
# Copyright 2017 The Sympa Community. See the AUTHORS.md file at the top-level
# directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
12
13
14
15
16
17
18
19
20
21
22
23
#
# 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
24
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
25

26
27
28
29
SUBDIRS = src default doc po www
if SMTPC
SUBDIRS += src/smtpc
endif
30

31
32
33
34
35
36
37
38
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 \
39
	t/pod-syntax.t \
40
41
	t/tools_data.t \
	t/tools_file.t \
42
	t/Tools_Password.t \
43
	t/Tools_SMIME.t \
44
	t/Tools_Text.t \
45
	t/tools_time.t
46
47
48
49
50
51
52
53
54
55
56
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 \
57
58
	t/stub/Sympa/Constants.pm \
	xt/perlcriticrc
59
noinst_SCRIPTS = \
60
	xt/critic.t \
61
62
	xt/fixme.t \
	xt/fixme-todo.t \
63
	xt/pod-coverage.t \
64
	xt/pod-spelling.t
65
66

EXTRA_DIST = \
67
	AUTHORS.md \
IKEDA Soji's avatar
IKEDA Soji committed
68
	CONTRIBUTING.md \
69
	INSTALL.md \
70
71
72
	NEWS.md \
	OChangeLog \
	ONEWS \
73
	README.md \
74
75
	etc_README \
	$(check_SCRIPTS) $(check_DATA) \
76
	$(noinst_SCRIPTS)
77

78
CLEANFILES = sympa_wizard.pl.inst
79

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

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

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

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

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

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

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

197
uninstall-hook:
198
199
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
200

201
202
203
dist-hook:
	$(MAKE) check