Makefile.am 6.59 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
SUBDIRS = src default doc po www
24

25
26
check_SCRIPTS = t/Language.t \
		t/LockedFile.t \
27
		t/Regexps.t \
28
		t/compile_modules.t \
29
		t/compile_executables.t \
30
		t/Database_LDAP.t \
31
32
		t/tools_data.t \
		t/tools_file.t \
33
		t/Tools_SMIME.t \
34
		t/tools_time.t
35
36
37
38
39
40
41
42
43
44
45
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 \
46
47
	t/stub/Sympa/Constants.pm \
	xt/perlcriticrc
48
noinst_SCRIPTS = \
49
	xt/critic.t \
50
51
52
53
54
55
56
57
58
59
60
61
	xt/pod-coverage.t \
	xt/pod-spelling.t \
	xt/pod-syntax.t

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

64
CLEANFILES = META.json previous_sympa_version sympa.spec sympa_wizard.pl.inst
65

66
67
68
69
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

70
check-local:
71
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(check_SCRIPTS)"; \
72
	PERL5LIB=src/lib; export PERL5LIB; \
73
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
74

75
authorcheck:
76
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(noinst_SCRIPTS)"; \
77
	PERL5LIB=src/lib; export PERL5LIB; \
78
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
79

80
install-data-hook: installdir installconfig nextstep importantchanges
root's avatar
root committed
81

82
installdir:
83
84
85
86
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
87
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
88
89
		fi; \
	done
90
91
	@echo "Creating writable directories"
	@for dir in $(expldir) $(spooldir) $(spooldir)/msg $(spooldir)/digest \
92
		$(spooldir)/moderation $(spooldir)/auth \
93
		$(spooldir)/outgoing $(spooldir)/tmp $(spooldir)/task \
94
		$(spooldir)/bulk \
95
		$(bouncedir) $(arcdir) $(piddir) $(staticdir) $(staticdir)/js $(sysconfdir); do \
96
97
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
98
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
99
100
101
		fi; \
		chown $(USER) $(DESTDIR)$$dir || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$$dir || /bin/true; \
102
	done
103

104
105
106
107
108
109
110
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
111
112
	@echo "Installing basic configuration ..."
	export PERL5LIB=$(DESTDIR)$(modulesdir); \
113
	if [ ! -f  $(DESTDIR)$(confdir)/sympa.conf ]; then \
olivier.salaun's avatar
olivier.salaun committed
114
		echo "This looks like your first Sympa installation. The following wizard will assist you to create your first Sympa configuration.";\
115
116
117
		if [ ! -d $(DESTDIR)$(confdir) ]; then \
			$(INSTALL) -d -m 755 $(DESTDIR)$(confdir); \
		fi; \
118
119
		chown $(USER) $(DESTDIR)$(confdir) || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(confdir) || /bin/true; \
120
		$(PERL) sympa_wizard.pl.inst \
121
			--create sympa.conf \
122
			--target $(DESTDIR)$(confdir)/sympa.conf \
123
			|| /bin/true; \
124
125
		chown $(USER) $(DESTDIR)$(confdir)/sympa.conf || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf || /bin/true; \
126
	fi; \
127
128
	if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
		cd $(DESTDIR)$(sysconfdir); \
129
130
131
		echo "# automatically created file" >> data_structure.version; \
		echo "# you should not modify it" >> data_structure.version; \
		echo $(VERSION) >> data_structure.version; \
132
133
		chown $(USER) data_structure.version || /bin/true; \
		chgrp $(GROUP) data_structure.version || /bin/true; \
sympa-authors's avatar
sympa-authors committed
134
	fi
135
136
137
	@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 \
138
139
		if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
140
			$(INSTALL) -d -m 755 $(DESTDIR)$(sysconfdir)/$$dir; \
141
142
143
144
145
146
147
148
149
150
151
152
		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
153

olivier.salaun's avatar
olivier.salaun committed
154
nextstep: 
155
156
	@echo ""
	@echo "** You can find documentation at:"
157
	@echo "** http://www.sympa.org/documentation/manual/sympa-$(VERSION).pdf"
olivier.salaun's avatar
olivier.salaun committed
158
159
	@echo ""
	@echo "#########################################################"
160
161
162
163
	@echo "# CHECK YOU HAVE ALL THE NEEDED MODULES:"
	@echo "#    * Check the required perl modules are installed:"
	@echo "#        $(sbindir)/sympa_wizard.pl --check"
	@echo "#"
164
165
166
167
	@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"
168
	@echo "#"
169
170
171
	@echo "# UPGRADING"
	@echo "#    * Run this script to upgrade your data structures:"
	@echo "#        $(sbindir)/sympa.pl --upgrade"
olivier.salaun's avatar
olivier.salaun committed
172
	@echo "#######################################################"
173
174

importantchanges:
175
176
	if test -f $(top_srcdir)/previous_sympa_version; then \
		export PREVIOUS=`$(CAT) $(top_srcdir)/previous_sympa_version`; \
177
	fi; \
178
179
180
	$(PERL) $(top_srcdir)/important_changes.pl \
		--current=$(VERSION) \
		--previous=$${PREVIOUS};
181
182

uninstall-hook:
183
184
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
185

186
META.json: META.json.pl Makefile src/lib/Sympa/ModDef.pm
187
188
189
	cd src/lib; $(MAKE) Sympa/Constants.pm
	$(PERL) META.json.pl > META.json

190
sympa.spec: sympa.spec.pl Makefile src/lib/Sympa/ModDef.pm
191
	cd src/lib; $(MAKE) Sympa/Constants.pm
192
193
	$(PERL) sympa.spec.pl > sympa.spec