| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 1 | #!/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. | 
|  | 17 | export DH_OPTIONS | 
|  | 18 |  | 
|  | 19 | PYVERS := $(shell pyversions -r) | 
|  | 20 |  | 
| Roger Meier | 681e604 | 2016-01-10 16:25:57 +0100 | [diff] [blame] | 21 | export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) | 
|  | 22 | export CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) | 
|  | 23 | export CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) | 
|  | 24 | export LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) | 
|  | 25 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 26 | configure: configure-stamp | 
|  | 27 | configure-stamp: | 
|  | 28 | dh_testdir | 
| Roger Meier | 681e604 | 2016-01-10 16:25:57 +0100 | [diff] [blame] | 29 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 30 | # Add here commands to configure the package. | 
|  | 31 | if [ -f bootstrap.sh ]; then $(CURDIR)/bootstrap.sh; fi | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 32 | $(CURDIR)/configure --prefix=/usr | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 33 |  | 
|  | 34 | touch configure-stamp | 
|  | 35 |  | 
|  | 36 |  | 
|  | 37 | #Architecture | 
|  | 38 | build: build-arch build-indep | 
|  | 39 | # Tests disabled | 
|  | 40 | # $(MAKE) -C test check | 
|  | 41 |  | 
|  | 42 | build-arch: build-arch-stamp | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 43 | $(CURDIR)/compiler/cpp/thrift build-arch-stamp: configure-stamp | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 44 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 45 | # Compile C++ library | 
|  | 46 | $(MAKE) -C $(CURDIR)/lib/cpp | 
|  | 47 |  | 
| Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 48 | # Compile compiler | 
|  | 49 | $(MAKE) -C $(CURDIR)/compiler/cpp | 
|  | 50 |  | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 51 | # Compile C (glib) library | 
|  | 52 | $(MAKE) -C $(CURDIR)/lib/c_glib | 
|  | 53 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 54 | # 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 Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 61 | # PHP | 
|  | 62 | cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \ | 
|  | 63 | phpize && \ | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 64 | ./configure && $(MAKE) | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 65 |  | 
|  | 66 | touch $@ | 
|  | 67 |  | 
|  | 68 | build-indep: build-indep-stamp | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 69 | build-indep-stamp: configure-stamp $(CURDIR)/compiler/cpp/thrift | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 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 Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 78 | # C# | 
|  | 79 | $(MAKE) -C $(CURDIR)/lib/csharp | 
|  | 80 |  | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 81 | # Ruby | 
|  | 82 | $(MAKE) -C $(CURDIR)/lib/rb | 
|  | 83 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 84 | # Perl | 
|  | 85 | $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor | 
|  | 86 |  | 
|  | 87 | touch $@ | 
|  | 88 |  | 
|  | 89 | clean: | 
|  | 90 | dh_testdir | 
|  | 91 | dh_testroot | 
|  | 92 | rm -f build-arch-stamp build-indep-stamp configure-stamp | 
|  | 93 |  | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 94 | cd $(CURDIR)/lib/py && python setup.py clean --all | 
|  | 95 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 96 | # Add here commands to clean up after the build process. | 
|  | 97 | -$(MAKE) clean | 
|  | 98 |  | 
|  | 99 | dh_clean | 
|  | 100 |  | 
|  | 101 | install: install-indep install-arch | 
|  | 102 | install-indep: | 
|  | 103 | dh_testdir | 
|  | 104 | dh_testroot | 
|  | 105 | dh_clean -k -i | 
|  | 106 | dh_installdirs -i | 
|  | 107 |  | 
|  | 108 | # Add here commands to install the indep part of the package into | 
|  | 109 | # debian/<package>-doc. | 
|  | 110 | #INSTALLDOC# | 
|  | 111 |  | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 112 | # Java | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 113 | mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \ | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 114 | cp $(CURDIR)/lib/java/build/libthrift*.jar \ | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 115 | $(CURDIR)/debian/libthrift-java/usr/share/java/ | 
|  | 116 |  | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 117 | # Ruby | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 118 | mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 && \ | 
|  | 119 | cp $(CURDIR)/lib/rb/lib/thrift.rb \ | 
|  | 120 | $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 | 
|  | 121 | cp -r $(CURDIR)/lib/rb/lib/thrift \ | 
|  | 122 | $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 | 
|  | 123 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 124 | # C# | 
|  | 125 | mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \ | 
|  | 126 | cp $(CURDIR)/lib/csharp/Thrift.dll \ | 
|  | 127 | $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll | 
|  | 128 |  | 
|  | 129 | # Perl | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 130 | $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl | 
|  | 131 | mv $(CURDIR)/debian/libthrift-perl/usr/local/lib/perl5 $(CURDIR)/debian/libthrift-perl/usr/lib | 
|  | 132 | rmdir $(CURDIR)/debian/libthrift-perl/usr/local/lib | 
|  | 133 | rmdir $(CURDIR)/debian/libthrift-perl/usr/local | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 134 |  | 
|  | 135 | dh_install -i | 
|  | 136 |  | 
|  | 137 | install-arch: | 
|  | 138 | dh_testdir | 
|  | 139 | dh_testroot | 
|  | 140 | dh_clean -k -s | 
|  | 141 | dh_installdirs -s | 
|  | 142 |  | 
|  | 143 | # Add here commands to install the arch part of the package into | 
|  | 144 | # debian/tmp. | 
|  | 145 | #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install | 
|  | 146 |  | 
| Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 147 | # Compiler | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 148 | mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \ | 
|  | 149 | cp $(CURDIR)/compiler/cpp/thrift \ | 
|  | 150 | $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \ | 
|  | 151 | rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin | 
|  | 152 |  | 
| Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 153 | # Python | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 154 | cd $(CURDIR)/lib/py && \ | 
| Nobuaki Sukegawa | f43d0ca | 2016-03-25 09:22:16 +0900 | [diff] [blame] | 155 | python2 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift && \ | 
|  | 156 | python2-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift-dbg && \ | 
|  | 157 | python3 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift && \ | 
|  | 158 | python3-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift-dbg | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 159 |  | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 160 | find $(CURDIR)/debian/python-thrift -name "*.py[co]" -print0 | xargs -0 rm -f | 
|  | 161 | find $(CURDIR)/debian/python-thrift -name "__pycache__" -print0 | xargs -0 rm -fr | 
|  | 162 | find $(CURDIR)/debian/python-thrift-dbg -name "__pycache__" -print0 | xargs -0 rm -fr | 
|  | 163 | find $(CURDIR)/debian/python-thrift-dbg -name "*.py[co]" -print0 | xargs -0 rm -f | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 164 | find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 165 | find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 166 | find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \; | 
|  | 167 |  | 
| Nobuaki Sukegawa | f43d0ca | 2016-03-25 09:22:16 +0900 | [diff] [blame] | 168 | find $(CURDIR)/debian/python3-thrift -name "*.py[co]" -print0 | xargs -0 rm -f | 
|  | 169 | find $(CURDIR)/debian/python3-thrift -name "__pycache__" -print0 | xargs -0 rm -fr | 
|  | 170 | find $(CURDIR)/debian/python3-thrift-dbg -name "__pycache__" -print0 | xargs -0 rm -fr | 
|  | 171 | find $(CURDIR)/debian/python3-thrift-dbg -name "*.py[co]" -print0 | xargs -0 rm -f | 
|  | 172 | find $(CURDIR)/debian/python3-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f | 
|  | 173 | find $(CURDIR)/debian/python3-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf | 
|  | 174 | find $(CURDIR)/debian/python3-thrift-dbg -depth -type d -empty -exec rmdir {} \; | 
|  | 175 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 176 | # PHP | 
|  | 177 | mkdir -p $(CURDIR)/debian/php5-thrift | 
|  | 178 | cd $(CURDIR)/lib/php && \ | 
|  | 179 | $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install | 
|  | 180 |  | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 181 | # C++ and C (glib) | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 182 | mkdir -p $(CURDIR)/debian/tmp; \ | 
|  | 183 | cd $(CURDIR)/lib/cpp && \ | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 184 | $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 185 | cd $(CURDIR)/lib/c_glib && \ | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 186 | $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 187 |  | 
|  | 188 | dh_install --sourcedir=debian/tmp -s | 
|  | 189 |  | 
|  | 190 |  | 
|  | 191 | # Must not depend on anything. This is to be called by | 
|  | 192 | # binary-arch/binary-indep | 
|  | 193 | # in another 'make' thread. | 
|  | 194 | binary-common: | 
|  | 195 | dh_testdir | 
|  | 196 | dh_testroot | 
|  | 197 | dh_installchangelogs | 
|  | 198 | dh_installdocs | 
|  | 199 | dh_installexamples | 
|  | 200 | dh_installman | 
|  | 201 | dh_link | 
| Akira | f457780 | 2016-04-16 02:09:49 +0900 | [diff] [blame] | 202 | dh_strip -ppython-thrift --dbg-package=python-thrift-dbg | 
|  | 203 | dh_strip -ppython3-thrift --dbg-package=python3-thrift-dbg | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 204 | dh_strip -pthrift-compiler -plibthrift0 | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 205 | dh_compress | 
|  | 206 | dh_fixperms | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 207 | dh_makeshlibs | 
|  | 208 | dh_installdeb | 
|  | 209 | dh_perl | 
|  | 210 | dh_shlibdeps | 
|  | 211 | dh_gencontrol | 
|  | 212 | dh_md5sums | 
|  | 213 | dh_builddeb | 
| Konrad Grochowski | 3b5dacb | 2014-11-24 10:55:31 +0100 | [diff] [blame] | 214 | # Build architecture independent packages using the common target. | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 215 | binary-indep: build-indep install-indep | 
|  | 216 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common | 
|  | 217 |  | 
| Konrad Grochowski | 3b5dacb | 2014-11-24 10:55:31 +0100 | [diff] [blame] | 218 | # Build architecture dependent packages using the common target. | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 219 | binary-arch: build-arch install-arch | 
| Nobuaki Sukegawa | 93bbdc8 | 2016-03-25 08:51:09 +0900 | [diff] [blame] | 220 | echo "php:Depends=phpapi-$(shell php-config5 --phpapi)" > $(CURDIR)/debian/substvars | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 221 | $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common | 
|  | 222 |  | 
|  | 223 | binary: binary-arch binary-indep | 
|  | 224 | .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure |