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
18 DB_TYPE = db_type_is_configured_during_pkg_install_by_dbconfig-common_not_at_build_time
20 #no chance, it doesn't get backslash-interpolted now...
21 #DEBVERSION = `head -1 debian/changelog | cut -d')' -f1 | cut -c11-`
22 DEBVERSION = 1.7.3~rc2-1
23 export VERSION = $(DEBVERSION) (Debian)
25 export FREESIDE_CONF = /etc/freeside
26 export FREESIDE_LOG = /var/log/freeside
27 export FREESIDE_LOCK = /var/lock/freeside
28 export FREESIDE_CACHE = $(TMP)/var/cache/freeside
29 FREESIDE_CACHE = $(TMP)/var/cache/freeside
32 export FREESIDE_EXPORT = /var/spool/freeside
35 export MASON_HANDLER = $(TMP)-webui/usr/share/freeside/handler.pl
37 export APACHE_VERSION = 2
38 export FREESIDE_DOCUMENT_ROOT = $(TMP)-webui/usr/share/freeside/www
39 export INIT_FILE = $(TMP).init
40 export INIT_INSTALL = /bin/true
41 export HTTPD_RESTART = /bin/true
42 #export APACHE_CONF = $(TMP)-webui/etc/apache2/conf.d
43 export APACHE_CONF = $(TMP)-webui/etc/freeside/apache2
44 export FREESIDE_RESTART = /bin/true
47 export INSTALLGROUP = adm
49 export SELFSERVICE_MACHINES =
51 #prompt ? XXX these are runtime, not buildtime :/
52 export RT_DOMAIN = `dnsdomainname`
53 export RT_TIMEZONE = `cat /etc/timezone`
55 export HOSTNAME = `hostname -f`
56 export FREESIDE_URL = http://$(HOSTNAME)/freeside/
58 #specific to deb pkg, for purposes of saving off a permanent copy of default
59 #config for postinst and that sort of thing
60 export DIST_CONF = $(TMP)/usr/share/freeside/default_conf
62 #XXX yuck. proper RT layout is entirely necessary
63 #this seems to infect way to much of RT with the build location, requiring
64 # a kludge to hack it out afterwords. look into using fakeroot (didn't
65 # realize it would need to be explicit argh)
66 # (but leaving it for now, otherwise can't get RT to put files where we need em)
67 export RT_PATH = $(TMP)/var/opt/freeside/rt
69 # This has to be exported to make some magic below work.
72 configure: configure-stamp
75 # Add here commands to configure the package.
83 # Add commands to compile the package here
85 ( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor )
87 $(MAKE) -e perl-modules
96 dh_clean build-stamp install-stamp
98 # Add here commands to clean up after the build process.
100 #|| true #XXX freeside clean target fucked
104 install: install-stamp
105 install-stamp: build-stamp
111 # Add here commands to install package into
112 # debian/<package>-whatever.
113 ( cd FS/ && $(MAKE) -e DESTDIR=$(TMP)-lib install )
115 #false laziness w/install-perl-modules now
116 #install this for postinst later (no create-config)
117 install -d $(DIST_CONF)
118 #install conf/[a-z]* $(DEFAULT_CONF)
120 install `ls -d conf/[a-z]* | grep -v CVS` $(DIST_CONF)
122 install -d $(FREESIDE_DOCUMENT_ROOT)
123 install -d $(FREESIDE_CACHE)/masondata #MASONDATA
124 $(MAKE) -e install-docs
126 #hack the build dir out of Freeside too. oh yeah, sucky.
128 s'${TMP}(-webui)?''g;\
129 " ${TMP}-webui/usr/share/freeside/handler.pl \
130 ${TMP}/usr/share/perl5/FS/* \
131 ${TMP}/usr/share/perl5/FS/*/* \
134 rm -r $(FREESIDE_DOCUMENT_ROOT).*
136 install -d $(APACHE_CONF)
137 install debian/freeside.apache-alias.conf $(APACHE_CONF)/freeside-alias.conf
138 FREESIDE_DOCUMENT_ROOT=/usr/share/freeside/www MASON_HANDLER=/usr/share/freeside/handler.pl FREESIDE_CONF=/etc/freeside $(MAKE) -e install-apache
140 $(MAKE) -e install-init
145 # XXX need to adjust db-type, db-database, db-rt-user, db-rt-pass
146 # based on info from dbc
148 cp config.layout.in config.layout; \
150 s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
151 s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\
153 ./configure --prefix=${RT_PATH} \
154 --enable-layout=Freeside \
156 --with-db-dba=freeside \
157 --with-db-database=_DBC_DBNAME_ \
158 --with-db-rt-user=_DBC_DBUSER_ \
159 --with-db-rt-pass=_DBC_DBPASS_ \
160 --with-web-user=freeside \
161 --with-web-group=freeside \
162 --with-rt-group=freeside \
166 install -d $(RT_PATH)
167 ( cd rt; make install )
168 #hack the build dir out of RT. yeah, sucky.
171 " ${RT_PATH}/etc/RT_Config.pm \
172 ${RT_PATH}/lib/RT.pm \
173 ${RT_PATH}/bin/mason_handler.fcgi \
174 ${RT_PATH}/bin/mason_handler.scgi \
175 ${RT_PATH}/bin/standalone_httpd \
176 ${RT_PATH}/bin/webmux.pl \
177 ${RT_PATH}/bin/rt-crontool \
178 ${RT_PATH}/sbin/rt-dump-database \
179 ${RT_PATH}/sbin/rt-setup-database
181 #hack @INC dir out of RT (well, handler.pl) too.
183 s'/opt/rt3/'/var/opt/freeside/rt/'g;\
184 " ${TMP}-webui/usr/share/freeside/handler.pl
186 mv ${RT_PATH}/etc/RT_Config.pm ${RT_PATH}/etc/RT_Config.pm.dbc
189 s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
190 s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
191 s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
192 " ${RT_PATH}/etc/RT_SiteConfig.pm
194 install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/pgsql
195 install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/mysql
197 install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/pgsql/$(DEBVERSION)
198 install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/mysql/$(DEBVERSION)
205 # We have nothing to do here for an architecture-independent package
207 binary-indep: build install
210 dh_installchangelogs ChangeLog
211 dh_installdocs #freeside.docs README AGPL
212 dh_installexamples eg/*
215 # dh_installlogrotate
229 binary: binary-indep binary-arch
230 .PHONY: build clean binary-indep binary-arch binary install