File: rules

package info (click to toggle)
file 5.04-5%2Bsqueeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,892 kB
  • ctags: 1,197
  • sloc: ansic: 10,909; sh: 9,192; makefile: 383; python: 24
file content (128 lines) | stat: -rwxr-xr-x 3,293 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

include /usr/share/quilt/quilt.make
-include /usr/share/python/python.mk

DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
	CROSS= --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc LD=$(DEB_HOST_GNU_TYPE)-ld
else
	CROSS= --build=$(DEB_BUILD_GNU_TYPE)
endif

# HOWMANY is the number of bytes looked at by file
CFLAGS += -DHOWMANY=0x18000

PYTHON_VERSIONS=$(shell pyversions -r debian/control)

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -f config.guess config.sub

	[ ! -f Makefile ] || $(MAKE) clean
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -rf python/build

	dh_clean

config.status: configure patch
	dh_testdir

ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif

	./configure $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --mandir=\$${prefix}/share/man --enable-fsect-man5 CFLAGS="$(CFLAGS)"

build: build-stamp
build-stamp: config.status
	dh_testdir

	$(MAKE)

	set -e; \
	for python in $(PYTHON_VERSIONS); \
	do \
		(cd python && $$python setup.py build_ext \
			-L$(CURDIR)/src/.libs); \
	done
	set -e; \
	for python in $(PYTHON_VERSIONS); do \
		(cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
	done

	touch build-stamp


install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Installing package
	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
	mv debian/tmp/usr/share/misc debian/tmp/usr/share/file

	install -D -m 0644 magic/magic.local debian/tmp/etc/magic
	install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime

	set -e; \
	for python in $(PYTHON_VERSIONS); \
	do \
		(cd python && $$python setup.py install --no-compile \
			--root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \
	done

	set -e; \
	for python in $(PYTHON_VERSIONS); do \
		(cd python && $$python-dbg setup.py install --no-compile \
			--root=$(CURDIR)/debian/python-magic-dbg $(py_setup_install_args)); \
	done
	find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
	find debian/python-*-dbg -depth -empty -exec rmdir {} \;

	# Installing additional headers
	mkdir -p debian/libmagic-dev/usr/include/file
	cp src/file.h src/patchlevel.h debian/libmagic-dev/usr/include/file

binary: binary-arch

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
	dh_bugfiles
	dh_install --sourcedir=debian/tmp
	dh_lintian
	dh_link
	dh_pysupport
ifeq (,$(findstring -i, $(DH_OPTIONS)))
	dh_strip -Npython-magic -Npython-magic-dbg
	DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg

	rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
	mkdir -p debian/python-magic-dbg/usr/share/doc
	ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
endif
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep:

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