Debian packages 2916 missing texmf
[freeside.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 # If set to a true value then MakeMaker's prompt function will
8 # always return the default without waiting for user input.
9 #export PERL_MM_USE_DEFAULT=1
10
11 PERL   ?= /usr/bin/perl
12 #PACKAGE = $(shell dh_listpackages)
13 PACKAGE = freeside
14 TMP     = $(CURDIR)/debian/$(PACKAGE)
15 #DBC_SCRIPTS = $(TMP)/usr/share/dbconfig-common/scripts/freeside
16
17 ##this is gotten from dbconfig-common
18 DB_TYPE = Pg
19
20 #Data source
21 DATASOURCE = DBI:${DB_TYPE}:dbname=freeside
22
23 #no chance, it doesn't get backslash-interpolted now...
24 ##DEBVERSION                    = `head -1 debian/changelog | cut -d')' -f1 | cut -c11-`
25 #DEBVERSION                    = 1.7.3~rc2-1
26 #export VERSION                = $(DEBVERSION) (Debian)
27
28 #export FREESIDE_CONF          = /etc/freeside
29 #export FREESIDE_LOG           = /var/log/freeside
30 #export FREESIDE_LOCK          = /var/lock/freeside
31 #export FREESIDE_CACHE         = $(TMP)/var/cache/freeside
32 #FREESIDE_CACHE         = $(TMP)/var/cache/freeside
33
34 #XXX huh?
35 #export FREESIDE_EXPORT        = /var/spool/freeside
36
37 export FREESIDE_CONF = $(TMP)/usr/local/etc/freeside
38 export FREESIDE_LOG = $(TMP)/usr/local/etc/freeside
39 export FREESIDE_LOCK = $(TMP)/usr/local/etc/freeside
40 export FREESIDE_CACHE = $(TMP)/usr/local/etc/freeside
41 export FREESIDE_EXPORT = $(TMP)/usr/local/etc/freeside
42 export FREESIDE_SS = $(TMP)/usr/share/docs/freeside
43 export DIST_CONF = ${FREESIDE_CONF}/default_conf
44
45 #XXX own subdir?
46 #export MASON_HANDLER          = /usr/share/freeside/handler.pl
47 export MASON_HANDLER=$(TMP)-webui/usr/local/etc/freeside/handler.pl
48
49 #export FREESIDE_DOCUMENT_ROOT = /usr/share/freeside/www
50 export FREESIDE_DOCUMENT_ROOT = $(TMP)-webui/var/www/freeside
51 export INIT_FILE              = $(TMP).init
52 export INIT_INSTALL           = /bin/true
53 export HTTPD_RESTART          = /bin/true
54 #export APACHE_CONF           = /etc/apache2/conf.d
55 export APACHE_CONF            = $(TMP)-webui/etc/freeside/apache2
56 export FREESIDE_RESTART       = /bin/true
57
58 #XXX root?
59 export INSTALLGROUP           = adm
60
61 export SELFSERVICE_MACHINES   = 
62
63 #prompt ?   XXX these are runtime, not buildtime :/
64 export RT_DOMAIN              =  freeside.biz
65 export RT_TIMEZONE            = US/Eastern
66 export HOSTNAME               = localhost
67 export FREESIDE_URL           = http://$(HOSTNAME)/freeside/
68
69 #specific to deb pkg, for purposes of saving off a permanent copy of default
70 #config for postinst and that sort of thing
71 #export DIST_CONF           = /usr/share/freeside/default_conf
72
73 #XXX yuck.  proper RT layout is entirely necessary
74 #this seems to infect way to much of RT with the build location, requiring
75 # a kludge to hack it out afterwords.  look into using fakeroot (didn't
76 # realize it would need to be explicit argh)
77 # (but leaving it for now, otherwise can't get RT to put files where we need em)
78 export RT_PATH                = $(TMP)/opt/rt3
79
80 # This has to be exported to make some magic below work.
81 export DH_OPTIONS
82
83 configure: configure-stamp
84 configure-stamp:
85         dh_testdir
86         # Add here commands to configure the package.
87         
88         touch configure-stamp
89
90
91 build: build-stamp
92 build-stamp: 
93         dh_testdir
94         # Add commands to compile the package here
95         
96         ( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor && $(MAKE) )
97         $(MAKE) perl-modules    
98         #install this for freeside-setup
99         install -d $(DIST_CONF)
100         install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
101
102         #TEST#
103
104         touch $@
105
106 clean:
107         dh_testdir
108         dh_testroot
109         dh_clean build-stamp install-stamp
110
111         # Add here commands to clean up after the build process.
112         $(MAKE) -e clean
113         #|| true #XXX freeside clean target fucked
114
115         dh_clean 
116
117 install: install-stamp
118 install-stamp: build-stamp
119         dh_testdir
120         dh_testroot
121         dh_clean -k
122         dh_installdirs
123
124         # Add here commands to install package into
125         # debian/<package>-whatever.
126
127         install -d $(FREESIDE_DOCUMENT_ROOT)
128         install -d $(TMP)-webui/usr/local/etc/freeside/
129         install -d $(TMP)/usr/local/etc/freeside/
130         install -d $(FREESIDE_CACHE)/masondata #MASONDATA
131 #       install -d $(TMP)-lib/usr/bin
132
133         ( cd FS/ && $(MAKE) -e DESTDIR=${TMP}-lib install)
134
135         # Install configuration files
136         install -d -o freeside ${FREESIDE_CONF}
137
138         touch ${FREESIDE_CONF}/secrets
139         chown freeside ${FREESIDE_CONF}/secrets
140         chmod 600 ${FREESIDE_CONF}/secrets
141
142         /bin/echo -e "${DATASOURCE}\n${DB_USER}\n${DB_PASSWORD}" >${FREESIDE_CONF}/secrets
143         chmod 600 ${FREESIDE_CONF}/secrets
144         chown freeside ${FREESIDE_CONF}/secrets
145
146         mkdir "${FREESIDE_CACHE}/counters.${DATASOURCE}"
147         chown freeside "${FREESIDE_CACHE}/counters.${DATASOURCE}"
148
149         mkdir "${FREESIDE_CACHE}/cache.${DATASOURCE}"
150         chown freeside "${FREESIDE_CACHE}/cache.${DATASOURCE}"
151
152         mkdir "${FREESIDE_EXPORT}/export.${DATASOURCE}"
153         chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
154
155         #install this for freeside-setup
156         install -d $(DIST_CONF)
157         #install conf/[a-z]* $(DEFAULT_CONF)
158         #CVS is not [a-z]
159         install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
160
161         # Install interfaces
162         $(MAKE) -e DESTDIR=$(TMP)-webui install-docs
163         
164         # Install tex
165         install -D -o freeside -m 444 etc/longtable.sty \
166         $(TMP)-lib/usr/local/share/texmf/tex/latex/longtable.sty
167         texhash $(TMP)-lib/usr/local/share/texmf
168
169         # Create Apache configurations
170         install -d $(APACHE_CONF)
171         $(MAKE) -e DESTDIR=$(APACHE_CONF) install-apache
172
173         #Hack the build dir out of apache config
174
175         perl -p -i -e "\
176          s'${TMP}(-webui)?''g;\
177         "  $(TMP)-webui/etc/freeside/apache2/*
178
179         # Install init
180         $(MAKE) -e DESTDIR=$(TMP) install-init
181
182         #hack the build dir out of Freeside too.  oh yeah, sucky.
183         perl -p -i -e "\
184           s'${TMP}(-webui)?''g;\
185         " ${TMP}/usr/local/etc/freeside/handler.pl \
186           ${TMP}/usr/share/perl5/FS/* \
187           ${TMP}/usr/share/perl5/FS/*/* \
188           ${TMP}/usr/bin/*
189
190         #hack the build dur out of lib
191         perl -p -i -e "\
192           s'${TMP}-lib?''g;\
193           s'${TMP}(-webui)?''g;\
194         " ${TMP}/usr/local/etc/freeside/handler.pl \
195           ${TMP}-lib/usr/share/perl5/FS/*.pm \
196           ${TMP}-lib/usr/share/perl5/FS/*/*.pm 
197         
198         #hack the build dir out of Freeside binaries
199
200         perl -p -i -e "\
201           s'${TMP}?''g;\
202         " ${TMP}-lib/usr/bin/* \
203           ${TMP}-webui/usr/local/etc/freeside/handler.pl
204
205         #RT Config
206
207         ( cd rt; \
208           cp config.layout.in config.layout; \
209           perl -p -i -e "\
210             s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
211             s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\
212           " config.layout; \
213           ./configure --prefix=${RT_PATH} \
214                 --enable-layout=Freeside \
215                 --with-db-type=Pg \
216                 --with-db-dba=freeside \
217                 --with-db-database=freeside \
218                 --with-db-rt-user=freeside \
219                 --with-db-rt-pass="" \
220                 --with-web-user=freeside \
221                 --with-web-group=freeside \
222                 --with-rt-group=freeside \
223                 --with-web-handler=modperl2 )
224
225         ##(create-rt)
226         #$(MAKE) -e DESTDIR=${TMP}-lib create-rt
227         install -d $(RT_PATH)
228         install -d $(RT_PATH)/share
229
230         ( cd rt; $(MAKE) install )
231         
232         ##hack the build dir out of RT.  yeah, sucky.
233
234         perl -p -i -e "\
235         s'${TMP}(-webui)''g;\
236         s'${TMP}''g;\
237         " ${TMP}/opt/rt3/etc/*.pm \
238                 ${TMP}/opt/rt3/lib/*.pm \
239                 ${TMP}/opt/rt3/lib/RT/*.pm \
240                 ${TMP}/opt/rt3/etc/upgrade/* \
241                 ${TMP}/opt/rt3/sbin/* \
242                 ${TMP}/opt/rt3/bin/* \
243
244         # Default RT Settings
245         perl -p -i -e "\
246                 s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
247                 s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
248                 s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
249                 " ${RT_PATH}/etc/RT_SiteConfig.pm
250
251         dh_install
252
253         #touch $@
254
255 binary-arch:
256 # We have nothing to do here for an architecture-independent package
257
258 binary-indep: build install
259         dh_testdir
260         dh_testroot
261         dh_installdeb install
262         dh_installdocs #freeside.docs README AGPL
263         dh_installexamples eg/*
264 #       dh_installmenu
265         dh_installdebconf       
266 #       dh_installlogrotate     
267         dh_installinit --no-start 
268         dh_installcron
269 #       dh_installinfo
270         dh_installman
271         dh_perl
272         dh_link
273         dh_compress 
274         dh_fixperms
275         dh_gencontrol
276         dh_md5sums
277         dh_builddeb
278
279 binary: binary-indep binary-arch
280 .PHONY: build clean binary-indep binary-arch binary install