File: rules

package info (click to toggle)
horde3 3.3.8%2Bdebian0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 34,220 kB
  • ctags: 28,224
  • sloc: php: 115,191; xml: 4,247; sql: 2,417; sh: 147; makefile: 140
file content (243 lines) | stat: -rwxr-xr-x 7,952 bytes parent folder | download
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
241
242
243
#!/usr/bin/make -f

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

# List all Files and directories here that should not be copied to
# /usr/share/horde3
COPY_EXCLUDE=^(\{arch\}|COPYING|README|po|scripts|config|debian|docs|build-stamp|configure-stamp|patch-stamp)$

srcpkg = $(shell dpkg-parsechangelog | sed -ne 's/Source: *//p')
srcver = $(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*:\)\?\(.*\)-.*$$/\2/p')

#{{{ generic rules

../$(srcpkg)_$(srcver).orig.tar.gz:
	@if git rev-parse --git-dir >/dev/null 2>&1; then                 \
            pristine-tar checkout $@;                                     \
        fi

check-tarball: ../$(srcpkg)_$(srcver).orig.tar.gz

.PHONY: check-tarball

#}}}
#{{{ maintainer stuff

refresh-patches: check-tarball
	@dh_testdir
	@echo 'refreshing debian/patches:'
	@rm -rf '$(CURDIR)'/debian/patches
	@mkdir -p '$(CURDIR)'/debian/patches
	@cd '$(CURDIR)'/debian/patches && git format-patch upstream..upstream+patches
	@echo .

#}}}

patch: patch-stamp check-tarball
patch-stamp:
	dh_testdir
	set -e; test -e patch-stamp || \
	    for i in `ls -1 debian/patches/*.patch || :`; do patch -p1 <$$i > /dev/null; done
	touch $@

unpatch:
	dh_testdir
	set -e; ! test -e patch-stamp || \
	    for i in `ls -1r debian/patches/*.patch || :`; do patch -p1 -R <$$i > /dev/null; done
	rm -f patch-stamp

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

	touch configure-stamp

build: check-external-libs build-stamp

build-stamp: configure
	dh_testdir
	touch build-stamp

