Makefile.am 7.54 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, 2019 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
check_SCRIPTS = \
29
	t/01_Conf.t \
IKEDA Soji's avatar
IKEDA Soji committed
30 31 32
	t/Config_XML.t \
	t/DatabaseManager.t \
	t/Database_LDAP.t \
33 34
	t/Language.t \
	t/LockedFile.t \
IKEDA Soji's avatar
IKEDA Soji committed
35
	t/Message_smime.t \
IKEDA Soji's avatar
IKEDA Soji committed
36
	t/Message_urlize.t \
37
	t/Regexps.t \
IKEDA Soji's avatar
IKEDA Soji committed
38 39
	t/Tools_Data.t \
	t/Tools_File.t \
40
	t/Tools_Password.t \
41
	t/Tools_SMIME.t \
42
	t/Tools_Text.t \
IKEDA Soji's avatar
IKEDA Soji committed
43 44 45 46 47 48
	t/Tools_Time.t \
	t/compile_executables.t \
	t/compile_modules.t \
	t/compile_scenarios.t \
	t/parse_templates.t \
	t/pod-syntax.t
49
check_DATA = \
IKEDA Soji's avatar
IKEDA Soji committed
50 51 52 53
	t/data/list_data/test/config \
	t/data/sympa.conf \
	t/data/sympa.sqlite \
	t/data/etc/auth.conf \
54 55 56 57 58 59 60 61 62 63
	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 \
64 65 66 67 68 69 70 71
	t/samples/urlize-deep-nested-mixed.eml \
	t/samples/urlize-encoding.eml \
	t/samples/urlize-nested-alternative-and-related.eml \
	t/samples/urlize-nested-alternative.eml \
	t/samples/urlize-nested-mixed.eml \
	t/samples/urlize-nested-mutiple-attachments.eml \
	t/samples/urlize-simple-mutiple-attachments.eml \
	t/samples/urlize-simple.eml \
IKEDA Soji's avatar
IKEDA Soji committed
72 73
	t/samples/signed.eml \
	t/samples/unsigned.eml \
IKEDA Soji's avatar
IKEDA Soji committed
74
	t/stub/Sympa/Constants.pm \
75
	xt/perlcriticrc
76
noinst_SCRIPTS = \
77
	xt/critic.t \
78 79
	xt/fixme.t \
	xt/fixme-todo.t \
80
	xt/pod-coverage.t \
81 82
	xt/pod-spelling.t \
	xt/perltidy.t
IKEDA Soji's avatar
IKEDA Soji committed
83 84
nobase_modules_DATA = \
	cpanfile
85 86

EXTRA_DIST = \
87
	AUTHORS.md \
IKEDA Soji's avatar
IKEDA Soji committed
88
	CONTRIBUTING.md \
89
	INSTALL.md \
90 91 92
	NEWS.md \
	OChangeLog \
	ONEWS \
93
	README.md \
94 95
	etc_README \
	$(check_SCRIPTS) $(check_DATA) \
IKEDA Soji's avatar
IKEDA Soji committed
96 97
	$(noinst_SCRIPTS) \
	$(nobase_modules_DATA)
98

99 100
CLEANFILES = \
	sympa.conf-dist
101

102 103 104 105
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

IKEDA Soji's avatar
IKEDA Soji committed
106
# Skip this with "make distcheck"
107
check-local: $(check_DATA)
IKEDA Soji's avatar
IKEDA Soji committed
108 109 110 111 112
	if test -d t; then \
		[ -z "$(TEST_FILES)" ] && TEST_FILES="$(check_SCRIPTS)"; \
		PERL5LIB=src/lib; export PERL5LIB; \
		$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES; \
	fi
113

114
authorcheck:
115
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(noinst_SCRIPTS)"; \
116
	PERL5LIB=src/lib; export PERL5LIB; \
117
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
118

119
install-data-hook: installdir installconfig nextstep
root's avatar
root committed
120

121
installdir:
122 123 124 125
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
126
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
127 128
		fi; \
	done
129
	@echo "Creating writable directories"
130
	-@for dir in $(expldir) $(spooldir) $(bouncedir) $(arcdir) $(piddir) \
131
		$(confdir) $(sysconfdir); do \
132 133
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
134
			$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
135
		fi; \
136 137
		chown $(USER) $(DESTDIR)$$dir; \
		chgrp $(GROUP) $(DESTDIR)$$dir; \
138
	done
139 140 141 142 143 144 145 146
	-@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
147

148
installconfig: installdir
149
	@echo "Installing basic configuration ..."
150 151 152
	-@if [ ! -f  $(DESTDIR)$(confdir)/sympa.conf ]; then \
		echo "installing sympa.conf"; \
		$(INSTALL) -m 640 sympa.conf $(DESTDIR)$(confdir); \
153 154 155
		chown $(USER) $(DESTDIR)$(confdir)/sympa.conf; \
		chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf; \
	fi
156 157
	@echo "Installing configuration template ..."
	-@echo "installing sympa.conf-dist"; \
