From 113781a492f2bf3d4ad0421af501dd422f60c3a7 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 23 Oct 2016 20:29:30 +0300 Subject: protobuf: compile host protoc as native package Do not compile host protoc for all target, instead compile it once. --- src/googlemock.mk | 1 + src/googletest.mk | 1 + src/protobuf.mk | 42 +++++++++++++++++++++--------------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/googlemock.mk b/src/googlemock.mk index 9aaabdc..119d250 100644 --- a/src/googlemock.mk +++ b/src/googlemock.mk @@ -8,6 +8,7 @@ $(PKG)_SUBDIR := googlemock-release-$($(PKG)_VERSION) $(PKG)_FILE := googlemock-$($(PKG)_VERSION).tar.gz $(PKG)_URL := https://github.com/google/googlemock/archive/release-$($(PKG)_VERSION).tar.gz $(PKG)_DEPS := +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) define $(PKG)_UPDATE $(call MXE_GET_GITHUB_TAGS, google/googlemock, release-) diff --git a/src/googletest.mk b/src/googletest.mk index e5a902f..2825c0d 100644 --- a/src/googletest.mk +++ b/src/googletest.mk @@ -9,6 +9,7 @@ $(PKG)_SUBDIR := $(PKG)-release-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := https://github.com/google/$(PKG)/archive/release-$($(PKG)_VERSION).tar.gz $(PKG)_DEPS := +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) define $(PKG)_UPDATE $(call MXE_GET_GITHUB_TAGS, google/googletest, release-) diff --git a/src/protobuf.mk b/src/protobuf.mk index 8832340..da52a9f 100644 --- a/src/protobuf.mk +++ b/src/protobuf.mk @@ -8,33 +8,33 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := https://github.com/google/$(PKG)/archive/v$($(PKG)_VERSION).tar.gz $(PKG)_DEPS := gcc zlib googlemock googletest +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) +$(PKG)_DEPS_$(BUILD) := googlemock googletest define $(PKG)_UPDATE $(call MXE_GET_GITHUB_TAGS, google/protobuf, v) endef define $(PKG)_BUILD -# Zero step: put googlemock and googletest to the source directory. - $(call PREPARE_PKG_SOURCE,googlemock,$(1)) - cd '$(1)' && mv '$(googlemock_SUBDIR)' gmock - $(call PREPARE_PKG_SOURCE,googletest,$(1)) - cd '$(1)' && mv '$(googletest_SUBDIR)' gmock/gtest -# First step: Build for host system in order to create "protoc" binary. - cd '$(1)' && ./autogen.sh && ./configure \ - --disable-shared - $(MAKE) -C '$(1)' -j '$(JOBS)' - cp '$(1)/src/protoc' '$(PREFIX)/bin/$(TARGET)-protoc' - $(MAKE) -C '$(1)' -j 1 distclean -# Second step: Build for target system. - cd '$(1)' && ./configure \ + $(call PREPARE_PKG_SOURCE,googlemock,$(SOURCE_DIR)) + cd '$(SOURCE_DIR)' && mv '$(googlemock_SUBDIR)' gmock + $(call PREPARE_PKG_SOURCE,googletest,$(SOURCE_DIR)) + cd '$(SOURCE_DIR)' && mv '$(googletest_SUBDIR)' gmock/gtest + cd '$(SOURCE_DIR)' && ./autogen.sh + + cd '$(BUILD_DIR)' && '$(SOURCE_DIR)'/configure \ $(MXE_CONFIGURE_OPTS) \ - --with-zlib \ - --with-protoc='$(PREFIX)/bin/$(TARGET)-protoc' - $(MAKE) -C '$(1)' -j '$(JOBS)' - $(MAKE) -C '$(1)' -j 1 install + $(if $(BUILD_CROSS), \ + --with-zlib \ + --with-protoc='$(PREFIX)/$(BUILD)/bin/protoc' \ + ) + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)' -j 1 install - '$(TARGET)-g++' \ - -W -Wall -Werror -ansi -pedantic \ - '$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-protobuf.exe' \ - `'$(TARGET)-pkg-config' protobuf --cflags --libs` + $(if $(BUILD_CROSS), + '$(TARGET)-g++' \ + -W -Wall -Werror -ansi -pedantic \ + '$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-protobuf.exe' \ + `'$(TARGET)-pkg-config' protobuf --cflags --libs` + ) endef -- cgit v0.12