Makefile.am 6.33 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
# Copyright 2017, 2018 The Sympa Community. See the AUTHORS.md file at the
# top-level directory of this distribution and at
11
# <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
SUBDIRS = src default doc po www
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 \
IKEDA Soji's avatar
IKEDA Soji committed
65
	CONTRIBUTING.md \
66
	INSTALL.md \
67
68
69
	NEWS.md \
	OChangeLog \
	ONEWS \
70
	README.md \
71
72
	etc_README \
	$(check_SCRIPTS) $(check_DATA) \
73
	$(noinst_SCRIPTS)
74

75
CLEANFILES = sympa_wizard.pl.inst
76

77
78
79
80
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

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

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

91
install-data-hook: installdir installconfig nextstep
root's avatar
root committed
92

93
installdir:
94
95
96
97
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
98
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
99
100
		fi; \
	done
101
	@echo "Creating writable directories"
102
	-@for dir in $(expldir) $(spooldir) $(bouncedir) $(arcdir) $(piddir) \
103
		$(sysconfdir); do \
104
105
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
106
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
107
		fi; \
108
109
		chown $(USER) $(DESTDIR)$$dir; \
		chgrp $(GROUP) $(DESTDIR)$$dir; \
110
	done
111
112
113
114
115
116
117
118
	-@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
119

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

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

189
uninstall-hook:
190
191
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
192

193
194
195
dist-hook:
	$(MAKE) check