| 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 |  | 
|  | 21 | configure: configure-stamp | 
|  | 22 | configure-stamp: | 
|  | 23 | dh_testdir | 
|  | 24 | # Add here commands to configure the package. | 
|  | 25 | if [ -f bootstrap.sh ]; then $(CURDIR)/bootstrap.sh; fi | 
| Jake Farrell | 5d85bbc | 2011-11-09 15:24:25 +0000 | [diff] [blame] | 26 | $(CURDIR)/configure --prefix=/usr --with-c_glib --without-erlang | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 27 |  | 
|  | 28 | touch configure-stamp | 
|  | 29 |  | 
|  | 30 |  | 
|  | 31 | #Architecture | 
|  | 32 | build: build-arch build-indep | 
|  | 33 | # Tests disabled | 
|  | 34 | # $(MAKE) -C test check | 
|  | 35 |  | 
|  | 36 | build-arch: build-arch-stamp | 
|  | 37 | build-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 Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 45 | # Compile C (glib) library | 
|  | 46 | $(MAKE) -C $(CURDIR)/lib/c_glib | 
|  | 47 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 48 | # 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 Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 55 | # PHP | 
|  | 56 | cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \ | 
|  | 57 | phpize && \ | 
|  | 58 | ./configure && make | 
|  | 59 |  | 
|  | 60 | touch $@ | 
|  | 61 |  | 
|  | 62 | build-indep: build-indep-stamp | 
|  | 63 | build-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 Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 72 | # C# | 
|  | 73 | $(MAKE) -C $(CURDIR)/lib/csharp | 
|  | 74 |  | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 75 | # Ruby | 
|  | 76 | $(MAKE) -C $(CURDIR)/lib/rb | 
|  | 77 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 78 | # Perl | 
|  | 79 | $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor | 
|  | 80 |  | 
|  | 81 | touch $@ | 
|  | 82 |  | 
|  | 83 | clean: | 
|  | 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 |  | 
|  | 93 | install: install-indep install-arch | 
|  | 94 | install-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 Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 104 | # Java | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 105 | mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \ | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 106 | cp $(CURDIR)/lib/java/build/libthrift*.jar \ | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 107 | $(CURDIR)/debian/libthrift-java/usr/share/java/ | 
|  | 108 |  | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 109 | # 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 Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 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 |  | 
|  | 131 | install-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 Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 141 | # Compiler | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 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 |  | 
| Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 147 | # Python | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 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 | 
| Roger Meier | 38b7d07 | 2011-12-09 10:36:05 +0000 | [diff] [blame] | 156 | 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] | 157 | find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \; | 
|  | 158 |  | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 159 | # PHP | 
|  | 160 | mkdir -p $(CURDIR)/debian/php5-thrift | 
|  | 161 | cd $(CURDIR)/lib/php && \ | 
|  | 162 | $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install | 
|  | 163 |  | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 164 | # C++ and C (glib) | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 165 | mkdir -p $(CURDIR)/debian/tmp; \ | 
|  | 166 | cd $(CURDIR)/lib/cpp && \ | 
|  | 167 | make DESTDIR=$(CURDIR)/debian/tmp install | 
| Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 168 | cd $(CURDIR)/lib/c_glib && \ | 
|  | 169 | make DESTDIR=$(CURDIR)/debian/tmp install | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 170 |  | 
|  | 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. | 
|  | 177 | binary-common: | 
|  | 178 | dh_testdir | 
|  | 179 | dh_testroot | 
|  | 180 | dh_installchangelogs | 
|  | 181 | dh_installdocs | 
|  | 182 | dh_installexamples | 
|  | 183 | dh_installman | 
|  | 184 | dh_link | 
| Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 185 | dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 --dbg=python-thrift-dbg | 
| Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 186 | dh_strip -Npython-thrift-dbg | 
|  | 187 | dh_compress | 
|  | 188 | dh_fixperms | 
|  | 189 | dh_pysupport | 
|  | 190 | dh_makeshlibs | 
|  | 191 | dh_installdeb | 
|  | 192 | dh_perl | 
|  | 193 | dh_shlibdeps | 
|  | 194 | dh_gencontrol | 
|  | 195 | dh_md5sums | 
|  | 196 | dh_builddeb | 
|  | 197 | # Build architecture independant packages using the common target. | 
|  | 198 | binary-indep: build-indep install-indep | 
|  | 199 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common | 
|  | 200 |  | 
|  | 201 | # Build architecture dependant packages using the common target. | 
|  | 202 | binary-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 |  | 
|  | 206 | binary: binary-arch binary-indep | 
|  | 207 | .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure |