File: rules

package info (click to toggle)
yaws 2.0.8+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 8,064 kB
  • sloc: erlang: 42,164; sh: 2,543; javascript: 1,459; ansic: 890; makefile: 878; lisp: 79; python: 35; xml: 12; php: 1
file content (160 lines) | stat: -rwxr-xr-x 4,717 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
#!/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.

export HOME := $(CURDIR)/debian

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/architecture.mk

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

-include $(CURDIR)/vsn.mk

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

%:
	dh $@

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

override_dh_auto_configure:
	dh_testdir
	#
	CFLAGS="$(CFLAGS)" \
	./configure --host=$(DEB_HOST_GNU_TYPE) \
		    --build=$(DEB_BUILD_GNU_TYPE) \
		    --prefix=/usr \
		    --mandir=/usr/share/man \
		    --infodir=/usr/share/info \
		    --sysconfdir=/etc \
		    --localstatedir=/var \
		    --disable-silent-rules

build-arch.stamp:
	dh_testdir
	#
	# Compile the package.
	TYPE="$(TYPE)" $(MAKE) DLL_LIBS=-lc debug
	#
	# Compile the Yapp application
	cd applications/yapp ; TYPE="$(TYPE)" $(MAKE)
	touch build-arch.stamp

override_dh_auto_build-arch: build-arch.stamp

override_dh_auto_build-indep: build-arch.stamp
	dh_testdir
	#
	# Build applications included into yaws distribution
	for appdir in chat mail wiki ; do \
	    (cd applications/$$appdir ; TYPE="$(TYPE)" $(MAKE) || exit 1) \
	done
	#
	# Build documentation
	$(MAKE) docs

override_dh_auto_test:
	# Do nothing because the tests require downloading some tools from
	# the Internet.

install-arch.stamp:
	dh_testdir
	#
	# Install the package into debian/tmp.
	$(MAKE) install DESTDIR=$(TMPDIR)
	#
	# Install the yapp application
	cd applications/yapp ; $(MAKE) install DESTDIR=$(TMPDIR)
	#
	# Relocate pkgconfig script
	install -m 755 -d $(TMPDIR)/usr/lib/$(DEB_HOST_MULTIARCH)
	mv $(TMPDIR)/usr/lib/pkgconfig $(TMPDIR)/usr/lib/$(DEB_HOST_MULTIARCH)
	#
	# Relocate examples
	mv $(TMPDIR)/usr/lib/yaws-*/examples $(TMPDIR)/var/yaws/
	mv $(TMPDIR)/usr/lib/yapp-*/examples $(TMPDIR)/var/yaws/examples/yapp
	mv $(TMPDIR)/usr/lib/yapp-*/priv $(TMPDIR)/var/yaws/yapp-priv
	mv $(TMPDIR)/usr/lib/yapp-*/doc $(TMPDIR)/var/yaws/yapp-doc
	#
	# Remove unneeded .la files
	rm -vf $(TMPDIR)/usr/lib/yaws-*/priv/lib/*.la
	#
	sed -e "s/@YAWS_VSN@/$(YAWS_VSN)/g" \
	    debian/erlang-yaws.maintscript.in >debian/erlang-yaws.maintscript || exit 1
	#
	dh_install -a
	touch install-arch.stamp

override_dh_auto_install-arch: install-arch.stamp

override_dh_auto_install-indep: install-arch.stamp
	dh_testdir
	#
	# Install applications (and READMEs) included into yaws distribution
	# Application beams go to /usr/lib/yaws/$application/ebin
	# Other application files go to /usr/share/yaws-$application/docroot
	for app in chat mail wiki ; do \
	    (cd applications/$$app ; $(MAKE) install DESTDIR=$(TMPDIR) || exit 1) \
	done
	#
	# Fix permissions on examples
	chmod a-x $(TMPDIR)/var/yaws/www/testdir/index.html
	#
	# Fix run_erl and to_erl paths.
	sed -i -e 's:/lib/erlang/erts-[0-9.]*/:/:g' $(TMPDIR)/usr/bin/yaws
	#
	# Fix permissions of application files
	find $(TMPDIR)/var/yaws -type f -exec chmod a-x \{\} \;
	#
	# Generate postinst and postrm scripts for applications
	for app in chat mail wiki yapp ; do \
	    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
	#
	dh_install -i

override_dh_compress:
	dh_compress -X.erl -X.beam -X.yaws -X.pdf -X .ps -X .eps -X Makefile

override_dh_gencontrol:
	erlang-depends
	dh_gencontrol

.PHONY: override_dh_auto_clean override_dh_auto_configure override_dh_auto_build-arch \
	override_dh_auto_build-indep override_dh_auto_test override_dh_auto_install-arch \
	override_dh_auto_install-indep override_dh_compress override_dh_gencontrol