| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- makefile -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
#export DH_VERBOSE=1 |
| 6 |
|
| 7 |
include /usr/share/dpkg/architecture.mk |
| 8 |
include /usr/share/dpkg/buildtools.mk |
| 9 |
|
| 10 |
export DH_RUBY = --gem-install |
| 11 |
export DH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR = debian/ruby-google-protobuf |
| 12 |
export GEM2DEB_TEST_RUNNER = --check-dependencies |
| 13 |
|
| 14 |
ifneq (,$(findstring $(DEB_BUILD_ARCH), armel m68k mips mipsel powerpc powerpcspe sh4)) |
| 15 |
export DEB_LDFLAGS_MAINT_APPEND = -latomic |
| 16 |
endif |
| 17 |
|
| 18 |
# faster than the pure-python alternative |
| 19 |
# not yet ported to Python 3.14 |
| 20 |
#PYTHON_CPP=--cpp_implementation |
| 21 |
|
| 22 |
SONAME=32 |
| 23 |
API_VERSION=$(SONAME)-0 |
| 24 |
|
| 25 |
%: |
| 26 |
dh $@ |
| 27 |
|
| 28 |
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 29 |
override_dh_auto_configure: |
| 30 |
# build for the native (i.e. build) architecture, as we need |
| 31 |
# the protoc compiler for the native arch. |
| 32 |
dpkg-architecture -f -a$(DEB_BUILD_ARCH) -c dh_auto_configure |
| 33 |
|
| 34 |
PYTHON_CROSS_VARS += PROTOC=$(CURDIR)/debian/run_protoc |
| 35 |
PYTHON_CROSS_VARS += PYTHONPATH=/usr/lib/python$$pv/plat-$(DEB_HOST_MULTIARCH) |
| 36 |
PYTHON_CROSS_VARS += _PYTHON_HOST_PLATFORM=$(DEB_HOST_ARCH_OS)-$(DEB_HOST_GNU_CPU) |
| 37 |
PYTHON_CROSS_VARS += CC=$(CXX) |
| 38 |
PYTHON_CROSS_VARS += CXX=$(CXX) |
| 39 |
endif |
| 40 |
|
| 41 |
override_dh_auto_build-arch: |
| 42 |
## Chicken<->Egg problem: protobuf requires self-generated .pb.go files to |
| 43 |
## be built. First we build it normally; then "generate_descriptor_proto.sh" |
| 44 |
## generates .pb.go files and replaces 'em if they are different as well as |
| 45 |
## invokes "make protoc" which re-builds "src/protoc" if required. |
| 46 |
dh_auto_build --arch |
| 47 |
bash -x ./generate_descriptor_proto.sh |
| 48 |
|
| 49 |
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 50 |
# save the native compiler |
| 51 |
cp -Rv src/.libs debian/native_protoc |
| 52 |
# clean everything but regenerated .pb.{cc,go} files |
| 53 |
$(MAKE) clean |
| 54 |
# cross build |
| 55 |
dh_auto_configure -- --with-protoc=$(CURDIR)/debian/run_protoc |
| 56 |
dh_auto_build --arch |
| 57 |
endif |
| 58 |
|
| 59 |
# Generate the manpage |
| 60 |
xmlto man debian/protoc.xml |
| 61 |
|
| 62 |
ifeq (,$(filter nopython,$(DEB_BUILD_PROFILES))) |
| 63 |
# Python3 build |
| 64 |
cp -rv python python3 |
| 65 |
set -e; cd python3 && for pv in $(shell py3versions -vr); do \ |
| 66 |
$(PYTHON_CROSS_VARS) python$$pv setup.py build ${PYTHON_CPP}; \ |
| 67 |
done |
| 68 |
endif |
| 69 |
|
| 70 |
ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES))) |
| 71 |
# Ruby build |
| 72 |
cd ruby && rake package genproto |
| 73 |
endif |
| 74 |
|
| 75 |
override_dh_auto_build-indep: |
| 76 |
dh_auto_build --indep |
| 77 |
|
| 78 |
# Java build |
| 79 |
ant -f debian/java-build.xml jar jar-util |
| 80 |
|
| 81 |
override_dh_clean: |
| 82 |
$(RM) -rv gmock |
| 83 |
ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES))) |
| 84 |
cd ruby && rake clobber |
| 85 |
endif |
| 86 |
dh_clean |
| 87 |
$(RM) config.h config.log config.status |
| 88 |
$(RM) *.pc |
| 89 |
$(RM) google-protobuf.gemspec |
| 90 |
$(RM) libtool stamp-h1 |
| 91 |
$(RM) ruby/tests/basic_test_pb.rb \ |
| 92 |
ruby/tests/basic_test_proto2_pb.rb \ |
| 93 |
ruby/tests/generated_code_pb.rb \ |
| 94 |
ruby/tests/generated_code_proto2_pb.rb \ |
| 95 |
ruby/tests/google/protobuf/wrappers_pb.rb \ |
| 96 |
ruby/tests/test_import_pb.rb \ |
| 97 |
ruby/tests/test_import_proto2_pb.rb \ |
| 98 |
ruby/tests/test_ruby_package_pb.rb \ |
| 99 |
ruby/tests/test_ruby_package_proto2_pb.rb |
| 100 |
$(RM) -r ruby/ext/google/protobuf_c/third_party/utf8_range/ |
| 101 |
find $(CURDIR) -name Makefile -delete |
| 102 |
|
| 103 |
override_dh_auto_test-arch: |
| 104 |
dh_auto_test --arch |
| 105 |
|
| 106 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))$(filter nopython,$(DEB_BUILD_PROFILES))) |
| 107 |
# Python3 test |
| 108 |
# set -e; \ |
| 109 |
export LD_LIBRARY_PATH=$(CURDIR)/src/.libs; \ |
| 110 |
cd python3 && for PYTHON in $(shell py3versions -r); do \ |
| 111 |
$$PYTHON setup.py test ${PYTHON_CPP}; \ |
| 112 |
done |
| 113 |
endif |
| 114 |
|
| 115 |
override_dh_auto_test-indep: |
| 116 |
: |
| 117 |
|
| 118 |
override_dh_auto_clean-arch: |
| 119 |
dh_auto_clean --arch |
| 120 |
|
| 121 |
# Python3 clean |
| 122 |
$(RM) -r $(CURDIR)/python3 |
| 123 |
|
| 124 |
override_dh_auto_clean-indep: |
| 125 |
dh_auto_clean --indep |
| 126 |
|
| 127 |
# Java clean |
| 128 |
ant -f debian/java-build.xml clean || true |
| 129 |
mh_clean || true |
| 130 |
|
| 131 |
override_dh_auto_install-arch: |
| 132 |
dh_auto_install --arch |
| 133 |
|
| 134 |
ifeq (,$(filter nopython,$(DEB_BUILD_PROFILES))) |
| 135 |
# Python3 install |
| 136 |
set -e; \ |
| 137 |
cd python3 && for pv in $(shell py3versions -vr); do \ |
| 138 |
$(PYTHON_CROSS_VARS) python$$pv setup.py install ${PYTHON_CPP} \ |
| 139 |
--install-layout=deb --no-compile \ |
| 140 |
--root=$(CURDIR)/debian/python3-protobuf; \ |
| 141 |
done |
| 142 |
find $(CURDIR)/debian/python3-protobuf -name 'protobuf-*-nspkg.pth' -delete |
| 143 |
endif |
| 144 |
|
| 145 |
ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES))) |
| 146 |
# Ruby install |
| 147 |
sed 's|ext/|ruby/ext/|' $(CURDIR)/ruby/google-protobuf.gemspec \ |
| 148 |
>$(CURDIR)/google-protobuf.gemspec |
| 149 |
dh_auto_install -O--buildsystem=ruby -O--package=ruby-google-protobuf --destdir=$(CURDIR)/debian/ruby-google-protobuf |
| 150 |
find $(CURDIR)/debian/ruby-google-protobuf/usr/lib/ \ |
| 151 |
-name well_known_types.rb -exec chmod a+x {} \; |
| 152 |
endif |
| 153 |
|
| 154 |
override_dh_auto_install-indep: |
| 155 |
dh_auto_install --indep |
| 156 |
|
| 157 |
# Java install |
| 158 |
mh_install |
| 159 |
|
| 160 |
override_dh_install-arch: |
| 161 |
dh_install --arch |
| 162 |
|
| 163 |
# Convert doc dir to symlink for the -dev packages |
| 164 |
$(RM) -r $(CURDIR)/debian/libprotobuf-dev/usr/share/doc/libprotobuf-dev |
| 165 |
ln -s libprotobuf$(SONAME)t64 $(CURDIR)/debian/libprotobuf-dev/usr/share/doc/libprotobuf-dev |
| 166 |
$(RM) -r $(CURDIR)/debian/libprotoc-dev/usr/share/doc/libprotoc-dev |
| 167 |
ln -s libprotoc$(SONAME)t64 $(CURDIR)/debian/libprotoc-dev/usr/share/doc/libprotoc-dev |
| 168 |
|
| 169 |
# Remove compiler headers from libprotobuf-dev |
| 170 |
$(RM) -r $(CURDIR)/debian/libprotobuf-dev/usr/include/google/protobuf/compiler |
| 171 |
|
| 172 |
override_dh_installdocs-arch: |
| 173 |
dh_installdocs --arch |
| 174 |
# Fix permission |
| 175 |
chmod a-x $(CURDIR)/debian/protobuf-compiler/usr/share/doc/protobuf-compiler/examples/README.md |
| 176 |
# Remove extra .gitignore |
| 177 |
rm $(CURDIR)/debian/protobuf-compiler/usr/share/doc/protobuf-compiler/examples/.gitignore |
| 178 |
|
| 179 |
override_dh_installdocs-indep: |
| 180 |
dh_installdocs --indep |
| 181 |
dh_installdocs -Xprotobuf-mode.el # in protobuf-mode-el |
| 182 |
|
| 183 |
execute_after_dh_link-indep: |
| 184 |
jh_installlibs |
| 185 |
jh_classpath |
| 186 |
jh_manifest |
| 187 |
jh_depends |
| 188 |
|
| 189 |
override_dh_gencontrol: |
| 190 |
dh_gencontrol -- -Vpb:API=${API_VERSION} |