summaryrefslogtreecommitdiff
path: root/debian/rules
blob: a8835e5fe4c8276fd1663bd17d597f7ee1d639f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# If set to a true value then MakeMaker's prompt function will
# always return the default without waiting for user input.
#export PERL_MM_USE_DEFAULT=1

PERL   ?= /usr/bin/perl
#PACKAGE = $(shell dh_listpackages)
PACKAGE = freeside
TMP     = $(CURDIR)/debian/$(PACKAGE)
#DBC_SCRIPTS = $(TMP)/usr/share/dbconfig-common/scripts/freeside

##this is gotten from dbconfig-common
#DB_TYPE = db_type_is_configured_during_pkg_install_by_dbconfig-common_not_at_build_time

#no chance, it doesn't get backslash-interpolted now...
##DEBVERSION                    = `head -1 debian/changelog | cut -d')' -f1 | cut -c11-`
#DEBVERSION                    = 1.7.3~rc2-1
#export VERSION                = $(DEBVERSION) (Debian)

#export FREESIDE_CONF          = /etc/freeside
#export FREESIDE_LOG           = /var/log/freeside
#export FREESIDE_LOCK          = /var/lock/freeside
#export FREESIDE_CACHE         = $(TMP)/var/cache/freeside
#FREESIDE_CACHE         = $(TMP)/var/cache/freeside

#XXX huh?
#export FREESIDE_EXPORT        = /var/spool/freeside

export FREESIDE_CONF = $(TMP)/usr/local/etc/freeside
export FREESIDE_LOG = $(TMP)/usr/local/etc/freeside
export FREESIDE_LOCK = $(TMP)/usr/local/etc/freeside
export FREESIDE_CACHE = $(TMP)/usr/local/etc/freeside
export FREESIDE_EXPORT = $(TMP)/usr/local/etc/freeside

#XXX own subdir?
#export MASON_HANDLER          = $(TMP)-webui/usr/share/freeside/handler.pl
export MASON_HANDLER=$(TMP)-webui/usr/local/etc/freeside/handler.pl

#export FREESIDE_DOCUMENT_ROOT = $(TMP)-webui/usr/share/freeside/www
export FREESIDE_DOCUMENT_ROOT = $(TMP)-webui/var/www/freeside
export INIT_FILE              = $(TMP).init
export INIT_INSTALL           = /bin/true
export HTTPD_RESTART          = /bin/true
#export APACHE_CONF            = $(TMP)-webui/etc/apache2/conf.d
export APACHE_CONF            = $(TMP)-webui/etc/freeside/apache2
export FREESIDE_RESTART       = /bin/true

#XXX root?
export INSTALLGROUP           = adm

export SELFSERVICE_MACHINES   = 

#prompt ?   XXX these are runtime, not buildtime :/
#export RT_DOMAIN              = `dnsdomainname`
#export RT_TIMEZONE            = `cat /etc/timezone`

#export HOSTNAME               = `hostname -f`
#export FREESIDE_URL           = http://$(HOSTNAME)/freeside/

#specific to deb pkg, for purposes of saving off a permanent copy of default
#config for postinst and that sort of thing
#export DIST_CONF           = $(TMP)/usr/share/freeside/default_conf

#XXX yuck.  proper RT layout is entirely necessary
#this seems to infect way to much of RT with the build location, requiring
# a kludge to hack it out afterwords.  look into using fakeroot (didn't
# realize it would need to be explicit argh)
# (but leaving it for now, otherwise can't get RT to put files where we need em)
#export RT_PATH                = $(TMP)/var/opt/freeside/rt

# This has to be exported to make some magic below work.
export DH_OPTIONS

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.
	
	touch configure-stamp


build: build-stamp
build-stamp: 
	dh_testdir
	# Add commands to compile the package here
	
	( cd FS/ && $(PERL) Makefile.PL INSTALLDIRS=vendor )

	$(MAKE) -e perl-modules

	#TEST#

	touch $@