158 159
	$(INSTALL) -m 644 -T sympa.conf-dist $(DESTDIR)$(confdir)/sympa.conf-dist; \
	chown $(USER) $(DESTDIR)$(confdir)/sympa.conf-dist; \
160
	chgrp $(GROUP) $(DESTDIR)$(confdir)/sympa.conf-dist
161
	-@if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
162
		cd $(DESTDIR)$(sysconfdir); \
163 164 165
		echo "# automatically created file" >> data_structure.version; \
		echo "# you should not modify it" >> data_structure.version; \
		echo $(VERSION) >> data_structure.version; \
166 167
		chown $(USER) data_structure.version; \
		chgrp $(GROUP) data_structure.version; \
168
	fi
169
	-@for dir in create_list_templates custom_actions custom_conditions \
170
		data_sources families tasks \
171
		mail_tt2 scenari search_filters web_tt2; do \
172 173
		if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
174
			$(INSTALL) -d -m 755 $(DESTDIR)$(sysconfdir)/$$dir; \
175
		fi; \
176 177
		chown $(USER) $(DESTDIR)$(sysconfdir)/$$dir; \
		chgrp $(GROUP) $(DESTDIR)$(sysconfdir)/$$dir; \
178 179 180 181 182 183
	done
	@if [ ! -e $(DESTDIR)$(sysconfdir)/README ]; then \
		echo "Creating $(DESTDIR)$(sysconfdir)/README"; \
		$(SED) \
			-e 's|--sysconfdir--|$(sysconfdir)|' \
			-e 's|--defaultdir--|$(defaultdir)|' \
IKEDA Soji's avatar
IKEDA Soji committed
184
			$(srcdir)/etc_README > $(DESTDIR)$(sysconfdir)/README; \
185
		chmod 644 $(DESTDIR)$(sysconfdir)/README; \
186
	fi
187

olivier.salaun's avatar
olivier.salaun committed
188
nextstep: 
189 190
	@echo ""
	@echo "** You can find documentation at:"
IKEDA Soji's avatar
IKEDA Soji committed
191
	@echo "** https://sympa-community.github.io/manual/"
olivier.salaun's avatar
olivier.salaun committed
192 193
	@echo ""
	@echo "#########################################################"
194
	@echo "# CHECK YOU HAVE ALL THE NEEDED MODULES:"
195 196
	@echo "#    * Install or upgrade required perl modules. If you have cpanminus:"
	@echo "#        cpanm --installdeps --with-recommends ."
197
	@echo "#"
198
	@echo "# FIRST INSTALLATION:"
199 200
	@echo "#    * Edit this file to define initial configuration:"
	@echo "#        $(confdir)/sympa.conf"
201
	@echo "#"
Luc Didry's avatar
Luc Didry committed
202 203
	@echo "# ADDITIONAL SETTINGS:"
	@echo "#    * You will find all available configuration settings in:"
204
	@echo "#        $(confdir)/sympa.conf-dist"
Luc Didry's avatar
Luc Didry committed
205 206 207 208
	@echo "#"
	@echo "#    * Copy the configuration settings you want in:"
	@echo "#        $(confdir)/sympa.conf"
	@echo "#"
209 210 211
	@echo "# UPGRADING"
	@echo "#    * Run this script to upgrade your data structures:"
	@echo "#        $(sbindir)/sympa.pl --upgrade"
olivier.salaun's avatar
olivier.salaun committed
212
	@echo "#######################################################"
213

214
uninstall-hook:
IKEDA Soji's avatar
IKEDA Soji committed
215
	cd $(DESTDIR)$(confdir) && rm -f sympa.conf
216
	cd $(DESTDIR)$(confdir) && rm -f sympa.conf-dist
IKEDA Soji's avatar
IKEDA Soji committed
217 218 219 220 221
	cd $(DESTDIR)$(confdir) && rm -f wwsympa.conf
	cd $(DESTDIR)$(sysconfdir) && rm -f data_structure.version
	cd $(DESTDIR)$(sysconfdir) && rm -f README

DISTCHECK_CONFIGURE_FLAGS = --enable-fhs --with-perl=$(PERL)
222

223 224 225
dist-hook:
	$(MAKE) check

IKEDA Soji's avatar
IKEDA Soji committed
226 227 228
distcheck-hook:
	-md5sum $(DIST_ARCHIVES) > $(DIST_ARCHIVES).md5
	-sha256sum $(DIST_ARCHIVES) > $(DIST_ARCHIVES).sha256
IKEDA Soji's avatar
IKEDA Soji committed
229
	-openssl sha512 $(DIST_ARCHIVES) > $(DIST_ARCHIVES).sha512
IKEDA Soji's avatar
IKEDA Soji committed
230

231 232
tidyall:
	tidyall --conf-file doc/dot.tidyallrc --root-dir . -r src t xt
Luc Didry's avatar
Luc Didry committed
233 234 235

all-local: sympa.conf-dist

236
sympa.conf-dist:
237 238
	@PERL5LIB=$(srcdir)/src/lib; export PERL5LIB; \
	$(PERL) mk-sympa-dist.pl
Luc Didry's avatar
Luc Didry committed
239