[vlc-commits] Revert "contrib: protobuf: build using cmake"

Steve Lhomme git at videolan.org
Wed Feb 20 14:56:01 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 20 14:55:41 2019 +0100| [56aeb38ab548ca0c3a4c12ed129a3828167dafc3] | committer: Steve Lhomme

Revert "contrib: protobuf: build using cmake"

This just doesn't work. Depending on the CMake version the -S and -B meaning is
reversed.

mkdir -p i686-w64-mingw32
cmake . -S cmake -B i686-w64-mingw32
CMake Error: The source directory "contrib-win32/protobuf/i686-w64-mingw32" does not appear to contain CMakeLists.txt.

The doc for 3.14 is
-B <path-to-build>
    Path to directory which CMake will use as the root of build directory.
    If the directory doesn’t already exist CMake will make it.

So it's clearly a folder to build into. But yet it doesn't work in many cases.

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

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

diff --git a/contrib/src/protobuf/dont-build-protoc.patch b/contrib/src/protobuf/dont-build-protoc.patch
new file mode 100644
index 0000000000..88bcca5e05
--- /dev/null
+++ b/contrib/src/protobuf/dont-build-protoc.patch
@@ -0,0 +1,24 @@
+--- 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
deleted file mode 100644
index 2a5271d02c..0000000000
--- a/contrib/src/protobuf/protobuf-cmake-pkgconfig.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- 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 f5d459c576..19abe5d53a 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -32,17 +32,15 @@ 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 toolchain.cmake
-	cd $</ && mkdir -p $(HOST)
-	cd $</ && $(HOSTVARS_PIC) $(CMAKE) -S cmake -B $(HOST) $(PROTOBUF_CONF)
-	cd $</ && $(MAKE) -C $(HOST) && $(MAKE) -C $(HOST) install
+.protobuf: protobuf
+	$(RECONF)
+	cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --with-protoc="$(PROTOC)"
+	cd $< && $(MAKE) && $(MAKE) install
 	touch $@



More information about the vlc-commits mailing list