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