blob: 2441a4cafee729fd05d447a0a178bfaa0517787d [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
Roger Meier681e6042016-01-10 16:25:57 +010021export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
22export CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
23export CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
24export LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
25
Roger Meier08dc7e82010-12-14 21:38:00 +000026configure: configure-stamp
27configure-stamp:
28 dh_testdir
Roger Meier681e6042016-01-10 16:25:57 +010029
Roger Meier08dc7e82010-12-14 21:38:00 +000030 # Add here commands to configure the package.
31 if [ -f bootstrap.sh ]; then $(CURDIR)/bootstrap.sh; fi
Jake Farrell5d85bbc2011-11-09 15:24:25 +000032 $(CURDIR)/configure --prefix=/usr --with-c_glib --without-erlang
Roger Meier08dc7e82010-12-14 21:38:00 +000033
34 touch configure-stamp
35
36
37#Architecture
38build: build-arch build-indep
39 # Tests disabled
40 # $(MAKE) -C test check
41
42build-arch: build-arch-stamp
43build-arch-stamp: configure-stamp
44
45 # Compile compiler
46 $(MAKE) -C $(CURDIR)/compiler/cpp
47
48 # Compile C++ library
49 $(MAKE) -C $(CURDIR)/lib/cpp
50
Roger Meierf3a51e62011-04-12 20:36:12 +000051 # Compile C (glib) library
52 $(MAKE) -C $(CURDIR)/lib/c_glib
53
Roger Meier08dc7e82010-12-14 21:38:00 +000054 # Python library
55 cd $(CURDIR)/lib/py && \
56 for py in $(PYVERS); do \
57 $$py setup.py build; \
58 $$py-dbg setup.py build; \
59 done
60
Roger Meier08dc7e82010-12-14 21:38:00 +000061 # PHP
62 cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \
63 phpize && \
64 ./configure && make
65
66 touch $@
67
68build-indep: build-indep-stamp
69build-indep-stamp: configure-stamp
70
71 # Add here commands to compile the indep part of the package.
72 #$(MAKE) doc
73
74 # Java
75 cd $(CURDIR)/lib/java && \
76 ant
77
Roger Meier08dc7e82010-12-14 21:38:00 +000078 # C#
79 $(MAKE) -C $(CURDIR)/lib/csharp
80
Roger Meier38b7d072011-12-09 10:36:05 +000081 # Ruby
82 $(MAKE) -C $(CURDIR)/lib/rb
83
Roger Meier08dc7e82010-12-14 21:38:00 +000084 # Perl
85 $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor
86
87 touch $@
88
89clean:
90 dh_testdir
91 dh_testroot
92 rm -f build-arch-stamp build-indep-stamp configure-stamp
93
94 # Add here commands to clean up after the build process.
95 -$(MAKE) clean
96
97 dh_clean
98
99install: install-indep install-arch
100install-indep:
101 dh_testdir
102 dh_testroot
103 dh_clean -k -i
104 dh_installdirs -i
105
106 # Add here commands to install the indep part of the package into
107 # debian/<package>-doc.
108 #INSTALLDOC#
109
Jake Farrellc965dda2011-11-06 20:29:26 +0000110 # Java
Roger Meier08dc7e82010-12-14 21:38:00 +0000111 mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \
Roger Meierf3a51e62011-04-12 20:36:12 +0000112 cp $(CURDIR)/lib/java/build/libthrift*.jar \
Roger Meier08dc7e82010-12-14 21:38:00 +0000113 $(CURDIR)/debian/libthrift-java/usr/share/java/
114
Roger Meier38b7d072011-12-09 10:36:05 +0000115 # Ruby
Roger Meier38b7d072011-12-09 10:36:05 +0000116 mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 && \
117 cp $(CURDIR)/lib/rb/lib/thrift.rb \
118 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
119 cp -r $(CURDIR)/lib/rb/lib/thrift \
120 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
121
Roger Meier08dc7e82010-12-14 21:38:00 +0000122 # C#
123 mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \
124 cp $(CURDIR)/lib/csharp/Thrift.dll \
125 $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll
126
127 # Perl
128 $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl/usr
129
130 dh_install -i
131
132install-arch:
133 dh_testdir
134 dh_testroot
135 dh_clean -k -s
136 dh_installdirs -s
137
138 # Add here commands to install the arch part of the package into
139 # debian/tmp.
140 #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install
141
Jake Farrellc965dda2011-11-06 20:29:26 +0000142 # Compiler
Roger Meier08dc7e82010-12-14 21:38:00 +0000143 mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \
144 cp $(CURDIR)/compiler/cpp/thrift \
145 $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \
146 rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin
147
Jake Farrellc965dda2011-11-06 20:29:26 +0000148 # Python
Roger Meier08dc7e82010-12-14 21:38:00 +0000149 cd $(CURDIR)/lib/py && \
150 for py in $(PYVERS); do \
151 $$py setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift; \
152 $$py-dbg setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift-dbg; \
153 done
154
155 find $(CURDIR)/debian/python-thrift-dbg -name "*.pyc" -print0 | xargs -0 rm -f
156 find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f
Roger Meier38b7d072011-12-09 10:36:05 +0000157 find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf
Roger Meier08dc7e82010-12-14 21:38:00 +0000158 find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \;
159
Roger Meier08dc7e82010-12-14 21:38:00 +0000160 # PHP
161 mkdir -p $(CURDIR)/debian/php5-thrift
162 cd $(CURDIR)/lib/php && \
163 $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install
164
Roger Meierf3a51e62011-04-12 20:36:12 +0000165 # C++ and C (glib)
Roger Meier08dc7e82010-12-14 21:38:00 +0000166 mkdir -p $(CURDIR)/debian/tmp; \
167 cd $(CURDIR)/lib/cpp && \
168 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meierf3a51e62011-04-12 20:36:12 +0000169 cd $(CURDIR)/lib/c_glib && \
170 make DESTDIR=$(CURDIR)/debian/tmp install
Roger Meier08dc7e82010-12-14 21:38:00 +0000171
172 dh_install --sourcedir=debian/tmp -s
173
174
175# Must not depend on anything. This is to be called by
176# binary-arch/binary-indep
177# in another 'make' thread.
178binary-common:
179 dh_testdir
180 dh_testroot
181 dh_installchangelogs
182 dh_installdocs
183 dh_installexamples
184 dh_installman
185 dh_link
Jake Farrellc965dda2011-11-06 20:29:26 +0000186 dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 --dbg=python-thrift-dbg
Roger Meier08dc7e82010-12-14 21:38:00 +0000187 dh_strip -Npython-thrift-dbg
188 dh_compress
189 dh_fixperms
Roger Meier08dc7e82010-12-14 21:38:00 +0000190 dh_makeshlibs
191 dh_installdeb
192 dh_perl
193 dh_shlibdeps
194 dh_gencontrol
195 dh_md5sums
196 dh_builddeb
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100197# Build architecture independent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000198binary-indep: build-indep install-indep
199 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
200
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100201# Build architecture dependent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000202binary-arch: build-arch install-arch
203 echo "php:Depends=phpapi-$(php-config5 --phpapi)" > debian/substvars
204 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
205
206binary: binary-arch binary-indep
207.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure