diff --git a/Makefile b/Makefile index 0cc937ebd15..8e3afd0bdf8 100644 --- a/Makefile +++ b/Makefile @@ -416,28 +416,6 @@ LIBS = m pthread ws2_32 dbghelp LDFLAGS += -pthread endif -# If we are installing into a non-default prefix, both -# the libraries we build, and the apps users build, -# need to know how to find the libraries they depend on. -# There is much gnashing of teeth about this subject. -# It's tricky to do that without editing images during install, -# as you don't want tests during build to find previously installed and -# now stale libraries, etc. -ifeq ($(SYSTEM),Linux) -ifneq ($(prefix),/usr) -# Linux best practice for rpath on installed files is probably: -# 1) .pc file provides -Wl,-rpath,$(prefix)/lib -# 2) binaries we install into $(prefix)/bin use -Wl,-rpath,$ORIGIN/../lib -# 3) libraries we install into $(prefix)/lib use -Wl,-rpath,$ORIGIN -# cf. https://www.akkadia.org/drepper/dsohowto.pdf -# Doing all of that right is hard, but using -Wl,-rpath,$ORIGIN is always -# safe, and solves problems seen in the wild. Note that $ORIGIN -# is a literal string interpreted much later by ld.so. Escape it -# here with a dollar sign so Make doesn't expand $O. -LDFLAGS += '-Wl,-rpath,$$ORIGIN' -endif -endif - # # The steps for cross-compiling are as follows: # First, clone and make install of grpc using the native compilers for the host. @@ -963,7 +941,7 @@ openssl_dep_message: @echo "Your system doesn't have one, and either the third_party directory" @echo "doesn't have it, or your compiler can't build BoringSSL." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -977,7 +955,7 @@ protobuf_dep_message: @echo "The target you are trying to run requires protobuf 3.12.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -991,7 +969,7 @@ protoc_dep_message: @echo "The target you are trying to run requires protobuf-compiler 3.12.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -1006,9 +984,18 @@ systemtap_dep_error: @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " @echo "platforms such as Solaris and *BSD). " @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." + @echo + +install_not_supported_message: + @echo + @echo "Installing via 'make' is no longer supported. Use cmake or bazel instead." + @echo + @echo "Please consult BUILDING.md to get more information." @echo +install_not_supported_error: install_not_supported_message stop + stop: @false @@ -2980,255 +2967,17 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cpp $(Q) mkdir -p `dirname $@` $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -install: install_c install_cxx install-plugins install-certs - -install_c: install-headers_c install-static_c install-shared_c - -install_cxx: install-headers_cxx install-static_cxx install-shared_cxx - -install_csharp: install-shared_csharp install_c - -install_grpc_csharp_ext: install_csharp - -install-headers: install-headers_c install-headers_cxx - -install-headers_c: - $(E) "[INSTALL] Installing public C headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 - -install-headers_cxx: - $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 - -install-static: install-static_c install-static_cxx - -install-static_c: static_c strip-static_c install-pkg-config_c - $(E) "[INSTALL] Installing libaddress_sorting.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(prefix)/lib/libaddress_sorting.a - $(E) "[INSTALL] Installing libgpr.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr.a $(prefix)/lib/libgpr.a - $(E) "[INSTALL] Installing libgrpc.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc.a $(prefix)/lib/libgrpc.a - $(E) "[INSTALL] Installing libgrpc_csharp_ext.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.a $(prefix)/lib/libgrpc_csharp_ext.a - $(E) "[INSTALL] Installing libgrpc_unsecure.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(prefix)/lib/libgrpc_unsecure.a - $(E) "[INSTALL] Installing libre2.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libre2.a $(prefix)/lib/libre2.a - $(E) "[INSTALL] Installing libupb.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libupb.a $(prefix)/lib/libupb.a - -install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx - $(E) "[INSTALL] Installing libgrpc++.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a - $(E) "[INSTALL] Installing libgrpc++_alts.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_alts.a $(prefix)/lib/libgrpc++_alts.a - $(E) "[INSTALL] Installing libgrpc++_error_details.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(prefix)/lib/libgrpc++_error_details.a - $(E) "[INSTALL] Installing libgrpc++_reflection.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(prefix)/lib/libgrpc++_reflection.a - $(E) "[INSTALL] Installing libgrpc++_unsecure.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(prefix)/lib/libgrpc++_unsecure.a - $(E) "[INSTALL] Installing libgrpcpp_channelz.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpcpp_channelz.a $(prefix)/lib/libgrpcpp_channelz.a - - - -install-shared_c: shared_c strip-shared_c install-pkg-config_c - $(E) "[INSTALL] Installing $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libaddress_sorting.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libaddress_sorting.so.11 - $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libaddress_sorting.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgpr.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.11 - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.11 - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_csharp_ext.so.11 - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_csharp_ext.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_unsecure.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.11 - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)re2$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)re2$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)re2$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libre2$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libre2.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)re2$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libre2.so.11 - $(Q) ln -sf $(SHARED_PREFIX)re2$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libre2.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/$(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libupb.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libupb.so.11 - $(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libupb.so -endif -ifneq ($(SYSTEM),MINGW32) -ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig || true -endif -endif +install: install_not_supported_error +install_c: install_not_supported_error -install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_alts$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_alts$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_alts$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_alts$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_alts.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_alts$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_alts.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_alts$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_alts.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_error_details.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_reflection.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_unsecure.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpcpp_channelz$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpcpp_channelz.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpcpp_channelz.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpcpp_channelz.so -endif -ifneq ($(SYSTEM),MINGW32) -ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig || true -endif -endif +install_cxx: install_not_supported_error +install_csharp: install_not_supported_error -install-shared_csharp: shared_csharp strip-shared_csharp -ifneq ($(SYSTEM),MINGW32) -ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig || true -endif -endif - - -install-plugins: $(PROTOC_PLUGINS) - $(E) "[INSTALL] Installing grpc protoc plugins" - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(prefix)/bin/grpc_csharp_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_node_plugin $(prefix)/bin/grpc_node_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_php_plugin $(prefix)/bin/grpc_php_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin - -install-grpc-cli: grpc_cli - $(E) "[INSTALL] Installing grpc cli" - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cli $(prefix)/bin/grpc_cli - -install-pkg-config_c: pc_c pc_c_unsecure - $(E) "[INSTALL] Installing C pkg-config files" - $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc - -install-pkg-config_cxx: pc_cxx pc_cxx_unsecure - $(E) "[INSTALL] Installing C++ pkg-config files" - $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc - -install-certs: etc/roots.pem - $(E) "[INSTALL] Installing root certificates" - $(Q) $(INSTALL) -d $(prefix)/share/grpc - $(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem +install-static: install_not_supported_error + +install-certs: install_not_supported_error clean: $(E) "[CLEAN] Cleaning build directories." @@ -20362,7 +20111,7 @@ test/cpp/util/test_config_cc.cc: $(OPENSSL_DEP) test/cpp/util/test_credentials_provider.cc: $(OPENSSL_DEP) endif -.PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install-headers install-headers_c install-headers_cxx install-shared install-shared_c install-shared_cxx install-static install-static_c install-static_cxx strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean +.PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install_csharp install-static install-certs strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean .PHONY: printvars printvars: diff --git a/src/php/README.md b/src/php/README.md index 1704c814ad8..2ab1293bd4d 100644 --- a/src/php/README.md +++ b/src/php/README.md @@ -51,15 +51,15 @@ Clone this repository at the [latest stable release tag](https://github.com/grpc ```sh $ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc +$ cd grpc ``` -#### Build and install the gRPC C core library +#### Build the gRPC C core library ```sh -$ cd grpc $ git submodule update --init $ EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK make -$ [sudo] make install +$ make ``` #### Build and install the `grpc` extension @@ -67,9 +67,10 @@ $ [sudo] make install Compile the `grpc` extension from source ```sh -$ cd grpc/src/php/ext/grpc +$ grpc_root="$(pwd)" +$ cd src/php/ext/grpc $ phpize -$ ./configure +$ ./configure --enable-grpc="${grpc_root}" $ make $ [sudo] make install ``` diff --git a/templates/Makefile.template b/templates/Makefile.template index 8e405b45fda..9ca6c6c0451 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -280,28 +280,6 @@ LDFLAGS += -pthread endif - # If we are installing into a non-default prefix, both - # the libraries we build, and the apps users build, - # need to know how to find the libraries they depend on. - # There is much gnashing of teeth about this subject. - # It's tricky to do that without editing images during install, - # as you don't want tests during build to find previously installed and - # now stale libraries, etc. - ifeq ($(SYSTEM),Linux) - ifneq ($(prefix),/usr) - # Linux best practice for rpath on installed files is probably: - # 1) .pc file provides -Wl,-rpath,$(prefix)/lib - # 2) binaries we install into $(prefix)/bin use -Wl,-rpath,$ORIGIN/../lib - # 3) libraries we install into $(prefix)/lib use -Wl,-rpath,$ORIGIN - # cf. https://www.akkadia.org/drepper/dsohowto.pdf - # Doing all of that right is hard, but using -Wl,-rpath,$ORIGIN is always - # safe, and solves problems seen in the wild. Note that $ORIGIN - # is a literal string interpreted much later by ld.so. Escape it - # here with a dollar sign so Make doesn't expand $O. - LDFLAGS += '-Wl,-rpath,$$ORIGIN' - endif - endif - # # The steps for cross-compiling are as follows: # First, clone and make install of grpc using the native compilers for the host. @@ -869,7 +847,7 @@ @echo "Your system doesn't have one, and either the third_party directory" @echo "doesn't have it, or your compiler can't build BoringSSL." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -883,7 +861,7 @@ @echo "The target you are trying to run requires protobuf 3.12.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -897,7 +875,7 @@ @echo "The target you are trying to run requires protobuf-compiler 3.12.0+" @echo "Your system doesn't have it, and neither does the third_party directory." @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." @echo @echo "If you need information about why these tests failed, run:" @echo @@ -912,9 +890,18 @@ @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " @echo "platforms such as Solaris and *BSD). " @echo - @echo "Please consult INSTALL to get more information." + @echo "Please consult BUILDING.md to get more information." + @echo + + install_not_supported_message: + @echo + @echo "Installing via 'make' is no longer supported. Use cmake or bazel instead." + @echo + @echo "Please consult BUILDING.md to get more information." @echo + install_not_supported_error: install_not_supported_message stop + stop: @false @@ -1343,125 +1330,17 @@ $(Q) mkdir -p `dirname $@` $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< - install: install_c install_cxx install-plugins install-certs - - install_c: install-headers_c install-static_c install-shared_c - - install_cxx: install-headers_cxx install-static_cxx install-shared_cxx - - install_csharp: install-shared_csharp install_c + install: install_not_supported_error - install_grpc_csharp_ext: install_csharp + install_c: install_not_supported_error - install-headers: install-headers_c install-headers_cxx + install_cxx: install_not_supported_error - install-headers_c: - $(E) "[INSTALL] Installing public C headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 + install_csharp: install_not_supported_error - install-headers_cxx: - $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 - - install-static: install-static_c install-static_cxx - - install-static_c: static_c strip-static_c install-pkg-config_c - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == "c": - % if lib.build == "all": - % if not lib.get('external_deps', None): - $(E) "[INSTALL] Installing lib${lib.name}.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a - % endif - % endif - % endif - % endif - % endfor - - install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == "c++": - % if lib.build == "all": - $(E) "[INSTALL] Installing lib${lib.name}.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a - % endif - % endif - % endif - % endfor - - <%def name="install_shared(lang_filter)">\ - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == lang_filter: - % if lib.build == "all": - % if not lib.get('external_deps', None): - $(E) "[INSTALL] Installing $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]})" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) - ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]})-dll.a $(prefix)/lib/lib${lib.name}.a - else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) $(prefix)/lib/lib${lib.name}.so - endif - % endif - % endif - % endif - % endif - % endfor - ifneq ($(SYSTEM),MINGW32) - ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig || true - endif - endif - - - install-shared_c: shared_c strip-shared_c install-pkg-config_c - ${install_shared("c")} - - install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx - ${install_shared("c++")} - - install-shared_csharp: shared_csharp strip-shared_csharp - ${install_shared("csharp")} - - install-plugins: $(PROTOC_PLUGINS) - $(E) "[INSTALL] Installing grpc protoc plugins" - % for tgt in targets: - % if tgt.build == 'protoc': - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} - % endif - % endfor + install-static: install_not_supported_error - install-grpc-cli: grpc_cli - $(E) "[INSTALL] Installing grpc cli" - $(Q) $(INSTALL) -d $(prefix)/bin - $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cli $(prefix)/bin/grpc_cli - - install-pkg-config_c: pc_c pc_c_unsecure - $(E) "[INSTALL] Installing C pkg-config files" - $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc - - install-pkg-config_cxx: pc_cxx pc_cxx_unsecure - $(E) "[INSTALL] Installing C++ pkg-config files" - $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc - $(Q) $(INSTALL) -m 0644 $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc - - install-certs: etc/roots.pem - $(E) "[INSTALL] Installing root certificates" - $(Q) $(INSTALL) -d $(prefix)/share/grpc - $(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem + install-certs: install_not_supported_error clean: $(E) "[CLEAN] Cleaning build directories." @@ -1937,10 +1816,7 @@ dep_error openssl_dep_error openssl_dep_message git_update stop \ buildtests buildtests_c buildtests_cxx \ test test_c test_cxx \ - install install_c install_cxx \ - install-headers install-headers_c install-headers_cxx \ - install-shared install-shared_c install-shared_cxx \ - install-static install-static_c install-static_cxx \ + install install_c install_cxx install_csharp install-static install-certs \ strip strip-shared strip-static \ strip_c strip-shared_c strip-static_c \ strip_cxx strip-shared_cxx strip-static_cxx \ diff --git a/test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh b/test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh index 3d02f6e43ef..e0c04ea813d 100755 --- a/test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh +++ b/test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh @@ -78,8 +78,16 @@ cmake \ make -j4 install popd -# Build helloworld example using Makefiles and pkg-config -cd examples/cpp/helloworld +# Build helloworld example using Makefile and pkg-config +pushd examples/cpp/helloworld export PKG_CONFIG_PATH=/usr/local/grpc/lib/pkgconfig export PATH=$PATH:/usr/local/grpc/bin make +popd + +# Build route_guide example using Makefile and pkg-config +pushd examples/cpp/route_guide +export PKG_CONFIG_PATH=/usr/local/grpc/lib/pkgconfig +export PATH=$PATH:/usr/local/grpc/bin +make +popd diff --git a/test/distrib/cpp/run_distrib_test_routeguide.sh b/test/distrib/cpp/run_distrib_test_routeguide.sh deleted file mode 100755 index a81692d920c..00000000000 --- a/test/distrib/cpp/run_distrib_test_routeguide.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright 2016 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -# change to grpc repo root -cd "$(dirname "$0")/../../.." - -cd third_party/protobuf && ./autogen.sh && \ -./configure && make -j4 && make install && ldconfig - -cd ../.. && make -j4 && make install - -cd examples/cpp/helloworld - -make - -make clean - -cd ../../../examples/cpp/route_guide - -make - -make clean - diff --git a/tools/dockerfile/interoptest/grpc_interop_cxx/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_cxx/build_interop.sh index 8b8c6be8f1f..ec1da444097 100755 --- a/tools/dockerfile/interoptest/grpc_interop_cxx/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_cxx/build_interop.sh @@ -28,7 +28,9 @@ cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -make install-certs -j4 +# Install the roots.pem +mkdir -p /usr/local/share/grpc +cp etc/roots.pem /usr/local/share/grpc/roots.pem # build C++ interop client & server make interop_client interop_server -j4 diff --git a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh index bce6c12f280..d88f51c800d 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh @@ -27,14 +27,17 @@ ${name}') cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc +grpc_root="$(pwd)" -# Install gRPC C core and build codegen plugins -make -j4 install_c plugins +# Install gRPC C core +make -j4 shared_c static_c -(cd src/php/ext/grpc && phpize && ./configure && make -j4) - -# Install protobuf (need access to protoc) -(cd third_party/protobuf && make -j4 install) +# Build gRPC PHP native extension +pushd src/php/ext/grpc +phpize +GRPC_LIB_SUBDIR=libs/opt ./configure --enable-grpc="${grpc_root}" +make -j4 +popd cd src/php diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh index 26a49be6300..0ef722d8ee5 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh @@ -27,14 +27,17 @@ ${name}') cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc +grpc_root="$(pwd)" -# Install gRPC C core and build codegen plugins -make -j4 install_c plugins +# Install gRPC C core +make -j4 shared_c static_c -(cd src/php/ext/grpc && phpize && ./configure && make -j4) - -# Install protobuf (need access to protoc) -(cd third_party/protobuf && make -j4 install) +# Build gRPC PHP native extension +pushd src/php/ext/grpc +phpize +GRPC_LIB_SUBDIR=libs/opt ./configure --enable-grpc="${grpc_root}" +make -j4 +popd cd src/php diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 7147f46d307..8f22537c4a0 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -296,7 +296,6 @@ class CppDistribTest(object): def targets(): """Gets list of supported targets""" return [ - CppDistribTest('linux', 'x64', 'jessie', 'routeguide'), CppDistribTest('linux', 'x64', 'jessie', 'cmake_as_submodule'), CppDistribTest('linux', 'x64', 'stretch', 'cmake'), CppDistribTest('linux', 'x64', 'stretch', 'cmake_as_externalproject'),