File: rules

package info (click to toggle)
luabind 0.9.1%2Bdfsg-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,460 kB
  • sloc: cpp: 13,761; makefile: 120; sh: 24; ansic: 11
file content (110 lines) | stat: -rwxr-xr-x 3,155 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
#!/usr/bin/make -f
#export DH_VERBOSE=1

include /usr/share/quilt/quilt.make

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

CFLAGS  = -Wall -g

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

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_MULTIARCH

tests := $(filter-out main.cpp,$(subst test/,,$(wildcard test/*.cpp)))

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: patch
	dh_testdir
	# The -d2 option makes bjam output the actual commands it is using
	bjam -d2 release debug cflags="$(CFLAGS)"
	# Create symlinks that bjam doesn't create
	find . -name libluabindd.so.0.9.1 -execdir ln -sf libluabindd.so.0.9.1 libluabind.so.0.9.1 \;
	find . -name libluabindd.so.0.9.1 -execdir objcopy --only-keep-debug libluabindd.so.0.9.1 libluabindd.so.0.9.1.dbg \;
	find . -name libluabindd.so.0.9.1 -execdir rm libluabindd.so.0.9.1 \;
	find . -name libluabindd.so.0.9.1.dbg -execdir mv libluabindd.so.0.9.1.dbg libluabindd.so.0.9.1 \;
	find . -name libluabind.so.0.9.1 -execdir ln -sf libluabind.so.0.9.1 libluabind.so \;
	# We also need a .a library for the -dev package
	bjam -d2 release debug link=static cflags="$(CFLAGS)"
	#FIXME: dh_fixperms does not recognize .hpp or .lua files
	find . -type f -name "*.cpp" -or -name "*.hpp" -or -name "*.lua" | xargs chmod 644
	find . -type f -name "Jamfile" -or -name "*.jam" -or -name "makefile" | xargs rm -f

	# If the build arch and the target arch are the same, also run tests
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	@cd test && g++ $(CFLAGS) -o main.o -c main.cpp -I.. -I/usr/include/lua5.1 -I/usr/include/boost && \
	for i in $(tests) ; \
		do echo -n "Building $$i... " && \
		if g++ $(CFLAGS) -o test_temp $$i main.o -I.. -I/usr/include/lua5.1 -I/usr/include/boost \
		`find .. -name libluabind.a` -llua5.1 2>test_log >/dev/null ; then \
			if test -s test_log ; then \
				echo "OK, warnings:" && \
				cat test_log | sed -r 's/(.*)/  \1/g' ; \
			else \
				echo "OK." ; \
			fi ; \
			echo -n "Running  $$i... " && \
			if ./test_temp ; then \
				echo "OK." ; \
			else \
				echo "FAILED TO RUN." ; \
			fi ; \
		else \
			echo "FAILED TO BUILD:" && \
			cat test_log | sed -r 's/(.*)/  \1/g' ; \
		fi ; \
		echo ; rm -f test_temp test_log ; \
	done
endif

	touch $@

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -f test/main.o
	rm -rf bin
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

binary-indep: install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs -plibluabind-doc doc/changes.txt
	dh_installexamples

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installexamples
	dh_installdocs debian/copyright
	dh_install
	dh_link
	dh_strip --dbg-package=libluabind-dbg
	dh_compress -X.lua
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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