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 | |
| 75 | # Perl |
| 76 | $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor |
| 77 | |
| 78 | touch $@ |
| 79 | |
| 80 | clean: |
| 81 | dh_testdir |
| 82 | dh_testroot |
| 83 | rm -f build-arch-stamp build-indep-stamp configure-stamp |
| 84 | |
| 85 | # Add here commands to clean up after the build process. |
| 86 | -$(MAKE) clean |
| 87 | |
| 88 | dh_clean |
| 89 | |
| 90 | install: install-indep install-arch |
| 91 | install-indep: |
| 92 | dh_testdir |
| 93 | dh_testroot |
| 94 | dh_clean -k -i |
| 95 | dh_installdirs -i |
| 96 | |
| 97 | # Add here commands to install the indep part of the package into |
| 98 | # debian/<package>-doc. |
| 99 | #INSTALLDOC# |
| 100 | |
Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 101 | # Java |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 102 | mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \ |
Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 103 | cp $(CURDIR)/lib/java/build/libthrift*.jar \ |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 104 | $(CURDIR)/debian/libthrift-java/usr/share/java/ |
| 105 | |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 106 | # C# |
| 107 | mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \ |
| 108 | cp $(CURDIR)/lib/csharp/Thrift.dll \ |
| 109 | $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll |
| 110 | |
| 111 | # Perl |
| 112 | $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl/usr |
| 113 | |
| 114 | dh_install -i |
| 115 | |
| 116 | install-arch: |
| 117 | dh_testdir |
| 118 | dh_testroot |
| 119 | dh_clean -k -s |
| 120 | dh_installdirs -s |
| 121 | |
| 122 | # Add here commands to install the arch part of the package into |
| 123 | # debian/tmp. |
| 124 | #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install |
| 125 | |
Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 126 | # Compiler |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 127 | mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \ |
| 128 | cp $(CURDIR)/compiler/cpp/thrift \ |
| 129 | $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \ |
| 130 | rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin |
| 131 | |
Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 132 | # Python |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 133 | cd $(CURDIR)/lib/py && \ |
| 134 | for py in $(PYVERS); do \ |
| 135 | $$py setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift; \ |
| 136 | $$py-dbg setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift-dbg; \ |
| 137 | done |
| 138 | |
| 139 | find $(CURDIR)/debian/python-thrift-dbg -name "*.pyc" -print0 | xargs -0 rm -f |
| 140 | find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f |
| 141 | find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -f |
| 142 | find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \; |
| 143 | |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 144 | # PHP |
| 145 | mkdir -p $(CURDIR)/debian/php5-thrift |
| 146 | cd $(CURDIR)/lib/php && \ |
| 147 | $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install |
| 148 | |
Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 149 | # C++ and C (glib) |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 150 | mkdir -p $(CURDIR)/debian/tmp; \ |
| 151 | cd $(CURDIR)/lib/cpp && \ |
| 152 | make DESTDIR=$(CURDIR)/debian/tmp install |
Roger Meier | f3a51e6 | 2011-04-12 20:36:12 +0000 | [diff] [blame] | 153 | cd $(CURDIR)/lib/c_glib && \ |
| 154 | make DESTDIR=$(CURDIR)/debian/tmp install |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 155 | |
| 156 | dh_install --sourcedir=debian/tmp -s |
| 157 | |
| 158 | |
| 159 | # Must not depend on anything. This is to be called by |
| 160 | # binary-arch/binary-indep |
| 161 | # in another 'make' thread. |
| 162 | binary-common: |
| 163 | dh_testdir |
| 164 | dh_testroot |
| 165 | dh_installchangelogs |
| 166 | dh_installdocs |
| 167 | dh_installexamples |
| 168 | dh_installman |
| 169 | dh_link |
Jake Farrell | c965dda | 2011-11-06 20:29:26 +0000 | [diff] [blame] | 170 | dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 --dbg=python-thrift-dbg |
Roger Meier | 08dc7e8 | 2010-12-14 21:38:00 +0000 | [diff] [blame] | 171 | dh_strip -Npython-thrift-dbg |
| 172 | dh_compress |
| 173 | dh_fixperms |
| 174 | dh_pysupport |
| 175 | dh_makeshlibs |
| 176 | dh_installdeb |
| 177 | dh_perl |
| 178 | dh_shlibdeps |
| 179 | dh_gencontrol |
| 180 | dh_md5sums |
| 181 | dh_builddeb |
| 182 | # Build architecture independant packages using the common target. |
| 183 | binary-indep: build-indep install-indep |
| 184 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
| 185 | |
| 186 | # Build architecture dependant packages using the common target. |
| 187 | binary-arch: build-arch install-arch |
| 188 | echo "php:Depends=phpapi-$(php-config5 --phpapi)" > debian/substvars |
| 189 | $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common |
| 190 | |
| 191 | binary: binary-arch binary-indep |
| 192 | .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure |