git: 45a58b5c3378 - main - databases/kyotocabinet: Convert REINPLACE_CMD to patch files

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 18 May 2025 03:36:49 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=45a58b5c33785041bd49924b2d817703fc042d2f

commit 45a58b5c33785041bd49924b2d817703fc042d2f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2025-05-18 03:15:31 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2025-05-18 03:15:31 +0000

    databases/kyotocabinet: Convert REINPLACE_CMD to patch files
---
 databases/kyotocabinet/Makefile                    | 10 ----
 databases/kyotocabinet/files/patch-configure       | 59 ++++++++++++++++++++++
 databases/kyotocabinet/files/patch-doc-spex.html   | 11 ++++
 .../kyotocabinet/files/patch-example-Makefile      | 11 ++++
 4 files changed, 81 insertions(+), 10 deletions(-)

diff --git a/databases/kyotocabinet/Makefile b/databases/kyotocabinet/Makefile
index 540f015c6af0..cd1bf2a5159e 100644
--- a/databases/kyotocabinet/Makefile
+++ b/databases/kyotocabinet/Makefile
@@ -20,21 +20,11 @@ CPPFLAGS+=	-fPIC
 GNU_CONFIGURE=	yes
 INSTALL_TARGET=	install-strip
 MAKE_ARGS=	PCDIR=${PREFIX}/libdata/pkgconfig
-REINPLACE_ARGS=	-i ''
 TEST_TARGET=	check
 USE_LDCONFIG=	yes
 
 OPTIONS_DEFINE=	DOCS
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|-lstdc++ ||g' ${WRKSRC}/configure ${WRKSRC}/doc/spex.html ${WRKSRC}/example/Makefile ${WRKSRC}/lab/kcdict/Makefile
-	@${REINPLACE_CMD} -e 's|-g0 -O2||g' \
-	    ${PATCH_WRKSRC}/configure
-	@${REINPLACE_CMD} -e 's|-march=native||g' \
-	    ${PATCH_WRKSRC}/configure
-	@${REINPLACE_CMD} -e 's|-m64 ||g' \
-	    ${PATCH_WRKSRC}/configure
-
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libkyotocabinet.so
 
diff --git a/databases/kyotocabinet/files/patch-configure b/databases/kyotocabinet/files/patch-configure
new file mode 100644
index 000000000000..8818087aa773
--- /dev/null
+++ b/databases/kyotocabinet/files/patch-configure
@@ -0,0 +1,59 @@
+--- configure.orig	2023-04-13 18:15:33 UTC
++++ configure
+@@ -2139,8 +2139,8 @@ MYPCFILES="kyotocabinet.pc"
+ MYPCFILES="kyotocabinet.pc"
+ 
+ # Building flags
+-MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char -g0 -O2"
+-MYCXXFLAGS="-Wall -fPIC -fsigned-char -g0 -O2"
++MYCFLAGS="-Wall -ansi -pedantic -fPIC -fsigned-char"
++MYCXXFLAGS="-Wall -fPIC -fsigned-char"
+ MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I/usr/local/include"
+ MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1"
+ MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D__EXTENSIONS__"
+@@ -4007,10 +4007,10 @@ printf 'checking for 64-bit availability... '
+ 
+ # System-depending optimization
+ printf 'checking for 64-bit availability... '
+-if printf 'int main(void) {return 0;}' | $CC -xc -m64 -o config.tmp - >config.tmp 2>&1
++if printf 'int main(void) {return 0;}' | $CC -xc -o config.tmp - >config.tmp 2>&1
+ then
+-  MYCFLAGS="-m64 $MYCFLAGS"
+-  MYCXXFLAGS="-m64 $MYCXXFLAGS"
++  MYCFLAGS="$MYCFLAGS"
++  MYCXXFLAGS="$MYCXXFLAGS"
+   printf 'yes\n'
+ else
+   printf 'no\n'
+@@ -4018,10 +4018,10 @@ then
+ if test "$enable_opt" != "no"
+ then
+   printf 'checking for CPU optimization availability... '
+-  if printf 'int main(void) {return 0;}' | $CC -xc -march=native -o config.tmp - >config.tmp 2>&1
++  if printf 'int main(void) {return 0;}' | $CC -xc  -o config.tmp - >config.tmp 2>&1
+   then
+-    MYCFLAGS="-march=native $MYCFLAGS"
+-    MYCXXFLAGS="-march=native $MYCXXFLAGS"
++    MYCFLAGS="$MYCFLAGS"
++    MYCXXFLAGS="$MYCXXFLAGS"
+     printf 'yes\n'
+   else
+     printf 'no\n'
+@@ -4231,7 +4231,7 @@ else
+   $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lstdc++  $LIBS"
++LIBS="$LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+@@ -4260,7 +4260,7 @@ _ACEOF
+ #define HAVE_LIBSTDC__ 1
+ _ACEOF
+ 
+-  LIBS="-lstdc++ $LIBS"
++  LIBS="$LIBS"
+ 
+ fi
+ 
diff --git a/databases/kyotocabinet/files/patch-doc-spex.html b/databases/kyotocabinet/files/patch-doc-spex.html
new file mode 100644
index 000000000000..e01715f2aa4a
--- /dev/null
+++ b/databases/kyotocabinet/files/patch-doc-spex.html
@@ -0,0 +1,11 @@
+--- doc/spex.html.orig	2012-05-24 11:32:01 UTC
++++ doc/spex.html
+@@ -257,7 +257,7 @@
+ <p>Kyoto Cabinet provides API of the C++ language and it is available by programs conforming to the C++03 standard.  As the header files of Kyoto Cabinet are provided as `<code>kcutil.h</code>', `<code>kchashdb.h</code>', and so on, applications should include one or more of them accordingly to use the API.  As the library is provided as `<code>libkyotocabinet.a</code>' and `<code>libkyotocabinet.so</code>' and they depends on `<code>libz.so</code>', `<code>libstdc++.so</code>', `<code>librt.so</code>', `<code>libpthread.so</code>', `<code>libm.so</code>', and `<code>libc.so</code>', linker options corresponding to them are required by the build command.  The typical build command is the following.</p>
+ 
+ <pre>$ g++ -I/usr/local/include example.cc -o example \
+-  -L/usr/local/lib -lkyotocabinet -lz -lstdc++ -lrt -lpthread -lm -lc
++  -L/usr/local/lib -lkyotocabinet -lz -lrt -lpthread -lm -lc
+ </pre>
+ 
+ <h3 id="installation_windows">For Windows</h3>
diff --git a/databases/kyotocabinet/files/patch-example-Makefile b/databases/kyotocabinet/files/patch-example-Makefile
new file mode 100644
index 000000000000..896196921d67
--- /dev/null
+++ b/databases/kyotocabinet/files/patch-example-Makefile
@@ -0,0 +1,11 @@
+--- example/Makefile.orig	2011-02-05 14:17:43 UTC
++++ example/Makefile
+@@ -20,7 +20,7 @@ LDFLAGS =
+ CFLAGS = -I. -I.. -Wall -ansi -pedantic -fsigned-char -O2
+ CXXFLAGS = -I. -I.. -Wall -fsigned-char -O2
+ LDFLAGS =
+-LIBS = -L. -L.. -lkyotocabinet -lstdc++ -lz -lrt -lpthread -lm -lc
++LIBS = -L. -L.. -lkyotocabinet -lz -lrt -lpthread -lm -lc
+ LDENV = LD_RUN_PATH=/lib:/usr/lib:$(HOME)/lib:/usr/local/lib:.:..
+ RUNENV = LD_LIBRARY_PATH=/lib:/usr/lib:$(HOME)/lib:/usr/local/lib:.:..
+