Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
protobuf getexecpath
To:
ports@openbsd.org
Cc:
jrick@openbsd.org
Date:
Thu, 10 Sep 2026 19:19:48 +0200

Download raw body.

Thread
  • Theo Buehler:

    protobuf getexecpath

Replace one of the usual hacks by a call to getexecpath().

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/protobuf/Makefile,v
diff -u -p -r1.113 Makefile
--- Makefile	7 Sep 2026 16:28:19 -0000	1.113
+++ Makefile	10 Sep 2026 17:12:01 -0000
@@ -2,7 +2,7 @@ COMMENT =		c++ protocol buffers
 
 CPPMAJOR =		7
 PROTOBUF_VERSION =	36.1
-REVISION =		0
+REVISION =		1
 
 # Keep PROTOBUF_VERSION in devel/py-protobuf and devel/protobuf-java
 # in sync with this port.
@@ -77,8 +77,5 @@ CONFIGURE_ARGS +=	-Dprotobuf_BUILD_SHARE
 # Tests have been broken for a long time.
 CONFIGURE_ARGS +=	-Dprotobuf_BUILD_TESTS=OFF
 NO_TEST =		Yes
-
-pre-configure:
-	${SUBST_CMD} ${WRKSRC}/src/google/protobuf/compiler/command_line_interface.cc
 
 .include <bsd.port.mk>
Index: patches/patch-src_google_protobuf_compiler_command_line_interface_cc
===================================================================
RCS file: /cvs/ports/devel/protobuf/patches/patch-src_google_protobuf_compiler_command_line_interface_cc,v
diff -u -p -r1.6 patch-src_google_protobuf_compiler_command_line_interface_cc
--- patches/patch-src_google_protobuf_compiler_command_line_interface_cc	10 Mar 2026 15:09:27 -0000	1.6
+++ patches/patch-src_google_protobuf_compiler_command_line_interface_cc	10 Sep 2026 17:10:53 -0000
@@ -1,15 +1,16 @@
 Index: src/google/protobuf/compiler/command_line_interface.cc
 --- src/google/protobuf/compiler/command_line_interface.cc.orig
 +++ src/google/protobuf/compiler/command_line_interface.cc
-@@ -235,6 +235,11 @@ bool GetProtocAbsolutePath(std::string* path) {
+@@ -235,6 +235,12 @@ bool GetProtocAbsolutePath(std::string* path) {
    if (sysctl(mib, 4, &buffer, &len, nullptr, 0) != 0) {
      len = 0;
    }
 +#elif defined(__OpenBSD__)
-+  std::string protocpath("${LOCALBASE}/bin/protoc");
 +  char buffer[PATH_MAX]{};
-+  protocpath.copy(buffer, sizeof buffer - 1);
-+  int len = protocpath.length();
++  size_t len = 0;
++  if (getexecpath(buffer, sizeof buffer) == 0) {
++    len = strlen(buffer);
++  }
  #else
    char buffer[PATH_MAX];
    int len = readlink("/proc/self/exe", buffer, PATH_MAX);