blob: 1eef26e1d47d3559038588484d72d94e7c640dfe [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
Roger Meierf3a51e62011-04-12 20:36:12 +000026 $(CURDIR)/configure --prefix=/usr --with-c_glib
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
55 # Ruby library
56 cd $(CURDIR)/lib/rb && \
57 ruby setup.rb config --installdirs=std && \
58 ruby setup.rb setup
59
60 # PHP
61 cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \
62 phpize && \
63 ./configure && make
64
65 touch $@
66
67build-indep: build-indep-stamp
68build-indep-stamp: configure-stamp
69
70 # Add here commands to compile the indep part of the package.
71 #$(MAKE) doc
72
73 # Java
74 cd $(CURDIR)/lib/java && \
75 ant
76
77 # Erlang
78 $(MAKE) -C $(CURDIR)/lib/erl
79
80 # C#
81 $(MAKE) -C $(CURDIR)/lib/csharp
82
83 # Perl
84 $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor
85
86 touch $@
87
88clean:
89 dh_testdir
90 dh_testroot
91 rm -f build-arch-stamp build-indep-stamp configure-stamp
92
93 # Add here commands to clean up after the build process.
94 -$(MAKE) clean
95
96 dh_clean
97
98install: install-indep install-arch
99install-indep:
100 dh_testdir
101 dh_testroot
102 dh_clean -k -i
103 dh_installdirs -i
104
105 # Add here commands to install the indep part of the package into
106 # debian/<package>-doc.
107 #INSTALLDOC#
108
109 # Java
110 mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \
Roger Meierf3a51e62011-04-12 20:36:12 +0000111 cp $(CURDIR)/lib/java/build/libthrift*.jar \
Roger Meier08dc7e82010-12-14 21:38:00 +0000112 $(CURDIR)/debian/libthrift-java/usr/share/java/
113
114 # Erlang
115 mkdir -p $(CURDIR)/debian/libthrift-erlang/usr/lib/erlang/lib/thrift/ && \
116 cp -r $(CURDIR)/lib/erl/ebin \
117 $(CURDIR)/lib/erl/include \
118 $(CURDIR)/lib/erl/src \
119 $(CURDIR)/debian/libthrift-erlang/usr/lib/erlang/lib/thrift/
120
121 # C#
122 mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \
123 cp $(CURDIR)/lib/csharp/Thrift.dll \
124 $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll
125
126 # Perl
127 $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl/usr
128
129 dh_install -i
130
131install-arch:
132 dh_testdir
133 dh_testroot
134 dh_clean -k -s
135 dh_installdirs -s
136
137 # Add here commands to install the arch part of the package into
138 # debian/tmp.
139 #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install
140
141 #compiler
142 mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \
143 cp $(CURDIR)/compiler/cpp/thrift \
144 $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \
145 rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin
146
147 #python
148 cd $(CURDIR)/lib/py && \
149 for py in $(PYVERS); do \
150 $$py setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift; \
151 $$py-dbg setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift-dbg; \
152 done
153
154 find $(CURDIR)/debian/python-thrift-dbg -name "*.pyc" -print0 | xargs -0 rm -f
155 find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f
156 find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -f
157 find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \;
158
159 #ruby
160 mkdir -p $(CURDIR)/debian/libthrift-ruby && \
161 cd $(CURDIR)/lib/rb && \
162 ruby setup.rb install --prefix=$(CURDIR)/debian/libthrift-ruby
163
164 # PHP
165 mkdir -p $(CURDIR)/debian/php5-thrift
166 cd $(CURDIR)/lib/php && \
167 $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install
168
Roger Meierf3a51e62011-04-12 20:36:12 +0000169 # C++ and C (glib)
Roger Meier08dc7e82010-12-14 21:38:00 +0000170 mkdir -p $(CURDIR)/debian/tmp; \
171 cd $(CURDIR)/lib/cpp && \
172 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meierf3a51e62011-04-12 20:36:12 +0000173 cd $(CURDIR)/lib/c_glib && \
174 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meier08dc7e82010-12-14 21:38:00 +0000175
176 dh_install --sourcedir=debian/tmp -s
177
178
179# Must not depend on anything. This is to be called by
180# binary-arch/binary-indep
181# in another 'make' thread.
182binary-common:
183 dh_testdir
184 dh_testroot
185 dh_installchangelogs
186 dh_installdocs
187 dh_installexamples
188 dh_installman
189 dh_link
190 dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 -Nlibthrift-ruby --dbg=python-thrift-dbg
191 dh_strip -Npython-thrift-dbg
192 dh_compress
193 dh_fixperms
194 dh_pysupport
195 dh_makeshlibs
196 dh_installdeb
197 dh_perl
198 dh_shlibdeps
199 dh_gencontrol
200 dh_md5sums
201 dh_builddeb
202# Build architecture independant packages using the common target.
203binary-indep: build-indep install-indep
204 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
205
206# Build architecture dependant packages using the common target.
207binary-arch: build-arch install-arch
208 echo "php:Depends=phpapi-$(php-config5 --phpapi)" > debian/substvars
209 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
210
211binary: binary-arch binary-indep
212.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure