Tizen 2.0 Release
[profile/ivi/osmesa.git] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules for the Debian mesa package
3 # Copyright © 2006 Thierry Reding <thierry@gilfi.de>
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 CFLAGS = -Wall -g
9 CXXFLAGS = -Wall -g
10 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
11         CFLAGS += -O0
12         CXXFLAGS += -O0
13 else
14         CFLAGS += -O2
15         CXXFLAGS += -O2
16 endif
17 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
18         NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19         MAKEFLAGS += -j$(NUMJOBS)
20 endif
21
22 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
23 DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
24 DEB_HOST_ARCH_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
25 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
26 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
27 DEB_BUILD_DIR      ?= $(CURDIR)/build
28 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
29         confflags += --build=$(DEB_HOST_GNU_TYPE)
30 else
31         confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
32 endif
33
34 # keep a list of files we don't install (yet), but since it's a bit
35 # large, use an external file:
36 include debian/not-installed
37
38 # build the following configurations by default
39 CONFIGS = osmesa
40
41 include /usr/share/quilt/quilt.make
42
43 confflags-common = \
44         --disable-glu \
45         --disable-glut \
46         --disable-glw \
47         --disable-driglx-direct \
48         CFLAGS="$(CFLAGS)" \
49         CXXFLAGS="$(CXXFLAGS)"
50
51         EGL_DISPLAYS = x11
52         GALLIUM_DRIVERS = swrast
53
54 confflags-osmesa = \
55         --disable-gallium-gbm \
56         --disable-gallium-llvm \
57         --without-dri-drivers \
58         --with-driver=osmesa \
59         --with-egl-driver-dir=/usr/lib \
60         --with-gallium-drivers=swrast \
61         --with-egl-platforms=x11 \
62         --enable-gallium-egl \
63         --disable-dri \
64         --disable-glx \
65         --enable-gles1 \
66         --enable-gles2 \
67         $(confflags-common)
68
69 configure: configure.ac
70         autoreconf -vfi
71
72 # list the configurations that will built
73 configs:
74         @echo Building the following configurations: $(CONFIGS)
75
76 build: configure
77         dh_testdir
78
79         mkdir -p $(DEB_BUILD_DIR)/$(CONFIGS)
80         find $(CURDIR)/* -maxdepth 0 -not -path '$(DEB_BUILD_DIR)*' | \
81                 xargs cp -rlf -t $(DEB_BUILD_DIR)/$(CONFIGS)
82
83         cd $(DEB_BUILD_DIR)/$(CONFIGS) && \
84         ../../configure --prefix=/usr --mandir=\$${prefix}/share/man \
85                      --infodir=\$${prefix}/share/info --sysconfdir=/etc \
86                      --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
87                      --localstatedir=/var $(confflags) $(confflags-$(CONFIGS))
88         cd $(DEB_BUILD_DIR)/$(CONFIGS) && $(MAKE)
89
90 install: build
91         # Add here commands to install the package into debian/tmp
92         dh_testdir
93         dh_testroot
94         dh_prep
95         dh_installdirs
96         set -e; for config in $(filter-out dri, $(CONFIGS)); do \
97                 $(MAKE) -C $(DEB_BUILD_DIR)/$$config DESTDIR=$(CURDIR)/debian/tmp install; \
98         done
99
100         for file in debian/*.in; \
101         do \
102                 sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
103                         $${file} > $${file%%.in}; \
104         done
105
106 clean: unpatch
107         dh_testdir
108         rm -rf .pc
109
110         rm -f config.cache config.log config.status
111         rm -f */config.cache */config.log */config.status
112         rm -f conftest* */conftest*
113         rm -rf autom4te.cache */autom4te.cache
114         rm -rf build
115         rm -rf configure config.guess config.sub config.h.in
116         rm -rf $$(find -name Makefile.in)
117         rm -rf aclocal.m4 missing depcomp install-sh ltmain.sh
118         for file in debian/*.in; do rm -f $${file%%.in}; done
119
120         dh_clean
121
122 # Build architecture-independent files here.
123 binary-indep: install
124
125 allpkg = $(shell dh_listpackages -s)
126 dbgpkg = $(filter %-dbg, $(allpkg))
127 otherpkg = $(filter-out %-dbg, $(allpkg))
128 havedbgpkg = $(patsubst %-dbg,%,$(dbgpkg))
129 nodbgpkg = $(filter-out $(havedbgpkg),$(otherpkg))
130
131 # Build architecture-dependent files here.
132 binary-arch: install
133         dh_testdir
134         dh_testroot
135         dh_installchangelogs -s
136         dh_installchangelogs -pmesa-common-dev
137         dh_installdocs -s
138         dh_installexamples -s
139
140         dh_install --sourcedir=debian/tmp 
141         dh_installman -s
142         dh_lintian -s
143         dh_link -s
144         # Install bug control and script:
145         set -e; for p in $(allpkg); do \
146                 install -d debian/$$p/usr/share/bug/$$p && \
147                 install -m 644 debian/local/control debian/$$p/usr/share/bug/$$p && \
148                 install -m 755 debian/local/script  debian/$$p/usr/share/bug/$$p; \
149         done
150         set -e; for p in $(havedbgpkg); do \
151                 dh_strip -p$${p} --dbg-package=$${p}-dbg; \
152         done
153         
154         # dh_strip -s --remaining-packages doesn't work with resumed
155         # builds (see changelog for mesa 7.10-1):
156         dh_strip $(foreach p,$(nodbgpkg),-p$(p))
157         dh_compress -s
158         dh_fixperms -s
159         dh_installdeb -s
160         LD_LIBRARY_PATH=/usr/lib/mesa-gl dh_shlibdeps -s
161         dh_gencontrol -s
162         dh_md5sums -s
163         dh_builddeb $(foreach pkg,$(dbgpkg),-p$(pkg))
164         dh_builddeb $(foreach pkg,$(otherpkg),-p$(pkg))
165
166 binary: binary-indep binary-arch
167 .PHONY: configs build clean binary-indep binary-arch binary install
168
169 # For maintainer use only, generate a tarball:
170 gentarball: SOURCE=mesa
171 gentarball: UV=$(shell dpkg-parsechangelog|awk '/^Version:/ {print $$2}'|sed 's/-.*$$//')
172 gentarball:
173         git archive --format=tar upstream-experimental --prefix=$(SOURCE)-$(UV)/ | gzip -9 > ../$(SOURCE)_$(UV).orig.tar.gz