clean:
	dh_testdir
	dh_testroot
	dh_clean build-stamp install-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) -e clean
	#|| true #XXX freeside clean target fucked

	dh_clean 

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install package into
	# debian/<package>-whatever.
	( cd FS/ && $(MAKE) -e DESTDIR=$(TMP)-lib install )

        #false laziness w/install-perl-modules now
	#install this for postinst later (no create-config)
	##install -d $(DIST_CONF)
	#install conf/[a-z]* $(DEFAULT_CONF)
	#CVS is not [a-z]
	##install `ls -d conf/[a-z]* | grep -v CVS` $(DIST_CONF)

	install -d $(FREESIDE_DOCUMENT_ROOT)
	install -d $(FREESIDE_CACHE)/masondata #MASONDATA
	$(MAKE) -e DESTDIR=$(TMP)-webui install-docs

	#hack the build dir out of Freeside too.  oh yeah, sucky.
	perl -p -i -e "\
	  s'${TMP}(-webui)?''g;\
	" ${TMP}-webui/usr/share/freeside/handler.pl \
	  ${TMP}/usr/share/perl5/FS/* \
	  ${TMP}/usr/share/perl5/FS/*/* \
	  ${TMP}/usr/bin/*

	#rm -r $(FREESIDE_DOCUMENT_ROOT).*

	install -d $(APACHE_CONF)
	#install debian/freeside.apache-alias.conf $(APACHE_CONF)/freeside-alias.conf
	#FREESIDE_DOCUMENT_ROOT=/usr/share/freeside/www MASON_HANDLER=/usr/share/freeside/handler.pl FREESIDE_CONF=/etc/freeside $(MAKE) -e install-apache
	$(MAKE) -e install-apache

	$(MAKE) -e install-init

	#RT
	#(configure-rt)
	$(MAKE) -e configure-rt

	## XXX need to adjust db-type, db-database, db-rt-user, db-rt-pass
	## based on info from dbc
	#( cd rt; \
	#  cp config.layout.in config.layout; \
	#  perl -p -i -e "\
	#    s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
	#    s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\
	#  " config.layout; \
	#  ./configure --prefix=${RT_PATH} \
	#              --enable-layout=Freeside \
	#              --with-db-type=Pg \
	#              --with-db-dba=freeside \
	#              --with-db-database=_DBC_DBNAME_ \
	#              --with-db-rt-user=_DBC_DBUSER_ \
	#              --with-db-rt-pass=_DBC_DBPASS_ \
	#              --with-web-user=freeside \
	#              --with-web-group=freeside \
	#              --with-rt-group=freeside \
	#)

	##(create-rt)
	#$(MAKE) -e create-rt

	#install -d $(RT_PATH)
	#( cd rt; make install )
	##hack the build dir out of RT.  yeah, sucky.
	#perl -p -i -e "\
	#  s'${TMP}''g;\
	#" ${RT_PATH}/etc/RT_Config.pm \
	#  ${RT_PATH}/lib/RT.pm \
	#  ${RT_PATH}/bin/mason_handler.fcgi \
	#  ${RT_PATH}/bin/mason_handler.scgi \
	#  ${RT_PATH}/bin/standalone_httpd \
	#  ${RT_PATH}/bin/webmux.pl \
	#  ${RT_PATH}/bin/rt-crontool \
	#  ${RT_PATH}/sbin/rt-dump-database \
	#  ${RT_PATH}/sbin/rt-setup-database
	#
	##hack @INC dir out of RT (well, handler.pl) too.
	#perl -p -i -e "\
	#  s'/opt/rt3/'/var/opt/freeside/rt/'g;\
	#" ${TMP}-webui/usr/share/freeside/handler.pl

	#mv ${RT_PATH}/etc/RT_Config.pm ${RT_PATH}/etc/RT_Config.pm.dbc

	#perl -p -i -e "\
	#  s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
	#  s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
	#  s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
	#" ${RT_PATH}/etc/RT_SiteConfig.pm

	#install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/pgsql
	#install -D debian/dbconfig-common.install $(DBC_SCRIPTS)/install/mysql
	
	#install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/pgsql/$(DEBVERSION)
	#install -D debian/dbconfig-common.upgrade $(DBC_SCRIPTS)/upgrade/mysql/$(DEBVERSION)
	
	dh_install

	touch $@

binary-arch:
# We have nothing to do here for an architecture-independent package

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs #freeside.docs README AGPL
	dh_installexamples eg/*
#	dh_installmenu
	dh_installdebconf	
#	dh_installlogrotate	
	dh_installinit
	dh_installcron
#	dh_installinfo
	dh_installman
	dh_perl
	dh_link
	dh_compress 
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install