~ubuntu-branches/debian/stretch/protobuf/stretch

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): Robert S. Edmonds
  • Date: 2014-09-11 22:50:10 UTC
  • mfrom: (10.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20140911225010-wt4yo9dpc1fzuq5g
Tags: 2.6.0-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
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
 
DPKG_EXPORT_BUILDFLAGS = 1
20
 
include /usr/share/dpkg/buildflags.mk
21
 
 
22
 
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
23
 
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
24
 
 
25
 
CC  = gcc
26
 
CXX = g++
27
 
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
28
 
  CC  := $(DEB_HOST_GNU_TYPE)-$(CC)
29
 
  CXX := $(DEB_HOST_GNU_TYPE)-$(CXX)
30
 
endif
31
 
 
32
 
CFLAGS += -Wall
33
 
CXXFLAGS += -Wall -fpermissive
34
 
 
35
 
# Renesas SH(sh4) need -mieee option.
36
 
# If this option is not effective, NaN test failed.
37
 
ifeq (sh4,$(shell dpkg-architecture -qDEB_HOST_ARCH))
38
 
  CFLAGS += -mieee
39
 
  CXXFLAGS += -mieee
40
 
endif
41
 
 
42
 
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
43
 
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
44
 
    PAROPTS = -j$(NUMJOBS)
45
 
else
46
 
    PAROPTS =
47
 
endif
48
 
# end DEB_BUILD_OPTIONS
49
 
 
50
 
version=0.0.0
51
 
major=0
52
 
 
53
 
configure: configure-stamp
54
 
configure-stamp:
55
 
        dh_testdir
56
 
        # Add here commands to configure the package.
57
 
        dh_autoreconf
58
 
        dh_auto_configure
59
 
        touch configure-stamp
60
 
 
61
 
 
62
 
#Architecture
63
 
build: build-arch
64
 
 
65
 
build-arch: build-arch-stamp
66
 
build-arch-stamp: configure-stamp
67
 
 
68
 
        # Add here commands to compile the arch part of the package.
69
 
        $(MAKE) $(PAROPTS)
70
 
 
71
 
        # run the test suite
72
 
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
73
 
        $(MAKE) $(PAROPTS) check
74
 
endif
75
 
 
76
 
        # build the protoc manpage
 
2
 
 
3
%:
 
4
        dh $@ --with autoreconf,python2
 
5
 
 
6
override_dh_auto_build-arch:
 
7
        dh_auto_build --arch
 
8
 
 
9
        # Generate the manpage.
77
10
        xmlto man debian/protoc.xml
78
11
 
79
 
        touch $@
80
 
 
81
 
build-indep: build-indep-stamp
82
 
build-indep-stamp: build-arch-stamp
83
 
 
84
 
        # python bindings
85
 
        cd python && python setup.py build
 
12
        # Python build.
 
13
        cd python && python setup.py build --cpp_implementation
 
14
 
 
15
override_dh_auto_build-indep:
 
16
        dh_auto_build --indep
 
17
 
 
18
        # Java build.
 
19
        ant -f debian/java-build.xml jar
 
20
 
 
21
override_dh_auto_test-arch:
 
22
        dh_auto_test --arch
86
23
 
87
24
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
88
 
        cd python && python setup.py test
 
25
        # Python test.
 
26
        set -e; \
 
27
        export LD_LIBRARY_PATH=$(CURDIR)/src/.libs; \
 
28
        cd python && for python in $(shell pyversions -r); do \
 
29
                $$python setup.py test --cpp_implementation; \
 
30
        done
89
31
endif
90
32
 
91
 
        # java bindings
92
 
        # this code mimics mvn package. This should be changed when maven is supported by debian.
93
 
        $(SHELL) /usr/bin/ant -f debian/java-build.xml jar
94
 
 
95
 
        touch $@
96
 
 
97
 
clean:
98
 
        dh_testdir
99
 
        dh_testroot
100
 
        rm -f build-arch-stamp build-indep-stamp configure-stamp
101
 
 
102
 
        # C++ bindings cleanups
103
 
        [ ! -f Makefile ] || $(MAKE) distclean
104
 
 
105
 
        # remove the built manpage
106
 
        rm -f protoc.1
107
 
 
108
 
        # Python bindings cleanups
109
 
        cd python && python setup.py clean --all
 
33
override_dh_auto_test-indep:
 
34
        :
 
35
 
 
36
override_dh_auto_clean-arch:
 
37
        dh_auto_clean --arch
 
38
 
 
39
        # Python clean.
 
40
        set -e; \
 
41
        cd python && for python in $(shell pyversions -r); do \
 
42
                $$python setup.py clean --all; \
 
43
        done
110
44
        rm -rf python/protobuf.egg-info
111
45
 
112
 
        # Java bindings cleanups
113
 
        $(SHELL) /usr/bin/ant -f debian/java-build.xml clean || true
114
 
 
115
 
        dh_autoreconf_clean
116
 
        dh_clean
117
 
        mh_clean
118
 
 
119
 
install: install-indep install-arch
120
 
install-indep: build-indep
121
 
        dh_testdir
122
 
        dh_testroot
123
 
        dh_prep -i
124
 
        dh_installdirs -i
125
 
 
126
 
        # python bindings
127
 
        cd python && \
128
 
                python setup.py install --install-layout=deb --no-compile \
129
 
                        --root=$(CURDIR)/debian/python-protobuf ; \
130
 
                        find $(CURDIR)/debian/python-protobuf -name 'protobuf-*-nspkg.pth' -print0 | \
131
 
                                xargs -r0 rm -f
132
 
 
133
 
        dh_install -i
 
46
override_dh_auto_clean-indep:
 
47
        dh_auto_clean --indep
 
48
 
 
49
        # Java clean.
 
50
        ant -f debian/java-build.xml clean || true
 
51
        mh_clean || true
 
52
 
 
53
override_dh_auto_install-arch:
 
54
        dh_auto_install --arch
 
55
 
 
56
        # Python install.
 
57
        set -e; \
 
58
        cd python && for python in $(shell pyversions -r); do \
 
59
                $$python setup.py install --cpp_implementation \
 
60
                        --install-layout=deb --no-compile \
 
61
                        --root=$(CURDIR)/debian/python-protobuf; \
 
62
        done
 
63
        find $(CURDIR)/debian/python-protobuf -name 'protobuf-*-nspkg.pth' -delete
 
64
 
 
65
override_dh_auto_install-indep:
 
66
        dh_auto_install --indep
 
67
 
 
68
        # Java install.
134
69
        mh_install
135
70
 
136
 
install-arch: build-arch
137
 
        dh_testdir
138
 
        dh_testroot
139
 
        dh_prep -s
140
 
        dh_installdirs -s
141
 
 
142
 
        # Add here commands to install the arch part of the package into
143
 
        # debian/tmp.
144
 
        $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
145
 
 
146
 
        dh_install --sourcedir=debian/tmp -s
147
 
 
148
 
        # convert doc dir to symlink for the dev packages
 
71
override_dh_install:
 
72
        dh_install
 
73
 
 
74
        # Convert doc dir to symlink for the -dev packages.
149
75
        rm -rf $(CURDIR)/debian/libprotobuf-dev/usr/share/doc/libprotobuf-dev
150
 
        ln -s libprotobuf8 $(CURDIR)/debian/libprotobuf-dev/usr/share/doc/libprotobuf-dev
 
76
        ln -s libprotobuf9 $(CURDIR)/debian/libprotobuf-dev/usr/share/doc/libprotobuf-dev
151
77
        rm -rf $(CURDIR)/debian/libprotoc-dev/usr/share/doc/libprotoc-dev
152
 
        ln -s libprotoc8 $(CURDIR)/debian/libprotoc-dev/usr/share/doc/libprotoc-dev
 
78
        ln -s libprotoc9 $(CURDIR)/debian/libprotoc-dev/usr/share/doc/libprotoc-dev
153
79
 
154
 
        # remove compiler headers from libprotobuf-dev
 
80
        # Remove compiler headers from libprotobuf-dev.
155
81
        rm -rf $(CURDIR)/debian/libprotobuf-dev/usr/include/google/protobuf/compiler
156
 
 
157
 
        # remove .la files, as no other library depends on us
158
 
        find $(CURDIR)/debian -name '*.la' -print0|xargs -r0 rm -f
159
 
 
160
 
# Must not depend on anything. This is to be called by
161
 
# binary-arch/binary-indep
162
 
# in another 'make' thread.
163
 
binary-common:
164
 
        dh_testdir
165
 
        dh_testroot
166
 
        dh_installchangelogs CHANGES.txt
167
 
        dh_installdocs
168
 
        dh_installexamples
169
 
        dh_installman
170
 
        dh_link
171
 
        dh_strip
172
 
        dh_compress
173
 
        dh_fixperms
174
 
        dh_python2
175
 
        dh_makeshlibs
176
 
        dh_installdeb
177
 
        dh_shlibdeps
178
 
        dh_gencontrol
179
 
        dh_md5sums
180
 
        dh_builddeb
181
 
 
182
 
# Build architecture independant packages using the common target.
183
 
binary-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: install-arch
188
 
        $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
189
 
 
190
 
binary: binary-arch binary-indep
191
 
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure