blob: d8462d1945a9d8070e04625f66c72006528b7669 [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
Roger Meier38b7d072011-12-09 10:36:05 +000075 # Ruby
76 $(MAKE) -C $(CURDIR)/lib/rb
77
Roger Meier08dc7e82010-12-14 21:38:00 +000078 # Perl
79 $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor
80
81 touch $@
82
83clean:
84 dh_testdir
85 dh_testroot
86 rm -f build-arch-stamp build-indep-stamp configure-stamp
87
88 # Add here commands to clean up after the build process.
89 -$(MAKE) clean
90
91 dh_clean
92
93install: install-indep install-arch
94install-indep:
95 dh_testdir
96 dh_testroot
97 dh_clean -k -i
98 dh_installdirs -i
99
100 # Add here commands to install the indep part of the package into
101 # debian/<package>-doc.
102 #INSTALLDOC#
103
Jake Farrellc965dda2011-11-06 20:29:26 +0000104 # Java
Roger Meier08dc7e82010-12-14 21:38:00 +0000105 mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \
Roger Meierf3a51e62011-04-12 20:36:12 +0000106 cp $(CURDIR)/lib/java/build/libthrift*.jar \
Roger Meier08dc7e82010-12-14 21:38:00 +0000107 $(CURDIR)/debian/libthrift-java/usr/share/java/
108
Roger Meier38b7d072011-12-09 10:36:05 +0000109 # Ruby
110 mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.8 && \
111 cp $(CURDIR)/lib/rb/lib/thrift.rb \
112 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.8
113 cp -r $(CURDIR)/lib/rb/lib/thrift \
114 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.8
115 mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 && \
116 cp $(CURDIR)/lib/rb/lib/thrift.rb \
117 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
118 cp -r $(CURDIR)/lib/rb/lib/thrift \
119 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
120
Roger Meier08dc7e82010-12-14 21:38:00 +0000121 # 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
Jake Farrellc965dda2011-11-06 20:29:26 +0000141 # Compiler
Roger Meier08dc7e82010-12-14 21:38:00 +0000142 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
Jake Farrellc965dda2011-11-06 20:29:26 +0000147 # Python
Roger Meier08dc7e82010-12-14 21:38:00 +0000148 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
Roger Meier38b7d072011-12-09 10:36:05 +0000156 find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf
Roger Meier08dc7e82010-12-14 21:38:00 +0000157 find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \;
158
Roger Meier08dc7e82010-12-14 21:38:00 +0000159 # PHP
160 mkdir -p $(CURDIR)/debian/php5-thrift
161 cd $(CURDIR)/lib/php && \
162 $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install
163
Roger Meierf3a51e62011-04-12 20:36:12 +0000164 # C++ and C (glib)
Roger Meier08dc7e82010-12-14 21:38:00 +0000165 mkdir -p $(CURDIR)/debian/tmp; \
166 cd $(CURDIR)/lib/cpp && \
167 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meierf3a51e62011-04-12 20:36:12 +0000168 cd $(CURDIR)/lib/c_glib && \
169 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meier08dc7e82010-12-14 21:38:00 +0000170
171 dh_install --sourcedir=debian/tmp -s
172
173
174# Must not depend on anything. This is to be called by
175# binary-arch/binary-indep
176# in another 'make' thread.
177binary-common:
178 dh_testdir
179 dh_testroot
180 dh_installchangelogs
181 dh_installdocs
182 dh_installexamples
183 dh_installman
184 dh_link
Jake Farrellc965dda2011-11-06 20:29:26 +0000185 dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 --dbg=python-thrift-dbg
Roger Meier08dc7e82010-12-14 21:38:00 +0000186 dh_strip -Npython-thrift-dbg
187 dh_compress
188 dh_fixperms
Roger Meier08dc7e82010-12-14 21:38:00 +0000189 dh_makeshlibs
190 dh_installdeb
191 dh_perl
192 dh_shlibdeps
193 dh_gencontrol
194 dh_md5sums
195 dh_builddeb
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100196# Build architecture independent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000197binary-indep: build-indep install-indep
198 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
199
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100200# Build architecture dependent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000201binary-arch: build-arch install-arch
202 echo "php:Depends=phpapi-$(php-config5 --phpapi)" > debian/substvars
203 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
204
205binary: binary-arch binary-indep
206.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure