git: 95666d681040 - main - devel/protobuf: Convert REINPLACE_CMD to patch files

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 22 Sep 2023 03:23:22 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=95666d6810407a7f6c379bd8559c37005e723925

commit 95666d6810407a7f6c379bd8559c37005e723925
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-09-22 03:16:58 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-09-22 03:16:58 +0000

    devel/protobuf: Convert REINPLACE_CMD to patch files
---
 devel/protobuf/Makefile                    |   8 +-
 devel/protobuf/files/patch-Makefile.in     |  11 +++
 devel/protobuf/files/patch-src-Makefile.in | 124 +++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/devel/protobuf/Makefile b/devel/protobuf/Makefile
index 7be00d8d7cd6..aebce69dd3f0 100644
--- a/devel/protobuf/Makefile
+++ b/devel/protobuf/Makefile
@@ -7,8 +7,8 @@ MASTER_SITES=	https://github.com/protocolbuffers/protobuf/releases/download/v${P
 
 MAINTAINER=	sunpoet@FreeBSD.org
 COMMENT=	Data interchange format library
-WWW=		https://github.com/protocolbuffers/protobuf \
-		https://protobuf.dev/
+WWW=		https://protobuf.dev/ \
+		https://github.com/protocolbuffers/protobuf
 
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
@@ -38,8 +38,4 @@ WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
 CPE_VENDOR=	google
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|^check-local:|disabled-&|' ${WRKSRC}/Makefile.in
-	@${REINPLACE_CMD} -Ee 's,[^ 	]*lib(gtest|gmock.*)\.la,-l\1,' ${WRKSRC}/src/Makefile.in
-
 .include <bsd.port.mk>
