6fcc390c704c1ec17106add3b41864c58513837f
[maemo-efl] / trunk / python-ecore / debian / rules
1 #!/usr/bin/make -f
2
3 DEB_DESTDIR=$(CURDIR)/debian/tmp
4
5 PYVER=2.5
6 PYTHON=python$(PYVER)
7
8 DEB_BUILD_ARCH?=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
9
10 ifeq ($(DEB_BUILD_ARCH),armel)
11         COMMON_CFLAGS=-DNDEBUG=1 -fomit-frame-pointer -O2 -ffast-math -funsafe-math-optimizations -fno-math-errno -fsingle-precision-constant
12         N770_CFLAGS=-mcpu=arm926ej-s
13         N8x0_CFLAGS=-mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136jf-s
14         ifneq ($(DEB_BUILD_OPTIONS),)
15                 ifneq (,$(findstring n8x0,$(DEB_BUILD_OPTIONS)))
16                         SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
17                 else
18                         ifneq (,$(findstring n770,$(DEB_BUILD_OPTIONS)))
19                                 SPECIFIC_CFLAGS=$(N770_CFLAGS)
20                         endif
21                 endif
22         endif
23     ifeq ($(SPECIFIC_CFLAGS),)
24         ifeq (0,$(shell test -e /etc/osso_software_version; echo $$?))
25             SW_VERSION?=$(shell cat /etc/osso_software_version|cut -d_ -f2)
26                         ifneq (,$(findstring $(SW_VERSION),OSSO1.1 2008SE DIABLO))
27                                 SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
28             endif
29                 endif
30         ifeq ($(SPECIFIC_CFLAGS),)
31             # Our last hope is to look at the value returned by `sb-conf current`
32             SB_CURRENT?=$(shell sb-conf current|cut -d_ -f1)
33                         ifneq (,$(findstring $(SB_CURRENT),GREGALE BORA CHINOOK DIABLO))
34                                 ifeq ($(SB_CURRENT),GREGALE)
35                                         SPECIFIC_CFLAGS=$(N770_CFLAGS)
36                                 else
37                                         SPECIFIC_CFLAGS=$(N8x0_CFLAGS)
38                                 endif
39                         else
40                                 COMMON_CFLAGS=
41                         endif
42         endif
43     endif
44 endif
45
46 CFLAGS+=$(COMMON_CFLAGS) $(SPECIFIC_CFLAGS)
47
48 build: build-stamp
49 build-stamp:
50         dh_testdir
51         touch ecore/ecore.*.pyx
52         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build_ext build
53         touch build-stamp
54 clean:
55         dh_testdir
56         dh_testroot
57         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py clean
58         -rm -f build-stamp
59         -rm -rf build dist python_ecore.egg-info
60         -rm -f ecore/*.py[co]
61         -rm -f *.py[co]
62         dh_clean
63
64 install: build
65         dh_testdir
66         dh_testroot
67         dh_installdirs
68         CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install --root=$(DEB_DESTDIR)
69         if [ "x$(DEB_BUILD_ARCH)" = "xarmel" ]; then \
70                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/ecore/*.py; \
71                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/ecore/*.pyc; \
72                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/ecore/*/*.py; \
73                 rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/ecore/*/*.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