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 |
| 26 | $(CURDIR)/configure --prefix=/usr |
| 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 | |
| 45 | # Python library |
| 46 | cd $(CURDIR)/lib/py && \ |
| 47 | for py in $(PYVERS); do \ |
| 48 | $$py setup.py build; \ |
| 49 | $$py-dbg setup.py build; \ |
| 50 | done |
| 51 | |
| 52 | # Ruby library |
| 53 | cd $(CURDIR)/lib/rb && \ |
| 54 | ruby setup.rb config --installdirs=std && \ |
| 55 | ruby setup.rb setup |
| 56 | |
| 57 | # PHP |
| 58 | cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \ |
| 59 | phpize && \ |
| 60 | ./configure && make |
| 61 | |
| 62 | touch $@ |
| 63 | |
| 64 | build-indep: build-indep-stamp |
| 65 | build-indep-stamp: configure-stamp |
| 66 | |
| 67 | # Add here commands to compile the indep part of the package. |
| 68 | #$(MAKE) doc |
| 69 | |
| 70 | # Java |
| 71 | cd $(CURDIR)/lib/java && \ |
| 72 | ant |
| 73 | |
| 74 | # Erlang |
| 75 | $(MAKE) -C $(CURDIR)/lib/erl |
| 76 | |
| 77 | # C# |
| 78 | $(MAKE) -C $(CURDIR)/lib/csharp |
| 79 | |
| 80 | # Perl |
| 81 | $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor |
| 82 | |
| 83 | touch $@ |
| 84 | |
| 85 | clean: |
| 86 | dh_testdir |
| 87 | dh_testroot |
| 88 | rm -f build-arch-stamp build-indep-stamp configure-stamp |
| 89 | |
| 90 | # Add here commands to clean up after the build process. |
| 91 | -$(MAKE) clean |
| 92 | |
| 93 | dh_clean |
| 94 | |
| 95 | install: install-indep install-arch |
| 96 | install-indep: |
| 97 | dh_testdir |
| 98 | dh_testroot |
| 99 | dh_clean -k -i |
| 100 | dh_installdirs -i |
| 101 | |
| 102 | # Add here commands to install the indep part of the package into |
| 103 | # debian/<package>-doc. |
| 104 | #INSTALLDOC# |
| 105 | |
| 106 | # Java |
| 107 | mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \ |
| 108 | cp $(CURDIR)/lib/java/libthrift.jar \ |
| 109 | $(CURDIR)/debian/libthrift-java/usr/share/java/ |
| 110 | |
| 111 | # Erlang |
| 112 | mkdir -p $(CURDIR)/debian/libthrift-erlang/usr/lib/erlang/lib/thrift/ && \ |
| 113 | cp -r $(CURDIR)/lib/erl/ebin \ |
| 114 | $(CURDIR)/lib/erl/include \ |
| 115 | $(CURDIR)/lib/erl/src \ |
| 116 | $(CURDIR)/debian/libthrift-erlang/usr/lib/erlang/lib/thrift/ |
| 117 | |
| 118 | # C# |
| 119 | mkdir -p $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/ && \ |
| 120 | cp $(CURDIR)/lib/csharp/Thrift.dll \ |
| 121 | $(CURDIR)/debian/libthrift-cil/usr/lib/cli/thrift/Thrift.dll |
| 122 | |
| 123 | # Perl |
| 124 | $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl/usr |
| 125 | |
| 126 | dh_install -i |
| 127 | |
| 128 | install-arch: |
| 129 | dh_testdir |
| 130 | dh_testroot |
| 131 | dh_clean -k -s |
| 132 | dh_installdirs -s |
| 133 | |
| 134 | # Add here commands to install the arch part of the package into |
| 135 | # debian/tmp. |
| 136 | #$(MAKE) DESTDIR=$(CURDIR)/debian/thrift install |
| 137 | |
| 138 | #compiler |
| 139 | mkdir -p $(CURDIR)/debian/thrift-compiler/usr/bin && \ |
| 140 | cp $(CURDIR)/compiler/cpp/thrift \ |
| 141 | $(CURDIR)/debian/thrift-compiler/usr/bin/thrift && \ |
| 142 | rmdir $(CURDIR)/debian/thrift-compiler/usr/sbin |
| 143 | |
| 144 | #python |
| 145 | cd $(CURDIR)/lib/py && \ |
| 146 | for py in $(PYVERS); do \ |
| 147 | $$py setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift; \ |
| 148 | $$py-dbg setup.py install --no-compile --root=$(CURDIR)/debian/python-thrift-dbg; \ |
| 149 | done |
| 150 | |
| 151 | find $(CURDIR)/debian/python-thrift-dbg -name "*.pyc" -print0 | xargs -0 rm -f |
| 152 | find $(CURDIR)/debian/python-thrift-dbg -name "*.py" -print0 | xargs -0 rm -f |
| 153 | find $(CURDIR)/debian/python-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -f |
| 154 | find $(CURDIR)/debian/python-thrift-dbg -depth -type d -empty -exec rmdir {} \; |
| 155 | |
| 156 | #ruby |
| 157 | mkdir -p $(CURDIR)/debian/libthrift-ruby && \ |
| 158 | cd $(CURDIR)/lib/rb && \ |
| 159 | ruby setup.rb install --prefix=$(CURDIR)/debian/libthrift-ruby |
| 160 | |
| 161 | # PHP |
| 162 | mkdir -p $(CURDIR)/debian/php5-thrift |
| 163 | cd $(CURDIR)/lib/php && \ |
| 164 | $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install |
| 165 | |
| 166 | #cpp |
| 167 | mkdir -p $(CURDIR)/debian/tmp; \ |
| 168 | cd $(CURDIR)/lib/cpp && \ |
| 169 | make DESTDIR=$(CURDIR)/debian/tmp install |
| 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 |
| 185 | dh_strip -Npython-thrift-dbg -Nthrift-compiler -Nlibthrift0 -Nlibthrift-ruby --dbg=python-thrift-dbg |
| 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 |