blob: 4a552d05f6ac157c0f6a9ad66b867680d75153a6 [file] [log] [blame]
Roger Meier08dc7e82010-12-14 21:38:00 +00001#!/usr/bin/make -f
2# -*- makefile -*-
3# Sample debian/rules that uses debhelper.
4#
5# This file was originally written by Joey Hess and Craig Small.
6# As a special exception, when this file is copied by dh-make into a
7# dh-make output file, you may use that output file without restriction.
8# This special exception was added by Craig Small in version 0.37 of dh-make.
9#
10# Modified to make a template file for a multi-binary package with separated
11# build-arch and build-indep targets by Bill Allombert 2001
12
13# Uncomment this to turn on verbose mode.
14#export DH_VERBOSE=1
15
16# This has to be exported to make some magic below work.
17export DH_OPTIONS
18
19PYVERS := $(shell pyversions -r)
20
21configure: configure-stamp
22configure-stamp:
23 dh_testdir
24 # Add here commands to configure the package.
25 if [ -f bootstrap.sh ]; then $(CURDIR)/bootstrap.sh; fi
Jake Farrell5d85bbc2011-11-09 15:24:25 +000026 $(CURDIR)/configure --prefix=/usr --with-c_glib --without-erlang
Roger Meier08dc7e82010-12-14 21:38:00 +000027
28 touch configure-stamp
29
30
31#Architecture
32build: build-arch build-indep
33 # Tests disabled
34 # $(MAKE) -C test check
35
36build-arch: build-arch-stamp
37build-arch-stamp: configure-stamp
38
39 # Compile compiler
40 $(MAKE) -C $(CURDIR)/compiler/cpp
41
42 # Compile C++ library
43 $(MAKE) -C $(CURDIR)/lib/cpp
44
Roger Meierf3a51e62011-04-12 20:36:12 +000045 # Compile C (glib) library
46 $(MAKE) -C $(CURDIR)/lib/c_glib
47
Roger Meier08dc7e82010-12-14 21:38:00 +000048 # Python library
49 cd $(CURDIR)/lib/py && \
50 for py in $(PYVERS); do \
51 $$py setup.py build; \
52 $$py-dbg setup.py build; \
53 done
54
Roger Meier08dc7e82010-12-14 21:38:00 +000055 # PHP
56 cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \
57 phpize && \
58 ./configure && make
59
60 touch $@
61
62build-indep: build-indep-stamp
63build-indep-stamp: configure-stamp
64
65 # Add here commands to compile the indep part of the package.
66 #$(MAKE) doc
67
68 # Java
69 cd $(CURDIR)/lib/java && \
70 ant
71
Roger Meier08dc7e82010-12-14 21:38:00 +000072 # C#
73 $(MAKE) -C $(CURDIR)/lib/csharp
74
75 # Perl
76 $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor
77
78 touch $@
79
80clean:
81 dh_testdir
82 dh_testroot
83 rm -f build-arch-stamp build-indep-stamp configure-stamp
84
85 # Add here commands to clean up after the build process.
86 -$(MAKE) clean
87
88 dh_clean
89
90install: install-indep install-arch
91install-indep:
92 dh_testdir
93 dh_testroot
94 dh_clean -k -i
95 dh_installdirs -i
96
97 # Add here commands to install the indep part of the package into
98 # debian/<package>-doc.
99 #INSTALLDOC#
100
Jake Farrellc965dda2011-11-06 20:29:26 +0000101 # Java
Roger Meier08dc7e82010-12-14 21:38:00 +0000102 mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \
Roger Meierf3a51e62011-04-12 20:36:12 +0000103 cp $(CURDIR)/lib/java/build/libthrift*.jar \
Roger Meier08dc7e82010-12-14 21:38:00 +0000104 $(CURDIR)/debian/libthrift-java/usr/share/java/
105
Roger Meier08dc7e82010-12-14 21:38:00 +0000106 # C#
107 mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \
108 cp $(CURDIR)/lib/csharp/Thrift.dll \
109 $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll
110
111 # Perl
112 $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl/usr
113
114 dh_install -i
115
116install-arch:
117 dh_testdir
118 dh_testroot
119 dh_clean -k -s
120 dh_installdirs -s
121
122 # Add here commands to install the arch part of the package into
123 # debian/tmp.
124 #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install
125
Jake Farrellc965dda2011-11-06 20:29:26 +0000126 # Compiler
Roger Meier08dc7e82010-12-14 21:38:00 +0000127 mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \
128 cp $(CURDIR)/compiler/cpp/thrift \
129 $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \
130 rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin
131
Jake Farrellc965dda2011-11-06 20:29:26 +0000132 # Python
Roger Meier08dc7e82010-12-14 21:38:00 +0000133 cd $(CURDIR)/lib/py && \
134 for py in $(PYVERS); do \
135 $$py setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift; \
136 $$py-dbg setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift-dbg; \
137 done
138
139 find $(CURDIR)/debian/python-thrift-dbg -name "*.pyc" -print0 | xargs -0 rm -f
140 find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f
141 find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -f
142 find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \;
143
Roger Meier08dc7e82010-12-14 21:38:00 +0000144 # PHP
145 mkdir -p $(CURDIR)/debian/php5-thrift
146 cd $(CURDIR)/lib/php && \
147 $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install
148
Roger Meierf3a51e62011-04-12 20:36:12 +0000149 # C++ and C (glib)
Roger Meier08dc7e82010-12-14 21:38:00 +0000150 mkdir -p $(CURDIR)/debian/tmp; \
151 cd $(CURDIR)/lib/cpp && \
152 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meierf3a51e62011-04-12 20:36:12 +0000153 cd $(CURDIR)/lib/c_glib && \
154 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meier08dc7e82010-12-14 21:38:00 +0000155
156 dh_install --sourcedir=debian/tmp -s
157
158
159# Must not depend on anything. This is to be called by
160# binary-arch/binary-indep
161# in another 'make' thread.
162binary-common:
163 dh_testdir
164 dh_testroot
165 dh_installchangelogs
166 dh_installdocs
167 dh_installexamples
168 dh_installman
169 dh_link
Jake Farrellc965dda2011-11-06 20:29:26 +0000170 dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 --dbg=python-thrift-dbg
Roger Meier08dc7e82010-12-14 21:38:00 +0000171 dh_strip -Npython-thrift-dbg
172 dh_compress
173 dh_fixperms
174 dh_pysupport
175 dh_makeshlibs
176 dh_installdeb
177 dh_perl
178 dh_shlibdeps
179 dh_gencontrol
180 dh_md5sums
181 dh_builddeb
182# Build architecture independant packages using the common target.
183binary-indep: build-indep install-indep
184 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
185
186# Build architecture dependant packages using the common target.
187binary-arch: build-arch install-arch
188 echo "php:Depends=phpapi-$(php-config5 --phpapi)" > debian/substvars
189 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
190
191binary: binary-arch binary-indep
192.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure