blob: 9b436d97aaae2d4e5255e74e172c80a30c61900e [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
James E. King, III71eba642017-01-25 20:41:06 -050032 $(CURDIR)/configure --prefix=/usr --enable-plugin=no
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
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +090043$(CURDIR)/compiler/cpp/thrift build-arch-stamp: configure-stamp
Roger Meier08dc7e82010-12-14 21:38:00 +000044
Nobuaki Sukegawa11da87e2016-09-10 14:02:19 +090045 # Compile compiler
46 $(MAKE) -C $(CURDIR)/compiler/cpp
47
James E. King, III71eba642017-01-25 20:41:06 -050048 # 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 && \
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +090064 ./configure && $(MAKE)
Roger Meier08dc7e82010-12-14 21:38:00 +000065
66 touch $@
67
68build-indep: build-indep-stamp
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +090069build-indep-stamp: configure-stamp $(CURDIR)/compiler/cpp/thrift
Roger Meier08dc7e82010-12-14 21:38:00 +000070
71 # Add here commands to compile the indep part of the package.
72 #$(MAKE) doc
73
74 # Java
75 cd $(CURDIR)/lib/java && \
Alex Volanis7004a612018-01-24 10:30:13 -050076 ./gradlew --no-daemon -Prelease=true jar
Roger Meier08dc7e82010-12-14 21:38:00 +000077
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
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +090094 cd $(CURDIR)/lib/py && python setup.py clean --all
95
Roger Meier08dc7e82010-12-14 21:38:00 +000096 # Add here commands to clean up after the build process.
97 -$(MAKE) clean
98
jfarrell0c273522016-12-19 14:57:54 -050099 $(CURDIR)/cleanup.sh
100
Roger Meier08dc7e82010-12-14 21:38:00 +0000101 dh_clean
102
103install: install-indep install-arch
104install-indep:
105 dh_testdir
106 dh_testroot
jfarrell0c273522016-12-19 14:57:54 -0500107 dh_prep -i
Roger Meier08dc7e82010-12-14 21:38:00 +0000108 dh_installdirs -i
109
110 # Add here commands to install the indep part of the package into
111 # debian/<package>-doc.
112 #INSTALLDOC#
113
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900114 # Java
Roger Meier08dc7e82010-12-14 21:38:00 +0000115 mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \
Alex Volanis7004a612018-01-24 10:30:13 -0500116 cp $(CURDIR)/lib/java/build/libs/libthrift*.jar \
Roger Meier08dc7e82010-12-14 21:38:00 +0000117 $(CURDIR)/debian/libthrift-java/usr/share/java/
118
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900119 # Ruby
Roger Meier38b7d072011-12-09 10:36:05 +0000120 mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 && \
121 cp $(CURDIR)/lib/rb/lib/thrift.rb \
122 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
123 cp -r $(CURDIR)/lib/rb/lib/thrift \
124 $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1
125
Roger Meier08dc7e82010-12-14 21:38:00 +0000126 # C#
127 mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \
128 cp $(CURDIR)/lib/csharp/Thrift.dll \
129 $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll
130
131 # Perl
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900132 $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl
James E. King, IIIbd257f12017-02-08 13:05:33 -0500133 mkdir -p $(CURDIR)/debian/libthrift-perl/usr/share
134 mv $(CURDIR)/debian/libthrift-perl/usr/local/lib/perl5 $(CURDIR)/debian/libthrift-perl/usr/share
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900135 rmdir $(CURDIR)/debian/libthrift-perl/usr/local/lib
136 rmdir $(CURDIR)/debian/libthrift-perl/usr/local
Roger Meier08dc7e82010-12-14 21:38:00 +0000137
138 dh_install -i
139
140install-arch:
141 dh_testdir
142 dh_testroot
143 dh_clean -k -s
144 dh_installdirs -s
145
146 # Add here commands to install the arch part of the package into
147 # debian/tmp.
148 #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install
149
Jake Farrellc965dda2011-11-06 20:29:26 +0000150 # Compiler
Roger Meier08dc7e82010-12-14 21:38:00 +0000151 mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \
152 cp $(CURDIR)/compiler/cpp/thrift \
153 $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \
154 rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin
155
Jake Farrellc965dda2011-11-06 20:29:26 +0000156 # Python
Roger Meier08dc7e82010-12-14 21:38:00 +0000157 cd $(CURDIR)/lib/py && \
Nobuaki Sukegawaf43d0ca2016-03-25 09:22:16 +0900158 python2 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift && \
159 python2-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift-dbg && \
160 python3 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift && \
161 python3-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift-dbg
Roger Meier08dc7e82010-12-14 21:38:00 +0000162
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900163 find $(CURDIR)/debian/python-thrift -name "*.py[co]" -print0 | xargs -0 rm -f
164 find $(CURDIR)/debian/python-thrift -name "__pycache__" -print0 | xargs -0 rm -fr
165 find $(CURDIR)/debian/python-thrift-dbg -name "__pycache__" -print0 | xargs -0 rm -fr
166 find $(CURDIR)/debian/python-thrift-dbg -name "*.py[co]" -print0 | xargs -0 rm -f
Roger Meier08dc7e82010-12-14 21:38:00 +0000167 find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f
Roger Meier38b7d072011-12-09 10:36:05 +0000168 find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf
Roger Meier08dc7e82010-12-14 21:38:00 +0000169 find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \;
170
Nobuaki Sukegawaf43d0ca2016-03-25 09:22:16 +0900171 find $(CURDIR)/debian/python3-thrift -name "*.py[co]" -print0 | xargs -0 rm -f
172 find $(CURDIR)/debian/python3-thrift -name "__pycache__" -print0 | xargs -0 rm -fr
173 find $(CURDIR)/debian/python3-thrift-dbg -name "__pycache__" -print0 | xargs -0 rm -fr
174 find $(CURDIR)/debian/python3-thrift-dbg -name "*.py[co]" -print0 | xargs -0 rm -f
175 find $(CURDIR)/debian/python3-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f
176 find $(CURDIR)/debian/python3-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf
177 find $(CURDIR)/debian/python3-thrift-dbg -depth -type d -empty -exec rmdir {} \;
178
Roger Meier08dc7e82010-12-14 21:38:00 +0000179 # PHP
180 mkdir -p $(CURDIR)/debian/php5-thrift
181 cd $(CURDIR)/lib/php && \
182 $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install
183
Roger Meierf3a51e62011-04-12 20:36:12 +0000184 # C++ and C (glib)
Roger Meier08dc7e82010-12-14 21:38:00 +0000185 mkdir -p $(CURDIR)/debian/tmp; \
186 cd $(CURDIR)/lib/cpp && \
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900187 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
Roger Meierf3a51e62011-04-12 20:36:12 +0000188 cd $(CURDIR)/lib/c_glib && \
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900189 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
Roger Meier08dc7e82010-12-14 21:38:00 +0000190
191 dh_install --sourcedir=debian/tmp -s
192
193
194# Must not depend on anything. This is to be called by
195# binary-arch/binary-indep
196# in another 'make' thread.
197binary-common:
198 dh_testdir
199 dh_testroot
200 dh_installchangelogs
201 dh_installdocs
202 dh_installexamples
203 dh_installman
204 dh_link
James E. King, III9b1544d2017-03-10 06:14:18 -0500205 dh_strip -plibthrift0 --dbg-package=libthrift0-dbg
Akiraf4577802016-04-16 02:09:49 +0900206 dh_strip -ppython-thrift --dbg-package=python-thrift-dbg
207 dh_strip -ppython3-thrift --dbg-package=python3-thrift-dbg
James E. King, III9b1544d2017-03-10 06:14:18 -0500208 dh_strip -pthrift-compiler
Roger Meier08dc7e82010-12-14 21:38:00 +0000209 dh_compress
210 dh_fixperms
Roger Meier08dc7e82010-12-14 21:38:00 +0000211 dh_makeshlibs
212 dh_installdeb
213 dh_perl
214 dh_shlibdeps
215 dh_gencontrol
216 dh_md5sums
217 dh_builddeb
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100218# Build architecture independent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000219binary-indep: build-indep install-indep
220 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
221
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100222# Build architecture dependent packages using the common target.
Roger Meier08dc7e82010-12-14 21:38:00 +0000223binary-arch: build-arch install-arch
Nobuaki Sukegawa93bbdc82016-03-25 08:51:09 +0900224 echo "php:Depends=phpapi-$(shell php-config5 --phpapi)" > $(CURDIR)/debian/substvars
Roger Meier08dc7e82010-12-14 21:38:00 +0000225 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
226
227binary: binary-arch binary-indep
228.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure