vlc | branch: master | Steve Lhomme <[email protected]> | Thu Feb 14 12:47:17 
2019 +0100| [2a031d1ef349b1d6fc1201ef8c54ce9216568c38] | committer: Steve Lhomme

contrib: protobuf: build using cmake

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a031d1ef349b1d6fc1201ef8c54ce9216568c38
---

 contrib/src/protobuf/dont-build-protoc.patch       | 24 -------------------
 .../src/protobuf/protobuf-cmake-pkgconfig.patch    | 27 ++++++++++++++++++++++
 contrib/src/protobuf/rules.mak                     | 11 +++++----
 3 files changed, 34 insertions(+), 28 deletions(-)

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..b5d3949a83 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -32,15 +32,18 @@ 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 $</ && mkdir -p $(HOST)
+       cd $</$(HOST) && $(HOSTVARS_PIC) $(CMAKE) -S .. -B ../cmake 
$(PROTOBUF_CONF)
+       cd $</ && $(MAKE) -C $(HOST) && $(MAKE) -C $(HOST) install
        touch $@

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to