Makefile 12.9 KB
Newer Older
root's avatar
root committed
1
2
3
4
5
6
7
## User Id and Group for Sympa (your httpd should have the same uid.gid)
USER	=	sympa
GROUP	=	sympa

## configuration file
CONFDIR	=	/etc

salaun's avatar
salaun committed
8
9
10
## LC_ALL is set to this ; required to compile NLS
LANG	=	fr_FR

root's avatar
root committed
11
12
13
14
15
16
17
18
##  Perl path
PERL	=	/usr/bin/perl

## For preparing samples
HOST		=	`$(PERL) -MSys::Hostname -e "printf '%s', Sys::Hostname::hostname();"`
COOKIE		=	`$(PERL) -e " print int(rand ( time ))  "`
PERL_VERSION	=	`$(PERL) -e ' print $$]'`

salaun's avatar
salaun committed
19
SYMPA_VERSION	=	'3.2.1'
root's avatar
root committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#SYMPA_VERSION	=	`pwd | $(PERL) -e 'my @version = split /-/, <STDIN>; printf "%s", $$version[1];'`

## Root directory for Sympa ; use absolute path.
## Binaries are located under $DIR/bin ; this directory needs to be
## readable for everyone ; `queue' needs to be executable 
## You can also set DESTDIR to the place where everything should be
## installed (usefull for packagers of Sympa)
DIR	=	/home/sympa

## PID location
PIDDIR	=	/home/sympa

## Both queue and bouncequeue are lunched by sendmail. If sendmail
## is configured to used smrsh (check the mailer prog definition), thoses
## files needs to be installed in /etc/smrsh.  
MAILERPROGDIR	=	$(DIR)/bin

#RPMTOPDIR	=	`rpm --eval %_topdir`
RPMTOPDIR	=	/usr/src/redhat

salaun's avatar
salaun committed
41
42
MANDIR		=	/usr/local/man

root's avatar
root committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
## SYSV init scripts directory
INITDIR		=	$(DIR)/bin

BINDIR		=	$(DIR)/bin

## Spools directory
SPOOLDIR	=	$(DIR)/spool

## Directory for installing WWSympa
WWSBINDIR	=	$(BINDIR)

# Chose your prefered color.
#
DARK_COLOR	=	'\#330099'
LIGHT_COLOR	=	'\#ccccff'
TEXT_COLOR	=	'\#000000' 
BG_COLOR	=	'\#ffffff'
ERROR_COLOR	=	'\#ff6666'
SELECTED_COLOR	=	'\#3366cc'
salaun's avatar
salaun committed
62
SHADED_COLOR	=	'\#eeeeee'
root's avatar
root committed
63
64
65
66

## Target directory for installing Icons
ICONSDIR	=	/home/httpd/icons

67
68
69
70
71
72
73
74
75
76
## Path to newaliases command (or what else may be called to rebuild
## Mail aliases database)
NEWALIASES    =       /usr/bin/newaliases

## The sendmail aliases file we use. Better use a seperate one for sympa.
## Of cause a extra alias file must be generated with proper permissions
## (owner sympa, write access for sympa, no write access for anyone else)
## and declared in sendmail.cf!
SENDMAIL_ALIASES=     /etc/mail/sympa_aliases

root's avatar
root committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
## Path to gencat program (creates the .cat catalog file using the .msg)
GENCAT	= 	/usr/bin/gencat

## Path to OpenSSL
OPENSSL	=	/usr/local/ssl/bin/openssl
SSLCERTDIR =	--DIR--/expl/X509-user-certs

SH	=	/bin/sh
CC	=	gcc
CFLAGS	=	-g

# Aix4.2 (and some others unix), use gnu make !
MAKE	=	make

##---------- STOP ---------- STOP ---------- STOP ---------- STOP ----------

CONFIG		=	$(CONFDIR)/sympa.conf
WWSCONFIG	=	$(CONFDIR)/wwsympa.conf
ETCBINDIR	=	$(BINDIR)/etc
NLSDIR		=	$(DIR)/nls

#ifeq ($(shell uname), Linux)
#	LOG_SOCKET_TYPE="inet"
#else
LOG_SOCKET_TYPE	=	"unix"
#endif

104
all:	checkcpan sources languages checkperl man
root's avatar
root committed
105
106
107
108

