Makefile.am 6.12 KB
Newer Older
1
# Makefile.am - Top-level Makefile.am for Sympa
2
3
4
# RCS Identication ; $Revision$ ; $Date$ 
#
# Sympa - SYsteme de Multi-Postage Automatique
5
6
7
8
#
# 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
9
# Copyright (c) 2011, 2012, 2013, 2014, 2015 GIP RENATER
10
11
12
13
14
15
16
17
18
19
20
21
#
# 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
22
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
23

24
SUBDIRS = src default doc po www
25

26
27
check_SCRIPTS = t/Language.t \
		t/LockedFile.t \
28
		t/Regexps.t \
29
		t/compile_modules.t \
30
		t/compile_executables.t \
31
		t/Database_LDAP.t \
32
33
		t/tools_data.t \
		t/tools_file.t \
34
		t/Tools_SMIME.t \
35
		t/tools_time.t
36
37
check_DATA = t/locale/cs/LC_MESSAGES/sympa.mo \
	     t/locale/cs/LC_MESSAGES/web_help.mo \
sikeda's avatar
sikeda committed
38
39
	     t/locale/zh_TW/LC_MESSAGES/sympa.mo \
	     t/stub/Sympa/Constants.pm
40

41
EXTRA_DIST = important_changes.pl \
42
43
	     META.json.pl \
	     META.json \
44
	     sympa.spec.pl \
45
	     sympa.spec \
46
	     etc_README \
47
	     $(check_SCRIPTS) $(check_DATA)
48
CLEANFILES = META.json previous_sympa_version sympa.spec sympa_wizard.pl.inst
49

50
51
52
53
MSGFMT=@MSGFMT@
.po.mo:
	$(MSGFMT) -o $@ $<

54
check-local:
55
	[ -z "$(TEST_FILES)" ] && TEST_FILES="$(check_SCRIPTS)"; \
56
	PERL5LIB=src/lib; export PERL5LIB; \
57
	$(PERL) -MTest::Harness -e 'runtests @ARGV' $$TEST_FILES
58

59
install-data-hook: installdir installconfig nextstep importantchanges
root's avatar
root committed
60

61
installdir:
62
63
64
65
66
67
68
	@echo "Creating plugin directory"
	@for dir in $(modulesdir)/Sympa/Template/Plugin; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
			install -d -m 755 $(DESTDIR)$$dir; \
		fi; \
	done
69
70
71
72
	@echo "Creating writable directories"
	@for dir in $(expldir) $(spooldir) $(spooldir)/msg $(spooldir)/digest \
		$(spooldir)/moderation $(spooldir)/expire $(spooldir)/auth \
		$(spooldir)/outgoing $(spooldir)/tmp $(spooldir)/task \
73
		$(spooldir)/bulk \
74
		$(bouncedir) $(arcdir) $(piddir) $(staticdir) $(staticdir)/js $(sysconfdir); do \
75
76
77
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
			install -d -m 755 $(DESTDIR)$$dir; \
78
79
80
		fi; \
		chown $(USER) $(DESTDIR)$$dir || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$$dir || /bin/true; \
81
	done
82

83
84
85
86
87
88
89
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
90
91
	@echo "Installing basic configuration ..."
	export PERL5LIB=$(DESTDIR)$(modulesdir); \
92
	if [ ! -f  $(DESTDIR)$(confdir)/sympa.conf ]; then \
olivier.salaun's avatar
olivier.salaun committed
93
		echo "This looks like your first Sympa installation. The following wizard will assist you to create your first Sympa configuration.";\
94
95
96
		if [ ! -d $(DESTDIR)$(confdir) ]; then \
			$(INSTALL) -d -m 755 $(DESTDIR)$(confdir); \
		fi; \
97
98
		chown $(USER) $(DESTDIR)$(confdir) || /bin/true; \
		chgrp $(GROUP) $(DESTDIR)$(confdir) || /bin/true; \
99
		$(PERL) sympa_wizard.pl.inst \
100
			--create sympa.conf \
101
			--target $(DESTDIR)$(confdir)/sympa.conf \
102
			|| /bin/true; \
103
	fi; \
104
105
	if [ ! -f $(DESTDIR)$(sysconfdir)/data_structure.version ]; then \
		cd $(DESTDIR)$(sysconfdir); \
106
107
108
		echo "# automatically created file" >> data_structure.version; \
		echo "# you should not modify it" >> data_structure.version; \
		echo $(VERSION) >> data_structure.version; \
109
110
		chown $(USER) data_structure.version || /bin/true; \
		chgrp $(GROUP) data_structure.version || /bin/true; \
sympa-authors's avatar
sympa-authors committed
111
	fi
112
113
114
	@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 \
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		if [ ! -d $(DESTDIR)$(sysconfdir)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(sysconfdir)/$$dir"; \
			install -d -m 755 $(DESTDIR)$(sysconfdir)/$$dir; \
		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
130

olivier.salaun's avatar
olivier.salaun committed
131
nextstep: 
132
133
	@echo ""
	@echo "** You can find documentation at:"
134
	@echo "** http://www.sympa.org/documentation/manual/sympa-$(VERSION).pdf"
olivier.salaun's avatar
olivier.salaun committed
135
136
	@echo ""
	@echo "#########################################################"
137
138
139
140
	@echo "# CHECK YOU HAVE ALL THE NEEDED MODULES:"
	@echo "#    * Check the required perl modules are installed:"
	@echo "#        $(sbindir)/sympa_wizard.pl --check"
	@echo "#"
141
142
143
144
	@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"
145
	@echo "#"
146
147
148
	@echo "# UPGRADING"
	@echo "#    * Run this script to upgrade your data structures:"
	@echo "#        $(sbindir)/sympa.pl --upgrade"
olivier.salaun's avatar
olivier.salaun committed
149
	@echo "#######################################################"
150
151

importantchanges:
152
153
	if test -f $(top_srcdir)/previous_sympa_version; then \
		export PREVIOUS=`$(CAT) $(top_srcdir)/previous_sympa_version`; \
154
	fi; \
155
156
157
	$(PERL) $(top_srcdir)/important_changes.pl \
		--current=$(VERSION) \
		--previous=$${PREVIOUS};
158
159

uninstall-hook:
160
161
	rm -f $(DESTDIR)$(confdir)/sympa.conf
	rm -f $(DESTDIR)$(confdir)/wwsympa.conf
162

163
META.json: META.json.pl Makefile src/lib/Sympa/ModDef.pm
164
165
166
	cd src/lib; $(MAKE) Sympa/Constants.pm
	$(PERL) META.json.pl > META.json

167
sympa.spec: sympa.spec.pl Makefile src/lib/Sympa/ModDef.pm
168
	cd src/lib; $(MAKE) Sympa/Constants.pm
169
170
	$(PERL) sympa.spec.pl > sympa.spec