[vlc-devel] [PATCH 1/4] contrib: protobuf: build using cmake
Steve Lhomme
robux4 at ycbcr.xyz
Thu Feb 14 16:53:32 CET 2019
---
contrib/src/protobuf/dont-build-protoc.patch | 24 -----------------
.../protobuf/protobuf-cmake-pkgconfig.patch | 27 +++++++++++++++++++
contrib/src/protobuf/rules.mak | 10 ++++---
3 files changed, 33 insertions(+), 28 deletions(-)
delete mode 100644 contrib/src/protobuf/dont-build-protoc.patch
create mode 100644 contrib/src/protobuf/protobuf-cmake-pkgconfig.patch
diff --git a/contrib/src/protobuf/dont-build-protoc.patch b/contrib/src/protobuf/dont-build-protoc.patch
deleted file mode 100644
index 88bcca5e05..0000000000
--- a/contrib/src/protobuf/dont-build-protoc.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- protobuf/src/Makefile.am.old 2017-04-20 17:58:28.941775687 +0200
-+++ protobuf/src/Makefile.am 2017-04-20 17:57:40.629763450 +0200
-@@ -481,7 +481,10 @@
- google/protobuf/compiler/csharp/csharp_wrapper_field.cc \
- google/protobuf/compiler/csharp/csharp_wrapper_field.h
-
-+EXTRA_PROGRAMS = protoc
-+if !USE_EXTERNAL_PROTOC
- bin_PROGRAMS = protoc
-+endif
- protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
- protoc_SOURCES = google/protobuf/compiler/main.cc
-
---- protobuf/src/Makefile.am.old 2018-03-14 15:00:19.974044729 +0100
-+++ protobuf/src/Makefile.am 2018-03-14 15:01:03.158043968 +0100
-@@ -174,7 +174,7 @@
- google/protobuf/util/type_resolver_util.h \
- google/protobuf/util/message_differencer.h
-
--lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la
-+lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la
-
- libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS)
- libprotobuf_lite_la_LDFLAGS = -version-info 11:0:0 -export-dynamic -no-undefined
diff --git a/contrib/src/protobuf/protobuf-cmake-pkgconfig.patch b/contrib/src/protobuf/protobuf-cmake-pkgconfig.patch
new file mode 100644
index 0000000000..2a5271d02c
--- /dev/null
+++ b/contrib/src/protobuf/protobuf-cmake-pkgconfig.patch
@@ -0,0 +1,27 @@
+--- protobuf/cmake/install.cmake.pkgconfig 2019-02-14 13:49:06.917114800 +0100
++++ protobuf/cmake/install.cmake 2019-02-14 13:50:02.717359800 +0100
+@@ -99,6 +99,24 @@ configure_file(protobuf-module.cmake.in
+ configure_file(protobuf-options.cmake
+ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
+
++# pkg-config files
++if(NOT MSVC)
++ set(prefix ${CMAKE_INSTALL_PREFIX})
++ set(exec_prefix "\${prefix}")
++ set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
++ set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
++ set(VERSION ${protobuf_VERSION})
++ if (CMAKE_USE_PTHREADS_INIT)
++ set(PTHREAD_CFLAGS "-pthread")
++ endif()
++ #set(LIBS "${ZLIB_LIBRARIES}")
++ configure_file(../protobuf.pc.in protobuf.pc @ONLY)
++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
++
++ configure_file(../protobuf-lite.pc.in protobuf-lite.pc @ONLY)
++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
++endif()
++
+ # Allows the build directory to be used as a find directory.
+ export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+ NAMESPACE protobuf::
diff --git a/contrib/src/protobuf/rules.mak b/contrib/src/protobuf/rules.mak
index 19abe5d53a..18a04dcf4b 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -32,15 +32,17 @@ ifdef HAVE_WIN32
DEPS_protobuf += pthreads $(DEPS_pthreads)
endif
+PROTOBUF_CONF = -DBUILD_SHARED_LIBS=OFF -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_EXAMPLES=OFF
+
protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
$(UNPACK)
mv protobuf-$(PROTOBUF_VERSION) protobuf-$(PROTOBUF_VERSION)-cpp
$(APPLY) $(SRC)/protobuf/dont-build-protoc.patch
$(APPLY) $(SRC)/protobuf/protobuf-win32.patch
+ $(APPLY) $(SRC)/protobuf/protobuf-cmake-pkgconfig.patch
$(MOVE)
-.protobuf: protobuf
- $(RECONF)
- cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --with-protoc="$(PROTOC)"
- cd $< && $(MAKE) && $(MAKE) install
+.protobuf: protobuf toolchain.cmake
+ cd $</cmake && $(HOSTVARS_PIC) $(CMAKE) $(PROTOBUF_CONF)
+ cd $</ && $(MAKE) -C cmake && $(MAKE) -C cmake install
touch $@
--
2.17.1
More information about the vlc-devel
mailing list