rpm: build_rh_rpm build_mdk_rpm

checkperl:
salaun's avatar
salaun committed
109
110
111
112
113
114
	@echo "#######################################"
	@echo "## Database structure has been extended"
	@echo "## You need to run the following command on your database :"
	@echo "## ALTER TABLE subscriber_table ADD comment_subscriber varchar (150);"
	@echo "## ";
	@echo "## Then run $(BINDIR)/init_comment.pl"
root's avatar
root committed
115
116
	@if [ $(PERL_VERSION) = '5.006' ]; then \
	echo "##################################"; \
salaun's avatar
salaun committed
117
	echo "## You are using Perl version $(PERL_VERSION) :"; \
root's avatar
root committed
118
119
120
121
122
123
124
125
	echo "## You need to patch your syslog.pm "; \
	echo "## See http://bugs.perl.org/perlbug.cgi?req=bidmids&bidmids=20000712.003"; \
	echo "##"; \
	echo "## If your Perl version is 5.6.0 AND if your system is Solaris :"; \
	echo "## See also http://bugs.perl.org/perlbug.cgi?req=bidmids&bidmids=20000522.003"; \
	echo "#############################################################################"; \
	fi

126
sources: src/Makefile src/queue.c src/bouncequeue.c
root's avatar
root committed
127
128
129
130
131
132
	@echo "Making src"
	(cd src && echo "making in src..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' \
	DIR='${DIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' \
	MAILERPROGDIR='${MAILERPROGDIR}' ETCBINDIR='${ETCBINDIR}' \
	CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' \
133
134
	USER='${USER}' GROUP='${GROUP}' \
	SENDMAIL_ALIASES='${SENDMAIL_ALIASES}' NEWALIASES='${NEWALIASES}');
root's avatar
root committed
135

