File: rules

package info (click to toggle)
yaws 1.88-2%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,544 kB
  • ctags: 5,440
  • sloc: erlang: 27,321; sh: 3,823; ansic: 1,264; makefile: 874; lisp: 79; xml: 12; python: 3
file content (232 lines) | stat: -rwxr-xr-x 6,088 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
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

VSN=1.88

export HOME := $(CURDIR)/debian

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export QUILT_PATCHES := debian/patches

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

DESTDIR=$(CURDIR)/debian/yaws
DESTDIR1=$(CURDIR)/debian/erlang-yaws
TMPDIR=$(CURDIR)/debian/tmp

-include vsn.mk

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	TYPE = debug
endif

patch: patch-stamp
patch-stamp:
	dh_testdir
	quilt push -a || test $$? = 2
	touch patch-stamp

unpatch: patch-stamp
	dh_testdir
	quilt pop -a || test $$? = 2
	rm -rf .pc
	rm -f patch-stamp

config.status: patch-stamp configure
	dh_testdir
	# Add here commands to configure the package.
	CFLAGS="$(CFLAGS)" \
	./configure --host=$(DEB_HOST_GNU_TYPE) \
		    --build=$(DEB_BUILD_GNU_TYPE) \
		    --prefix=/usr \
		    --mandir=\$${prefix}/share/man \
		    --infodir=\$${prefix}/share/info \
		    --sysconfdir=/etc \
		    --localstatedir=/var
	ln -s . yaws


build: build-arch build-indep

build-arch: build-arch-stamp
build-arch-stamp: config.status
	dh_testdir
	#
	# Compile the package.
	mkdir -p examples/ebin
	TYPE="$(TYPE)" $(MAKE) DLL_LIBS=-lc
	$(MAKE) docs
	#
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp: config.status
	dh_testdir
	#
	# Build applications included into yaws distribution
	for appdir in applications/* ; do \
	    (cd $$appdir ; \
	     mkdir -p ebin ; \
	     TYPE="$(TYPE)" $(MAKE) || exit 1) \
	done
	#
	touch build-indep-stamp

clean: clean-patched unpatch
	dh_testdir
	dh_testroot
	dh_clean

clean-patched: patch-stamp
	dh_testdir
	dh_testroot
	#
	# Clean up applications included into yaws distribution
	[ ! -f include.mk ] || \
	for appdir in applications/* ; do \
	    (cd $$appdir ; \
	     $(MAKE) clean || exit 1 ; \
	     $(MAKE) cleandocs || exit 1) \
	done
	#
	# Clean up after the build process.
	[ ! -f include.mk ] || $(MAKE) clean
	[ ! -f include.mk ] || $(MAKE) conf_clean
	#
	rm -f build-*-stamp 
	rm -f yaws erl_crash.dump
	rm -f debian/yaws-*.postinst debian/yaws-*.postrm

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_installdirs -a
	#
	# Install the package into debian/yaws.
	$(MAKE) install DESTDIR=$(TMPDIR)
	#
	# Fix location of epam binary
	mv $(TMPDIR)/usr/lib/yaws/priv/lib/epam $(TMPDIR)/usr/lib/yaws/priv/
	#
	# Fix permissions on examples
	chmod a-x $(TMPDIR)/var/yaws/www/testdir/index.html
	#
	# Remove duplicated headers
	rm -f $(TMPDIR)/usr/lib/yaws/*.hrl
	#
	# Remove useless .empty files and .xvpics directory
	find $(TMPDIR) -type f -name '.*' -print -exec rm -rf \{\} \;
	#
	# Remove empty directories
	rm -rf $(TMPDIR)/usr/lib/yaws/examples/

install-indep: build-indep
	dh_testdir
	dh_testroot
	dh_installdirs -i
	#
	# Install applications (and READMEs) included into yaws distribution
	# Application beams go to /usr/lib/yaws
	# Other application files go to /usr/share/yaws-application/docroot
	for appdir in applications/* ; do \
	    (cd $$appdir ; \
	     app=`basename $$appdir` ; \
	     $(MAKE) install DESTDIR=$(DESTDIR)-$$app \
	     		     EBININSTALLDIR=$(DESTDIR)-$$app/usr/lib/yaws/$$app/ebin \
	     		     CHATINSTALLDIR=$(DESTDIR)-chat/usr/share/yaws-chat \
	     		     MAILINSTALLDIR=$(DESTDIR)-mail/usr/share/yaws-mail \
	     		     WIKIINSTALLDIR=$(DESTDIR)-wiki/var/lib/yaws-wiki || exit 1) \
	done
	#
	# Fix permissions of application files
	for appdir in applications/* ; do \
	    app=`basename $$appdir` ; \
	    find $(DESTDIR)-$$app -type f -exec chmod a-x \{\} \; ; \
	done
	#
	# Remove useless empty files
	for appdir in applications/* ; do \
	    app=`basename $$appdir` ; \
	    find $(DESTDIR)-$$app -type f -name '.*' -print -exec rm -f \{\} \; ; \
	done
	#
	# Generate postinst and postrm scripts for applications
	for appdir in applications/* ; do \
	    app=`basename $$appdir` ; \
	    sed -e "s/@APPLICATION@/$$app/g" \
	    	debian/yaws-application.postinst.in >debian/yaws-$$app.postinst || exit 1; \
	    sed -e "s/@APPLICATION@/$$app/g" \
	    	debian/yaws-application.postrm.in >debian/yaws-$$app.postrm || exit 1 ; \
	done

# Build architecture-independent files here.
binary-indep: install-arch install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installchangelogs -i ChangeLog
	dh_installdocs -i
	dh_installexamples -i
	dh_install -i
	dh_installinit -i
	dh_installman -i
	dh_link -i
	dh_strip -i
	dh_compress -i -X.erl -X.beam -X.yaws -X.pdf -X .ps
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	erlang-depends -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs -a ChangeLog
	dh_installdocs -a
	dh_installexamples -a
	dh_install -a
	install -m 644 debian/erlang-yaws.lintian-overrides \
		$(DESTDIR1)/usr/share/lintian/overrides/erlang-yaws
	dh_installinit -a
	dh_installman -a
	dh_link -a
	dh_strip -a
	dh_compress -a -X.erl -X.beam -X.yaws -X.pdf -X.ps
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	erlang-depends -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch binary-indep

get-orig-source:
	wget -O - http://yaws.hyber.org/download/yaws-$(VSN).tar.gz | tar zx
	tar zcf yaws_$(VSN).orig.tar.gz yaws-$(VSN)
	rm -r yaws-$(VSN)
	rm yaws

.PHONY: build build-indep build-arch clean binary-indep binary-arch binary \
	install-arch install-indep get-orig-source patch unpatch clean-patched