4351a15169d7d1e50cf5229b50461e9171fea0d9
[framework/graphics/cairo.git] / debian / rules
1 #!/usr/bin/make -f
2
3 DISTRIBUTION    = SLP
4
5 # list of flavors we build; each gets a builddir, a configure pass (configure
6 # args are defined below), a build pass, and an install pass
7 FLAVORS := main udeb
8
9 # current flavor we're building; this is only expanded in flavor specific
10 # targets
11 current_flavor = $*
12
13 # macro to get a value for the current flavor we're building; for example
14 # when building the main flavor, $(call flavor_get,CFLAGS) will expand to
15 # main_CFLAGS if it's set or to CFLAGS otherwise; pay attention to not adding
16 # superflous spaces when for the arguments of $(call ); only some vars can
17 # be expanded in this way though
18 flavor_get = $(or $($(current_flavor)_$(1)),$($(1)))
19
20 # Supported backends (as of Cairo 1.7.4):
21 #  (internal) Image
22 #  xlib       Xlib
23 #  pdf        PDF
24 #  ps         PostScript
25 #  svg        SVG
26 #
27 # Experimental and unsupported backends:
28 #  directfb  DirectFB (requires Build-Depend on libdirectfb-dev (>=0.9.25) )
29 #  glitz     OpenGL (glitz)
30 #  xcb       XCB  (requires Build-Depend on at least libxcb1-dev)
31 #
32 # Other platform backends are auto disabled: quartz/OSX, win32/Win32
33 #
34 # Features:
35 # --enable-png  PNG (default enabled)
36
37 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
38 DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
39 #DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
40
41 PREFIX = /usr
42 configure_flags += \
43 --prefix=$(PREFIX) \
44 --mandir=/usr/share/man \
45 --infodir=/usr/share/info \
46 --disable-glitz \
47 --build=$(DEB_BUILD_GNU_TYPE) \
48 --disable-win32 \
49 --enable-directfb=no \
50 --enable-xlib \
51 --with-x \
52 --x-includes=$(PREFIX)/include \
53 --x-libraries=$(PREFIX)/lib \
54 --enable-static
55
56
57 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
58 configure_flags += --host=$(DEB_HOST_GNU_TYPE)
59 endif
60
61 ifeq (arm, $(findstring arm, $(DEB_HOST_GNU_TYPE)))
62 CONFIGURE_OPTIONS += \
63 --enable-svg=no 
64
65 configure_flags += \
66 --enable-egl=yes \
67 --enable-glesv2=yes
68 endif
69
70 main_configure_flags += \
71 $(configure_flags) 
72
73 ifeq ($(DISTRIBUTION),SLP)
74 configure_flags += --enable-xcb
75 endif
76
77 builddir = $(buildbasedir)/$(current_flavor)
78 buildbasedir = $(CURDIR)/debian/build
79
80 installdir = $(installbasedir)/$(current_flavor)
81 installbasedir = $(CURDIR)/debian/install
82
83 # default CFLAGS; these can be expanded with $(call flavor_get, )
84 CFLAGS += -Wall -g
85
86 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
87         CFLAGS += -O0
88 else
89         CFLAGS += -O2
90 endif
91
92 CFLAGS += -fPIC -rdynamic
93 LDFLAGS += -Wl,--hash-style=both -Wl,--as-needed
94
95 ifeq (armel, $(DEB_HOST_ARCH))
96         CFLAGS += -mfpu=vfp -mfloat-abi=softfp
97 endif
98
99 include /usr/share/dpatch/dpatch.make
100
101 configure-common-stamp: patch-stamp
102         dh_testdir
103         NOCONFIGURE=1 ./autogen.sh
104         touch $@
105
106 configure-stamp-%: configure-common-stamp
107         dh_testdir
108         mkdir -p $(builddir); \
109         cd $(builddir); \
110         $(CURDIR)/configure \
111                 CFLAGS="$(call flavor_get,CFLAGS)" \
112                 $(call flavor_get,configure_flags)
113         touch $@
114
115 build: $(addprefix build-stamp-, $(FLAVORS))
116
117 build-stamp-%: configure-stamp-%
118         dh_testdir
119         $(MAKE) -C $(builddir)
120         touch $@
121
122 clean: unpatch
123         dh_testdir
124         dh_testroot
125         # restore files from backup
126         [ ! -r config.sub.orig ] || mv -f config.sub.orig config.sub
127         [ ! -r config.guess.orig ] || mv -f config.guess.orig config.guess
128         rm -f src/cairo-features.h
129         rm -f *-stamp
130         rm -rf $(buildbasedir) $(installbasedir)
131         # Generated by configure and breaks the build if already existing
132         rm -f src/cairo-features.h
133         # Copy in fresh copies of config.{sub,guess}
134         # (these are from autotools-dev, so must Build-Depend on it)
135         -test -r /usr/share/misc/config.sub && \
136           cp -f /usr/share/misc/config.sub config.sub
137         -test -r /usr/share/misc/config.guess && \
138           cp -f /usr/share/misc/config.guess config.guess
139         dh_clean
140
141 install-%: build-stamp-%
142         $(MAKE) -C $(builddir) install DESTDIR=$(installdir)
143         sed -i "/dependency_libs/ s/'.*'/''/" $(installdir)/usr/lib/*.la
144
145 install:
146         dh_testdir
147         dh_testroot
148         dh_clean -k
149         dh_installdirs
150         for f in $(FLAVORS); do \
151             debian/rules install-$$f; \
152         done
153
154 binary-indep: build install
155         dh_testdir
156         dh_testroot
157         dh_install -i
158         dh_installchangelogs -i ChangeLog
159         dh_installdocs -i -A NEWS README AUTHORS
160         dh_link -i
161         dh_compress -i
162         dh_fixperms -i
163         dh_installdeb -i
164         dh_gencontrol -i
165         dh_md5sums -i
166         dh_builddeb -i
167
168 binary-arch: build install
169         dh_testdir
170         dh_testroot
171         dh_install -s
172         dh_installdocs -s -A README NEWS AUTHORS
173         dh_installchangelogs -s ChangeLog
174         dh_installman -s
175         dh_installexamples -s
176         dh_link -s
177         dh_strip -s --dbg-package=libcairo2-dbg
178         dh_compress -s
179         dh_fixperms -s
180         dh_makeshlibs -plibcairo2 -V 'libcairo2 (>= 1.8.0-2)' -- -c4
181         dh_installdeb -s
182         dh_shlibdeps -s
183         dh_perl -s
184         dh_gencontrol -s
185         dh_md5sums -s
186         dh_builddeb -s
187
188 binary: binary-indep binary-arch
189
190 .PHONY: build clean binary-indep binary-arch binary install patch unpatch clean