136
doc: doc/sympa.tex.tpl doc/Makefile 
root's avatar
root committed
137
138
139
140
141
142
143
144
	@echo "Making doc"
	(cd doc && echo "making in doc..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' \
	DIR='${DIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' \
	MAILERPROGDIR='${MAILERPROGDIR}' ETCBINDIR='${ETCBINDIR}' \
	CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' \
	USER='${USER}' GROUP='${GROUP}');

145
146
147
148
149
man: doc/man8/Makefile
	@echo "Making man"
	(cd doc/man8 && echo "making in doc/man8/..." && \
	$(MAKE) SYMPA_VERSION='$(SYMPA_VERSION)');

root's avatar
root committed
150
151
languages:
	@echo "Making nls"
salaun's avatar
salaun committed
152
	(LC_ALL=$(LANG); export LC_ALL; cd nls && echo "making in nls..." && \
root's avatar
root committed
153
154
155
156
157
158
159
160
161
162
	$(MAKE) SH='${SH}' PERL='${PERL}' ETCBINDIR='${ETCBINDIR}' \
	DIR='${DIR}' NLSDIR='${NLSDIR}' BINDIR='${BINDIR}' \
	USER='${USER}' GROUP='${GROUP}' GENCAT='${GENCAT}');

checkcpan: 
	@echo "Checking needed CPAN modules ..."
	$(PERL) ./check_perl_modules.pl

clean:
	find . \( -name ".#*" -o -name "*~" -o -name ".*~" -o -name "#*#" \) -exec  rm -f {} \;
163
	@for i in src nls wwsympa src/etc/sample;\
root's avatar
root committed
164
165
166
167
168
	do \
	(cd $$i && echo "making clean in $$i..." && \
	$(MAKE) PERL='${PERL}' clean) || exit 1; \
	done;

169
170
171
172
173
174
175
176
177
178
install: importantchanges installsrc installnls installwws installman installscript installsample installdir installconfig

importantchanges:
	( 	PERL=$(PERL); export PERL; \
		UMASK=0600; export UMASK; \
		BINDIR=$(BINDIR); export BINDIR; \
		SYMPA_VERSION=$(SYMPA_VERSION); export SYMPA_VERSION; \
		$(PERL) ./important_changes.pl \
	) ;\

root's avatar
root committed
179
180
181
182
183
184
185

installsrc:
	(cd src && echo "making in src..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' SYMPA_VERSION='${SYMPA_VERSION}' \
	DIR='${DIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' MAILERPROGDIR='${MAILERPROGDIR}' \
	DESTDIR='${DESTDIR}' DARK_COLOR='${DARK_COLOR}' LIGHT_COLOR='${LIGHT_COLOR}' \
	TEXT_COLOR='${TEXT_COLOR}' BG_COLOR='${BG_COLOR}' ERROR_COLOR='${ERROR_COLOR}' \
186
187
	SHADED_COLOR='${SHADED_COLOR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' \
	ETCBINDIR='${ETCBINDIR}' SENDMAIL_ALIASES='${SENDMAIL_ALIASES}' \
root's avatar
root committed
188
189
190
191
192
193
194
	USER='${USER}' GROUP='${GROUP}' newinstall) || exit 1;

installnls:
	(cd nls && echo "making in nls..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' \
	DIR='${DIR}' NLSDIR='${NLSDIR}' ETCBINDIR='${ETCBINDIR}' \
	DESTDIR='${DESTDIR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' \
195
	SENDMAIL_ALIASES='${SENDMAIL_ALIASES}' \
root's avatar
root committed
196
197
198
199
200
201
202
203
	USER='${USER}' GROUP='${GROUP}' GENCAT='${GENCAT}' newinstall) || exit 1;

installwws:
	(cd wwsympa && echo "making in wwsympa..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' \
	DIR='${DIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' MAILERPROGDIR='${MAILERPROGDIR}' \
	CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' ETCBINDIR='${ETCBINDIR}' \
	DESTDIR='${DESTDIR}' DARK_COLOR='${DARK_COLOR}' LIGHT_COLOR='${LIGHT_COLOR}' \
salaun's avatar
salaun committed
204
	TEXT_COLOR='${TEXT_COLOR}' BG_COLOR='${BG_COLOR}' SHADED_COLOR='${SHADED_COLOR}' \
root's avatar
root committed
205
206
207
208
209
210
211
212
213
	ERROR_COLOR='${ERROR_COLOR}' SELECTED_COLOR='${SELECTED_COLOR}' \
	USER='${USER}' GROUP='${GROUP}' ICONSDIR='${ICONSDIR}' newinstall) || exit 1;

installsample:
	(cd src/etc/sample && echo "making in src/etc/sample..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' LOG_SOCKET_TYPE='${LOG_SOCKET_TYPE}' \
	DESTDIR='${DESTDIR}' DIR='${DIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' HOST='${HOST}' \
	CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' ETCBINDIR='${ETCBINDIR}' MAILERPROGDIR='${MAILERPROGDIR}' \
	DARK_COLOR='${DARK_COLOR}' LIGHT_COLOR='${LIGHT_COLOR}' COOKIE='${COOKIE}' \
salaun's avatar
salaun committed
214
	SHADED_COLOR='${SHADED_COLOR}' OPENSSL='${OPENSSL}' SSLCERTDIR='${SSLCERTDIR}' \
root's avatar
root committed
215
216
217
	SPOOLDIR='${SPOOLDIR}' TEXT_COLOR='${TEXT_COLOR}' BG_COLOR='${BG_COLOR}' ERROR_COLOR='${ERROR_COLOR}' \
	USER='${USER}' GROUP='${GROUP}' ICONSDIR='${ICONSDIR}' PIDDIR='${PIDDIR}' install) || exit 1;

salaun's avatar
salaun committed
218
219
220
installman:
	mkdir -p $(DESTDIR)$(MANDIR)
	mkdir -p $(DESTDIR)$(MANDIR)/man8
221
	@for manfile in sympa.8 archived.8 bounced.8 alias_manager.8; do \
salaun's avatar
salaun committed
222
223
224
225
226
227
228
229
230
231
	echo "Installing man file man8/$$manfile..."; \
	( \
		cd doc/man8 ; \
		PERL=$(PERL); export PERL; \
		UMASK=0600; export UMASK; \
		DIR=$(DIR); export DIR; \
		INSTALLDIR=$(MANDIR)/man8; export INSTALLDIR; \
		DESTDIR=$(DESTDIR); export DESTDIR; \
		SYMPA_VERSION=$(SYMPA_VERSION); export SYMPA_VERSION; \
		CONFDIR=$(CONFDIR); export CONFDIR; \
232
233
234
235
		SENDMAIL_ALIASES=$(SENDMAIL_ALIASES); export SENDMAIL_ALIASES; \
		MAILERPROGDIR=$(MAILERPROGDIR); export MAILERPROGDIR; \
		PIDDIR=$(PIDDIR); export PIDDIR; \
		SPOOLDIR=$(SPOOLDIR); export SPOOLDIR; \
salaun's avatar
salaun committed
236
237
238
239
240
241
242
243
		PIDDIR=$(PIDDIR); export PIDDIR; \
		$(PERL) ../../subst.pl $$manfile \
	) ;\
	chown $(USER) $(DESTDIR)$(MANDIR)/man8/$$manfile; \
	chgrp $(GROUP) $(DESTDIR)$(MANDIR)/man8/$$manfile; \
	done


root's avatar
root committed
244
245
246
247
248
249
250
251
installscript:
	(cd src/etc/script && echo "making in src/etc/script..." && \
	$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' \
	DIR='${DIR}' DESTDIR='${DESTDIR}' BINDIR='${BINDIR}' WWSBINDIR='${WWSBINDIR}' HOST='${HOST}' \
	CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' ETCBINDIR='${ETCBINDIR}' \
	MAILERPROGDIR='${MAILERPROGDIR}' \
	DARK_COLOR='${DARK_COLOR}' LIGHT_COLOR='${LIGHT_COLOR}' COOKIE='${COOKIE}' INITDIR='${INITDIR}' \
	TEXT_COLOR='${TEXT_COLOR}' BG_COLOR='${BG_COLOR}' ERROR_COLOR='${ERROR_COLOR}' OPENSSL='${OPENSSL}' \
salaun's avatar
salaun committed
252
	SHADED_COLOR='${SHADED_COLOR}' USER='${USER}' GROUP='${GROUP}' ICONSDIR='${ICONSDIR}' install) || exit 1;
root's avatar
root committed
253
254
255


installdir:
256
257
258
	echo "Setting $(USER) owner of $(DESTDIR)$(DIR)"
	chown $(USER) $(DESTDIR)$(DIR)
	chgrp $(GROUP) $(DESTDIR)$(DIR)
root's avatar
root committed
259
	@if [ ! -f $(DESTDIR)$(CONFDIR)/sympa.conf ] ; then \
260
	echo "First installation : installing directories..."; \
root's avatar
root committed
261
262
263
264
265
266
267
268
269
270
	for dir in expl etc sample ; do \
		if [ ! -d $(DESTDIR)$(DIR)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(DIR)/$$dir"; \
			mkdir -p $(DESTDIR)$(DIR)/$$dir; \
			chown $(USER) $(DESTDIR)$(DIR)/$$dir; \
			chgrp $(GROUP) $(DESTDIR)$(DIR)/$$dir; \
		fi \
	done \
	fi
	@if [ ! -f $(DESTDIR)$(CONFDIR)/sympa.conf ] ; then \
271
	echo "First installation : installing conf directories..."; \
root's avatar
root committed
272
273
274
275
276
277
278
279
280
281
	for dir in etc/create_list_templates etc/templates etc/wws_templates etc/scenari ; do \
		if [ ! -d $(DESTDIR)$(DIR)/$$dir ] ; then \
			echo "Creating $(DESTDIR)$(DIR)/$$dir"; \
			mkdir -p $(DESTDIR)$(DIR)/$$dir; \
			chown $(USER) $(DESTDIR)$(DIR)/$$dir; \
			chgrp $(GROUP) $(DESTDIR)$(DIR)/$$dir; \
		fi \
	done \
	fi
	@if [ ! -f $(DESTDIR)$(CONFDIR)/sympa.conf ] ; then \
282
	echo "First installation : installing spool directories..."; \
root's avatar
root committed
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
	for dir in $(SPOOLDIR) $(SPOOLDIR)/msg $(SPOOLDIR)/digest $(SPOOLDIR)/moderation \
	$(SPOOLDIR)/expire $(SPOOLDIR)/auth $(SPOOLDIR)/outgoing $(SPOOLDIR)/tmp ; do \
		if [ ! -d $(DESTDIR)$$dir ] ; then \
			echo "Creating $(DESTDIR)$$dir"; \
			mkdir -p $(DESTDIR)$$dir; \
			chown $(USER) $(DESTDIR)$$dir; \
			chgrp $(GROUP) $(DESTDIR)$$dir; \
			chmod 770 $(DESTDIR)$$dir; \
		fi \
	done \
	fi

installconfig:
	mkdir -p $(DESTDIR)$(CONFDIR)
	@for cfile in sympa.conf wwsympa.conf ; do \
	if [ ! -f $(DESTDIR)$(CONFDIR)/$$cfile ] ; then \
	echo "Installing sample config file $$cfile..."; \
	( \
		cd src/etc/sample/ ; \
		PERL=$(PERL); export PERL; \
		UMASK=0600; export UMASK; \
		DIR=$(DIR); export DIR; \
		INSTALLDIR=$(CONFDIR); export INSTALLDIR; \
		DESTDIR=$(DESTDIR); export DESTDIR; \
		BINDIR=$(BINDIR); export BINDIR; \
		ETCBINDIR=$(ETCBINDIR); export ETCBINDIR; \
		CONFIG=$(CONFIG); export CONFIG; \
		LOG_SOCKET_TYPE=$(LOG_SOCKET_TYPE); export LOG_SOCKET_TYPE; \
		COOKIE=$(COOKIE); export COOKIE; \
		HOST=$(HOST); export HOST; \
		OPENSSL=$(OPENSSL); export OPENSSL ; \
		SSLCERTDIR=$(SSLCERTDIR); export SSLCERTDIR ; \
315
316
		PIDDIR=$(PIDDIR); export PIDDIR; \
		SPOOLDIR=$(SPOOLDIR); export SPOOLDIR; \
root's avatar
root committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
		$(PERL) ../../../subst.pl $$cfile \
	) ;\
	chown $(USER) $(DESTDIR)$(CONFDIR)/$$cfile; \
	chgrp $(GROUP) $(DESTDIR)$(CONFDIR)/$$cfile; \
	fi \
	done

build_rh_rpm: clean
	@echo "Building RedHat RPM in $(RPMTOPDIR) ..."
	@( \
		cd src/etc/script/ ; \
		PERL=$(PERL); export PERL; \
		UMASK=0600; export UMASK; \
		INSTALLDIR=$(RPMTOPDIR)/SPECS; export INSTALLDIR; \
		SUFFIX=''; export SUFFIX; \
		ZIPEXT='gz'; export ZIPEXT; \
		APPGROUP='System Environment/Daemons'; export APPGROUP; \
		HOMEDIR='/home/sympa'; export HOMEDIR; \
		VERSION=$(SYMPA_VERSION); export VERSION; \
		$(PERL) ../../../subst.pl sympa.spec \
	)
	@( \
		cd ..; \
		tar -cvf $(RPMTOPDIR)/SOURCES/sympa-$(SYMPA_VERSION).tar sympa-$(SYMPA_VERSION); \
		gzip $(RPMTOPDIR)/SOURCES/sympa-$(SYMPA_VERSION).tar; \
	)
	rpm -ba $(RPMTOPDIR)/SPECS/sympa.spec

build_mdk_rpm: clean
	@echo "Building Mandrake RPM in $(RPMTOPDIR) ..."
	@( \
		cd src/etc/script/ ; \
		PERL=$(PERL); export PERL; \
		UMASK=0600; export UMASK; \
		INSTALLDIR=$(RPMTOPDIR)/SPECS; export INSTALLDIR; \
		SUFFIX='mdk'; export SUFFIX; \
		ZIPEXT='bz2'; export ZIPEXT; \
		APPGROUP='System/Servers'; export APPGROUP; \
		HOMEDIR='/var/lib/sympa'; export HOMEDIR; \
		VERSION=$(SYMPA_VERSION); export VERSION; \
		$(PERL) ../../../subst.pl sympa.spec \
	)
	@( \
		cd ..; \
		tar -cvf $(RPMTOPDIR)/SOURCES/sympa-$(SYMPA_VERSION).tar sympa-$(SYMPA_VERSION); \
		bzip2 $(RPMTOPDIR)/SOURCES/sympa-$(SYMPA_VERSION).tar; \
	)
	rpm -ba $(RPMTOPDIR)/SPECS/sympa.spec