clean:  unpatch
	dh_testdir
	dh_testroot
	dh_clean build-stamp configure-stamp

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	# Add here commands to install the package into debian/horde3.
	#### copy stuff that belongs in /usr/share/horde3 ###
	for i in $$(ls -1 | egrep -v "$(COPY_EXCLUDE)"); do \
		echo install $$i ; \
		cp -a $$i debian/horde3/usr/share/horde3 ; \
	done

	#### copy configuration files ####
	for i in config/*.dist; do \
		NAME=etc/horde/horde3/$$(basename $$i ".dist");	\
		cp -a $$i debian/horde3/$$NAME; \
	done
	cp -r config/registry.d debian/horde3/etc/horde/horde3/

	# Use '/horde3' for default cookie path (See #391493)
	cat config/conf.xml | \
		sed -e "109,116s@/horde@/horde3@" > debian/horde3/etc/horde/horde3/conf.xml

	#### horde expects configuration in config subdir, an update-alternatives
	#### symlink is created in maintainer's script to comply with FHS

	#### copy scripts to run by cron ####
	mkdir -p debian/horde3/usr/share/horde3/scripts
	cp scripts/temp-cleanup.cron debian/horde3/usr/share/horde3/scripts
	chmod +x debian/horde3/usr/share/horde3/scripts/temp-cleanup.cron
	cp scripts/alarms.php debian/horde3/usr/share/horde3/scripts

	cp debian/horde3.default debian/horde3/etc/default/horde3

	#### create htaccess  to restrict acess by web ####
	echo "Deny from all" > debian/horde3/usr/share/horde3/scripts/.htaccess
	echo "Deny from all" > debian/horde3/etc/horde/horde3/.htaccess

	#### log file ####
	printf "\n\$$conf['log']['name'] = '/var/log/horde/horde3.log';" >> \
		debian/horde3/etc/horde/horde3/conf.php
	chown root:www-data debian/horde3/var/log/horde
	chmod 750 debian/horde3/var/log/horde

	#### add default configuration to avoid broken pages
	printf "\n\$$conf['datatree']['driver'] = 'null';" >> \
		debian/horde3/etc/horde/horde3/conf.php
	printf "\n\$$conf['share']['no_sharing'] = true;" >> \
		debian/horde3/etc/horde/horde3/conf.php
	printf "\n\$$conf['cache']['driver'] = 'none';" >> \
		debian/horde3/etc/horde/horde3/conf.php

	#### change made for program run with no problems ###
	cat config/registry.php.dist | \
		sed -e "s/'fileroot' *=> *dirname(__FILE__)/'fileroot' => '\/usr\/share\/horde3\/lib'/"| \
		sed -e "s/'templates' *=> *dirname(__FILE__)/'templates' => '\/usr\/share\/horde3\/lib'/"| \
		sed -e "s/webroot *= * '\/horde';/webroot = '\/horde3';/" > \
		debian/horde3/etc/horde/horde3/registry.php

	# change HORDE_BASE  in php files
	# change /usr/local/bin/php to /usr/bin/php
	for i in $$(find debian/horde3 -name "*.php"); do \
		cat $$i | \
		sed -e "s/define('HORDE_BASE'.*;/define\('HORDE_BASE', '\/usr\/share\/horde3\'\);/" |\
		sed -e "s/\/usr\/local\/bin/\/usr\/bin/" > $$i.rew; \
		mv $$i.rew $$i; \
	done

	#### change permissions of scripts  ####
	for i in $$(find debian/horde3/usr/share/horde3 -type f | \
		xargs grep '^#!\/' |cut -d: -f1); do \
		chmod u+x $$i; \
	done
 
	#### create link to access horde ####
	#dh_link usr/share/horde3 var/www/horde3
	#### end ####

	#### no exec right for .xml/png/gif/css/js/jpg/html/htm files (lintian warnings) ####
	find debian/horde3/usr/share/horde3 \( \
		    -name "*.xml" \
		 -o -name "*.png" \
		 -o -name "*.gif" \
		 -o -name "*.css" \
		 -o -name "*.js" \
		 -o -name "*.jpg" \
		 -o -name "*.html" \
		 -o -name "*.htm" \) \
		 -type f -exec chmod -x '{}' \;

	#### CREDITS file accessible to help viewer (DEPRECATED ??) ####
	#mkdir -m 755 debian/horde3/usr/share/horde3/docs
	#cp -a docs/CREDITS debian/horde3/usr/share/horde3/docs/
	
	#### Remove empty directories (lintian warnings) (DEPRECATED) ####
	#rmdir debian/horde3/usr/share/horde3/lib/Horde/tests
	#rmdir debian/horde3/usr/share/horde3/lib/Text/docs/examples
	#rmdir debian/horde3/usr/share/horde3/lib/Text/docs
	#rmdir debian/horde3/usr/share/horde3/lib/VFS/tests
	#rmdir debian/horde3/usr/share/horde3/lib/Horde/docs/examples
	#rmdir debian/horde3/usr/share/horde3/lib/Horde/docs
	#rmdir debian/horde3/usr/share/horde3/lib/File/tests
	#rmdir debian/horde3/usr/share/horde3/lib/XML/tests
	#rmdir debian/horde3/usr/share/horde3/lib/data
	#rmdir debian/horde3/usr/share/horde3/lib/Text/tests
	#rmdir debian/horde3/usr/share/horde3/lib/XML/docs/examples
	#rmdir debian/horde3/usr/share/horde3/lib/XML/docs
	#rmdir debian/horde3/usr/share/horde3/lib/Horde/scripts
	#rmdir debian/horde3/usr/share/horde3/lib/Horde/Text/tests
	#rmdir debian/horde3/usr/share/horde3/lib/docs

	#### Remove extra license file (lintian warnings) ####
	#### (This hack is temporary because waiting xinha package) ####
	rm debian/horde3/usr/share/horde3/services/editor/xinha/license.txt

	#### Remove javascript source files
	rm -rf  debian/horde3/usr/share/horde3/js/src/

	dh_install -i -ppear-horde-channel

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs -XINSTALL
	mv debian/horde3/usr/share/doc/horde3/CHANGES \
		debian/horde3/usr/share/doc/horde3/changelog
	dh_installexamples
	-find debian/horde3 -depth -name ".arch-ids" -exec rm -Rf {} \;
#	dh_installmenu
#	dh_installdebconf	
	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms -Xdebian/horde3/var/log/horde
#	dh_perl
#	dh_python
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
check-external-libs:
	if [ -e services/editor/fckeditor ] || \
	   [ -e services/editor/tinymce ] || \
	   [ -e js/controls.js ] || [ -e js/src/controls.js ] || \
	   [ -e js/dragdrop.js ] || [ -e js/src/dragdrop.js ] || \
	   [ -e js/effects.js ] || [ -e js/src/effects.js ] || \
	   [ -e js/prototype.js ] || [ -e js/src/prototype.js ] || \
	   [ -e js/scriptaculous.js ] || [ -e js/src/scriptaculous.js ] || \
	   [ -e js/slider.js ] || [ -e js/src/slider.js ]; then \
               echo ""; \
	      echo " **                                  **"; \
	      echo " **  tar contains external files!    **"; \
	      echo " **                                  **"; \
	      echo ""; \
	      exit 1; \
        fi

binary: binary-indep binary-arch
.PHONY: patch unpatch build clean binary-indep binary-arch binary install configure