2
2
# Based on the Remi Perrot's one, done for
5
# Make sure it's the same in
8
# + maintenance/checksetup_debian.sh
9
# + debian/bugzilla3.{pre,post}{inst,rm}
10
export BUGZILLA_PKGDIR := $(CURDIR)/debian/bugzilla3
11
export BUGZILLA_ETCDIR := $(BUGZILLA_PKGDIR)/etc/bugzilla3
12
export BUGZILLA_VARDIR := $(BUGZILLA_PKGDIR)/var/lib/bugzilla3
13
export BUGZILLA_DATADIR := $(BUGZILLA_VARDIR)/data
14
export BUGZILLA_SHAREDIR := $(BUGZILLA_PKGDIR)/usr/share/bugzilla3
15
export BUGZILLA_WEBDIR := $(BUGZILLA_PKGDIR)/usr/share/bugzilla3/web
16
export BUGZILLA_CONTRIBDIR := $(BUGZILLA_SHAREDIR)/contrib
17
export BUGZILLA_TEMPLATEDIR := $(BUGZILLA_VARDIR)/template
18
export BUGZILLA_COMPILEDTEMPLATEDIR := $(BUGZILLA_DATADIR)/template
19
export BUGZILLA_EXTENSIONSDIR := $(BUGZILLA_VARDIR)/extensions
6
22
# For a better maintenance, we'll create by hand each
7
23
# bugzilla's sub directories.
9
BUGZILLA_PERLDIR= $(DESTDIR)/usr/share/perl5
10
BUGZILLA_CONFIG = $(DESTDIR)/etc/bugzilla3
11
BUGZILLA_ROOT = $(DESTDIR)/usr/share/bugzilla3
12
BUGZILLA_WWW = $(BUGZILLA_ROOT)/web
24
BUGZILLA_PERLDIR= $(BUGZILLA_PKGDIR)/usr/share/perl5
25
BUGZILLA_WWW = $(BUGZILLA_SHAREDIR)/web
13
26
BUGZILLA_CGIDIR = $(BUGZILLA_WWW)
14
BUGZILLA_LIBDIR = $(BUGZILLA_ROOT)
15
BUGZILLA_VARDIR = $(DESTDIR)/var/lib/bugzilla3
16
BUGZILLA_DATADIR = $(DESTDIR)/var/lib/bugzilla3/data
17
BUGZILLA_CONTRIB= $(BUGZILLA_ROOT)/contrib
27
BUGZILLA_CONTRIB= $(BUGZILLA_SHAREDIR)/contrib
19
29
PKGVER := $(shell dpkg-parsechangelog |grep Version: |sed -e 's,Version: \([^-]\+\).*,\1,g')
20
30
ORIGTARGZ := bugzilla_$(PKGVER).orig.tar.gz
25
35
pl_files = runtests.pl
26
lib_perlscripts = checksetup.pl collectstats.pl email_in.pl importxml.pl mod_perl.pl testserver.pl whineatnews.pl whine.pl sanitycheck.pl
28
37
static_files = *.dtd *.txt
30
39
# Where to find the sources.
31
BUGZILLA_TAR := $(shell ls -1 bugzilla-?.?.tar.gz bugzilla-?.?.?.tar.gz bugzilla-?.?.??.tar.gz 2>/dev/null| head -n 1)
32
BUGZILLA_TARDIR := $(subst .tar.gz,,$(BUGZILLA_TAR))
33
40
BUGZILLA_SRCDIR = bugzilla-srcdir
35
BUGZILLA_DE = $(shell ls -1 germzilla-*.tar.gz | head -n 1)
36
#BUGZILLA_BE = $(shell ls -1 bugzilla-be-*.tar.gz | head -n 1)
37
#BUGZILLA_BG = $(shell ls -1 bugzilla-bg-*.tar.bz2 | head -n 1) // bugzilla-bg-3.4.4.tar.bz2
38
BUGZILLA_FR = $(shell ls -1 bugzilla-*.fr.tar.gz | head -n 1)
39
BUGZILLA_RU = $(shell ls -1 bugzilla-*-ru-*.tar.gz | head -n 1)
40
BUGZILLA_CS = $(shell ls -1 bugzilla.cs.*.tar.gz | head -n 1)
41
BUGZILLA_JA = $(shell ls -1 bugzilla-ja-*.tar.bz2 | head -n 1)
42
BUGZILLA_ZH = $(shell ls -1 bugzilla.zh-TW.*.tar.gz | head -n 1)
44
42
INSTALL = /usr/bin/install
46
44
extractsrc: $(BUGZILLA_SRCDIR)/checksetup.pl
47
$(BUGZILLA_SRCDIR)/checksetup.pl: $(BUGZILLA_TAR)
48
tar -xzf $(BUGZILLA_TAR)
49
test -d $(BUGZILLA_TARDIR)
50
tar -C $(BUGZILLA_TARDIR)/template -xzf $(BUGZILLA_DE)
51
test -d $(BUGZILLA_TARDIR)/template/de/default
52
find $(BUGZILLA_TARDIR)/template/de -name gzversion.html.tmpl -exec cp /dev/null {} \;
53
tar -C $(BUGZILLA_TARDIR) -xzf $(BUGZILLA_FR)
54
test -d $(BUGZILLA_TARDIR)/template/fr/default
55
: #tar -C $(BUGZILLA_TARDIR) --transform "s/bugzilla[^\/]\+\///g" -xzf $(BUGZILLA_BE)
56
: #test -d $(BUGZILLA_TARDIR)/template/be/default
57
tar -C $(BUGZILLA_TARDIR) -xzf $(BUGZILLA_RU)
58
test -d $(BUGZILLA_TARDIR)/template/ru/default
59
: #tar -C $(BUGZILLA_TARDIR) -xjf $(BUGZILLA_BG)
60
: #test -d $(BUGZILLA_TARDIR)/template/bg/default
61
tar -C $(BUGZILLA_TARDIR)/template --transform "s/template//g" -xzf $(BUGZILLA_CS)
62
test -d $(BUGZILLA_TARDIR)/template/cs/default
63
$(INSTALL) -d $(BUGZILLA_TARDIR)/template/ja
64
tar -C $(BUGZILLA_TARDIR)/template/ja -xjf $(BUGZILLA_JA)
65
test -d $(BUGZILLA_TARDIR)/template/ja/default
66
tar -C $(BUGZILLA_TARDIR) --transform "s/bugzilla-tw//g" -xzf $(BUGZILLA_ZH)
67
test -d $(BUGZILLA_TARDIR)/template/zh-TW/default
68
find $(BUGZILLA_TARDIR)/template -name "*.tmpl" -exec chmod a-x {} \;
69
-find $(BUGZILLA_TARDIR)/template -name ".cvsignore" -or -name "CVS" -or -name ".svn" -exec rm -rf {} \;
70
find $(BUGZILLA_TARDIR)/template -maxdepth 1 -mindepth 1 -and -not -name "en" -and -not -name "de" -and -not -name "fr" -and -not -name "ja" -and -not -name "cs" -and -not -name "zh-TW" -and -not -name "ru" -type d -exec rm -rf {} \;
71
rm -rf $(BUGZILLA_SRCDIR)
72
mv -f $(BUGZILLA_TARDIR) $(BUGZILLA_SRCDIR)
45
$(BUGZILLA_SRCDIR)/checksetup.pl:
46
$(PWD)/debian/create-bugzilla-srcdir
74
49
install: install_static_dirs install_static_files install_lib_files \
75
install_cgi install_template install_contrib
78
install_fr_FIXME: extractsrc
79
@echo "Extracting french templates"
80
$(INSTALL) -d $(BUGZILLA_ROOT)/template
81
tar zxf l10n/fr.tar.gz -C $(BUGZILLA_ROOT)/template
50
install_cgi install_template install_contrib install_extensions
84
53
install_contrib: extractsrc
85
mkdir -p $(BUGZILLA_CONTRIB)
54
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_CONTRIB)
86
55
cp -av $(BUGZILLA_SRCDIR)/contrib/* $(BUGZILLA_CONTRIB)
87
56
grep -rl "^#\!.*/bin/.*" $(BUGZILLA_CONTRIB) | xargs chmod a+x
59
install_extensions: extractsrc
60
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_EXTENSIONSDIR)
61
cd $(BUGZILLA_SRCDIR) && for this_dir in `find extensions -type d` ; do \
62
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_VARDIR)/$$this_dir ;\
64
cd $(BUGZILLA_SRCDIR) && for this_file in `find extensions -type f` ; do \
65
$(INSTALL) -m 0644 -o root -g root $$this_file $(BUGZILLA_VARDIR)/`dirname $$this_file` ;\
89
69
install_static_dirs: extractsrc
90
70
cd $(BUGZILLA_SRCDIR) && for this_dir in `find skins -type d` ; do \
91
71
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_WWW)/$$this_dir ;\
125
105
install_lib_files: extractsrc
126
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0644 -o root -g root $(lib_files) $(BUGZILLA_ROOT)
127
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0755 -o root -g root $(pl_files) $(BUGZILLA_ROOT)
128
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_ROOT)/lib
129
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0755 -o root -g root $(lib_perlscripts) $(BUGZILLA_ROOT)/lib
106
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0644 -o root -g root $(lib_files) $(BUGZILLA_SHAREDIR)
107
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0755 -o root -g root $(pl_files) $(BUGZILLA_SHAREDIR)
108
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_SHAREDIR)/lib
109
cd $(BUGZILLA_SRCDIR) && $(INSTALL) -m 0755 -o root -g root *.pl $(BUGZILLA_SHAREDIR)/lib
130
110
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_PERLDIR)
131
111
cd $(BUGZILLA_SRCDIR) && for this_dir in `find $(lib_dir) -type d` ; do \
132
112
$(INSTALL) -d -m 0755 -o root -g root $(BUGZILLA_PERLDIR)/$$this_dir ;\