diff --git a/devel/protobuf/files/patch-Makefile.in b/devel/protobuf/files/patch-Makefile.in
new file mode 100644
index 000000000000..b93039e03270
--- /dev/null
+++ b/devel/protobuf/files/patch-Makefile.in
@@ -0,0 +1,11 @@
+--- Makefile.in.orig	2022-12-14 14:21:49 UTC
++++ Makefile.in
+@@ -2188,7 +2188,7 @@ uninstall-am: uninstall-pkgconfigDATA
+ # which takes a lot of time and is generally not useful to us.  Also, we don't
+ # want "make install" to recurse into gmock since we don't want to overwrite
+ # the installed version of gmock if there is one.
+-check-local:
++disabled-check-local:
+ 	@echo "Making lib/libgmock.a lib/libgmock_main.a in gmock"
+ 	@cd third_party/googletest/googletest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
+ 	@cd third_party/googletest/googlemock && $(MAKE) $(AM_MAKEFLAGS) lib/libgmock.la lib/libgmock_main.la
diff --git a/devel/protobuf/files/patch-src-Makefile.in b/devel/protobuf/files/patch-src-Makefile.in
new file mode 100644
index 000000000000..0ffe912b69bf
--- /dev/null
+++ b/devel/protobuf/files/patch-src-Makefile.in
@@ -0,0 +1,124 @@
+--- src/Makefile.in.orig	2022-12-14 14:21:49 UTC
++++ src/Makefile.in
+@@ -492,9 +492,9 @@ protobuf_lazy_descriptor_test_OBJECTS =  \
+ 	$(nodist_protobuf_lazy_descriptor_test_OBJECTS)
+ protobuf_lazy_descriptor_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ 	libprotobuf.la libprotoc.la \
+-	$(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++	-lgtest \
++	-lgmock \
++	-lgmock_main
+ protobuf_lazy_descriptor_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ 	$(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) \
+@@ -513,9 +513,9 @@ protobuf_lite_arena_test_OBJECTS =  \
+ 	$(am_protobuf_lite_arena_test_OBJECTS) \
+ 	$(nodist_protobuf_lite_arena_test_OBJECTS)
+ protobuf_lite_arena_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+-	libprotobuf-lite.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++	libprotobuf-lite.la -lgtest \
++	-lgmock \
++	-lgmock_main
+ protobuf_lite_arena_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ 	$(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+@@ -535,9 +535,9 @@ nodist_protobuf_lite_test_OBJECTS = $(am__objects_11)
+ protobuf_lite_test_OBJECTS = $(am_protobuf_lite_test_OBJECTS) \
+ 	$(nodist_protobuf_lite_test_OBJECTS)
+ protobuf_lite_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+-	libprotobuf-lite.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++	libprotobuf-lite.la -lgtest \
++	-lgmock \
++	-lgmock_main
+ protobuf_lite_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ 	$(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+@@ -681,9 +681,9 @@ nodist_protobuf_test_OBJECTS = $(am__objects_15)
+ protobuf_test_OBJECTS = $(am_protobuf_test_OBJECTS) \
+ 	$(nodist_protobuf_test_OBJECTS)
+ protobuf_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \
+-	libprotoc.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
+-	$(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++	libprotoc.la -lgtest \
++	-lgmock \
++	-lgmock_main
+ protobuf_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+ 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ 	$(protobuf_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+@@ -697,7 +697,7 @@ am_test_plugin_OBJECTS = google/protobuf/compiler/test
+ 	google/protobuf/testing/test_plugin-file.$(OBJEXT)
+ test_plugin_OBJECTS = $(am_test_plugin_OBJECTS)
+ test_plugin_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \
+-	libprotoc.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la
++	libprotoc.la -lgtest
+ am__zcgunzip_SOURCES_DIST = google/protobuf/testing/zcgunzip.cc
+ @HAVE_ZLIB_TRUE@am_zcgunzip_OBJECTS =  \
+ @HAVE_ZLIB_TRUE@	google/protobuf/testing/zcgunzip.$(OBJEXT)
+@@ -2346,9 +2346,9 @@ GOOGLEMOCK_BUILD_DIR = ../third_party/googletest/googl
+ GOOGLETEST_SRC_DIR = $(srcdir)/../third_party/googletest/googletest
+ GOOGLEMOCK_SRC_DIR = $(srcdir)/../third_party/googletest/googlemock
+ protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
+-                      $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la     \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la     \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++                      -lgtest     \
++                      -lgmock     \
++                      -lgmock_main
+ 
+ protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \
+                          -I$(GOOGLEMOCK_SRC_DIR)/include
+@@ -2446,9 +2446,9 @@ nodist_protobuf_test_SOURCES = $(protoc_outputs)
+ # Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
+ protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
+                       libprotoc.la                                   \
+-                      $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la        \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la        \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++                      -lgtest        \
++                      -lgmock        \
++                      -lgmock_main
+ 
+ protobuf_lazy_descriptor_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \
+                                          -I$(GOOGLETEST_SRC_DIR)/include \
+@@ -2475,9 +2475,9 @@ COMMON_LITE_TEST_SOURCES = \
+ # full runtime and we want to make sure this test builds without full
+ # runtime.
+ protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la     \
+-                           $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la \
+-                           $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la \
+-                           $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++                           -lgtest \
++                           -lgmock \
++                           -lgmock_main
+ 
+ protobuf_lite_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \
+                              -I$(GOOGLETEST_SRC_DIR)/include
+@@ -2493,9 +2493,9 @@ nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outp
+ # gtest when building the test internally our memory sanitizer doesn't detect
+ # memory leaks (don't know why).
+ protobuf_lite_arena_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \
+-                      $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la        \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock.la        \
+-                      $(GOOGLEMOCK_BUILD_DIR)/lib/libgmock_main.la
++                      -lgtest        \
++                      -lgmock        \
++                      -lgmock_main
+ 
+ protobuf_lite_arena_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include  \
+                                     -I$(GOOGLETEST_SRC_DIR)/include
+@@ -2509,7 +2509,7 @@ nodist_protobuf_lite_arena_test_SOURCES = $(protoc_lit
+ 
+ # Test plugin binary.
+ test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
+-                    $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la
++                    -lgtest
+ 
+ test_plugin_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include
+ test_plugin_SOURCES = \