4 # Uncomment this to turn on verbose mode.
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
12 #PACKAGE = $(shell dh_listpackages)
14 TMP = $(CURDIR)/debian/$(PACKAGE)
15 #DBC_SCRIPTS = $(TMP)/usr/share/dbconfig-common/scripts/freeside
17 ##this is gotten from dbconfig-common
21 DATASOURCE = DBI:${DB_TYPE}:dbname=freeside
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)
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
35 #export FREESIDE_EXPORT = /var/spool/freeside
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
43 export DIST_CONF = ${FREESIDE_CONF}/default_conf
46 #export MASON_HANDLER = /usr/share/freeside/handler.pl
47 export MASON_HANDLER=$(TMP)-webui/usr/local/etc/freeside/handler.pl
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
59 export INSTALLGROUP = adm
61 export SELFSERVICE_MACHINES =
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/
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
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
80 # This has to be exported to make some magic below work.
83 configure: configure-stamp
86 # Add here commands to configure the package.
94 # Add commands to compile the package here
96 ( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor && $(MAKE) )
99 ( cd fs_selfservice/FS-SelfService/ && $(PERL) Makefile.PL && $(MAKE) )
101 #install this for freeside-setup
102 install -d $(DIST_CONF)
103 install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
112 dh_clean build-stamp install-stamp
114 # Add here commands to clean up after the build process.
116 #|| true #XXX freeside clean target fucked
120 install: install-stamp
121 install-stamp: build-stamp
127 # Add here commands to install package into
128 # debian/<package>-whatever.
130 install -d $(FREESIDE_DOCUMENT_ROOT)
131 install -d $(TMP)-webui/usr/local/etc/freeside/
132 install -d $(TMP)-webui/etc/insserv/overrides/
133 install -d $(TMP)/usr/local/etc/freeside/
134 install -d $(FREESIDE_CACHE)/masondata #MASONDATA
135 # install -d $(TMP)-lib/usr/bin
137 ( cd FS/ && $(MAKE) -e DESTDIR=${TMP}-lib install)
139 # Install configuration files
140 install -d -o freeside ${FREESIDE_CONF}
142 touch ${FREESIDE_CONF}/secrets
143 chown freeside ${FREESIDE_CONF}/secrets
144 chmod 600 ${FREESIDE_CONF}/secrets
146 /bin/echo -e "${DATASOURCE}\n${DB_USER}\n${DB_PASSWORD}" >${FREESIDE_CONF}/secrets
147 chmod 600 ${FREESIDE_CONF}/secrets
148 chown freeside ${FREESIDE_CONF}/secrets
150 mkdir "${FREESIDE_CACHE}/counters.${DATASOURCE}"
151 chown freeside "${FREESIDE_CACHE}/counters.${DATASOURCE}"
153 mkdir "${FREESIDE_CACHE}/cache.${DATASOURCE}"
154 chown freeside "${FREESIDE_CACHE}/cache.${DATASOURCE}"
156 mkdir "${FREESIDE_EXPORT}/export.${DATASOURCE}"
157 chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
159 #install this for freeside-setup
160 install -d $(DIST_CONF)
161 #install conf/[a-z]* $(DEFAULT_CONF)
163 install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
166 $(MAKE) -e DESTDIR=$(TMP)-webui install-docs
169 install -D -o freeside -m 444 etc/longtable.sty \
170 $(TMP)-lib/usr/local/share/texmf/tex/latex/longtable.sty
171 texhash $(TMP)-lib/usr/local/share/texmf
173 # Create Apache configurations
174 install -d $(APACHE_CONF)
175 $(MAKE) -e DESTDIR=$(APACHE_CONF) install-apache
176 install -o root -m 755 init.d/insserv-override-apache2 $(TMP)-webui/etc/insserv/overrides/apache2
178 #Hack the build dir out of apache config
181 s'${TMP}(-webui)?''g;\
182 " $(TMP)-webui/etc/freeside/apache2/*
185 $(MAKE) -e DESTDIR=$(TMP) install-init
187 #hack the build dir out of Freeside too. oh yeah, sucky.
189 s'${TMP}(-webui)?''g;\
190 " ${TMP}/usr/local/etc/freeside/handler.pl \
191 ${TMP}/usr/share/perl5/FS/* \
192 ${TMP}/usr/share/perl5/FS/*/* \
195 #hack the build dur out of lib
198 s'${TMP}(-webui)?''g;\
199 " ${TMP}/usr/local/etc/freeside/handler.pl \
200 ${TMP}-lib/usr/share/perl5/FS/*.pm \
201 ${TMP}-lib/usr/share/perl5/FS/*/*.pm
203 #hack the build dir out of Freeside binaries
207 " ${TMP}-lib/usr/bin/* \
208 ${TMP}-webui/usr/local/etc/freeside/handler.pl
212 ( cd fs_selfservice/FS-SelfService/; $(MAKE) -e DESTDIR=${TMP}-selfservice-lib install )
213 install -d -o freeside -g freeside ${TMP}-selfservice-lib/usr/local/freeside
214 touch ${TMP}-selfservice-lib/usr/local/freeside/selfservice_socket
215 chown -R freeside ${TMP}-selfservice-lib/usr/local/freeside
216 chmod 600 ${TMP}-selfservice-lib/usr/local/freeside/selfservice_socket
218 install -d -o freeside -g freeside ${TMP}-selfservice-ui/var/www/
219 cp -R fs_selfservice/FS-SelfService/cgi ${TMP}-selfservice-ui/var/www/selfservice-DIST
220 chown freeside.freeside ${TMP}-selfservice-ui/var/www/selfservice-DIST/*.cgi ${TMP}-selfservice-ui/var/www/selfservice-DIST/*/*.cgi;
221 chmod 755 ${TMP}-selfservice-ui/var/www/selfservice-DIST/*.cgi ${TMP}-selfservice-ui/var/www/selfservice-DIST/*/*.cgi
225 install -d ${TMP}-ng-selfservice/var/www/
226 cp -R ng_selfservice ${TMP}-ng-selfservice/var/www/ng_selfservice-DIST/
231 cp config.layout.in config.layout; \
233 s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
234 s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\
236 ./configure --prefix=${RT_PATH} \
237 --enable-layout=Freeside \
239 --with-db-dba=freeside \
240 --with-db-database=freeside \
241 --with-db-rt-user=freeside \
242 --with-db-rt-pass="" \
243 --with-web-user=freeside \
244 --with-web-group=freeside \
245 --with-rt-group=freeside \
246 --with-web-handler=modperl2 )
249 #$(MAKE) -e DESTDIR=${TMP}-lib create-rt
250 install -d $(RT_PATH)
251 install -d $(RT_PATH)/share
253 ( cd rt; $(MAKE) install )
255 ##hack the build dir out of RT. yeah, sucky.
258 s'${TMP}(-webui)''g;\
260 " ${TMP}/opt/rt3/etc/*.pm \
261 ${TMP}/opt/rt3/lib/*.pm \
262 ${TMP}/opt/rt3/lib/RT/*.pm \
263 ${TMP}/opt/rt3/etc/upgrade/* \
264 ${TMP}/opt/rt3/sbin/* \
265 ${TMP}/opt/rt3/bin/* \
267 # Default RT Settings
269 s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
270 s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
271 s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
272 " ${RT_PATH}/etc/RT_SiteConfig.pm
279 # We have nothing to do here for an architecture-independent package
281 binary-indep: build install
284 dh_installdeb install
285 dh_installdocs #freeside.docs README AGPL
286 dh_installexamples eg/*
289 # dh_installlogrotate
290 dh_installinit --no-start
297 dh_fixperms -X/var/www/selfservice-DIST -X/usr/local/freeside
302 binary: binary-indep binary-arch
303 .PHONY: build clean binary-indep binary-arch binary install