84a7eb9fe2c8fe9e25b0566e9f04738948925390
[maemo-efl] / trunk / python-epsilon / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/cdbs/1/rules/simple-patchsys.mk
4
5 DEB_DESTDIR=$(CURDIR)/debian/tmp
6
7 PYVER=2.5
8 PYTHON=python$(PYVER)
9
10 DEB_BUILD_ARCH?=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
11
12 ifeq ($(DEB_BUILD_ARCH),armel)
13         COMMON_CFLAGS=-DNDEBUG=1 -fomit-frame-pointer -O2 -ffast-math -funsafe-math-optimizations -fno-math-errno -fsingle-precision-constant
14         N770_CFLAGS=-mcpu=arm926ej-s
15         N8x0_CFLAGS=-mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136jf-s
16         ifneq ($(DEB_BUILD_OPTIONS),)
17                 ifneq (,$(findstring n8x0,$(DEB_BUILD_OPTIONS)))
18                         SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
19                 else
20                         ifneq (,$(findstring n770,$(DEB_BUILD_OPTIONS)))
21                                 SPECIFIC_CFLAGS=$(N770_CFLAGS)
22                         endif
23                 endif
24         endif
25     ifeq ($(SPECIFIC_CFLAGS),)
26         ifeq (0,$(shell test -e /etc/osso_software_version; echo $$?))
27             SW_VERSION?=$(shell cat /etc/osso_software_version|cut -d_ -f2)
28                         ifneq (,$(findstring $(SW_VERSION),OSSO1.1 2008SE DIABLO))
29                                 SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
30             endif
31                 endif
32         ifeq ($(SPECIFIC_CFLAGS),)
33             # Our last hope is to look at the value returned by `sb-conf current`
34             SB_CURRENT?=$(shell sb-conf current|cut -d_ -f1)
35                         ifneq (,$(findstring $(SB_CURRENT),GREGALE BORA CHINOOK DIABLO))
36                                 ifeq ($(SB_CURRENT),GREGALE)
37                                         SPECIFIC_CFLAGS=$(N770_CFLAGS)
38                                 else
39                                         SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
40                                 endif
41                         else
42                                 COMMON_CFLAGS=
43                         endif
44         endif
45     endif
46 endif
47
48 CFLAGS+=$(COMMON_CFLAGS) $(SPECIFIC_CFLAGS)
49
50 build: build-stamp
51 build-stamp:
52         dh_testdir
53         touch epsilon/epsilon.*.pyx
54         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build_ext build
55         touch build-stamp
56 clean::
57         dh_testdir
58         dh_testroot
59         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py clean
60         -rm -f build-stamp
61         -rm -rf build dist python_epsilon.egg-info
62         -rm -f epsilon/*.py[co]
63         -rm -f *.py[co]
64         dh_clean
65
66 install: build
67         dh_testdir
68         dh_testroot
69         dh_installdirs
70         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install --root=$(DEB_DESTDIR)
71         if [ "x$(DEB_BUILD_ARCH)" = "xarmel" ]; then \
72                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/epsilon/*.py; \
73                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/epsilon/*.pyc; \
74         fi
75         dh_install --sourcedir=$(DEB_DESTDIR) --fail-missing
76
77 binary: binary-arch
78 binary-arch: build install
79         dh_testdir
80         dh_testroot
81         dh_installdocs
82         dh_installdebconf
83         dh_installchangelogs
84         dh_strip
85         dh_compress
86         dh_fixperms
87         dh_makeshlibs
88         dh_installdeb
89         dh_shlibdeps
90         dh_gencontrol
91         dh_md5sums
92         dh_builddeb
93
94 .PHONY: build install clean binary binary-arch