On Fri Sep 18, 2026 at 09:00:57AM -0700, Thomas Frohwein wrote:
> Hi,
> 
> Diff to use getexecpath(3) rather than the hardcoded path workaround.
> (make update-patches also regenerated patch-build_gen_py FYI.)
> 
> ok?

reads fine, OK rsadowski

> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/gn/Makefile,v
> diff -u -p -r1.7 Makefile
> --- Makefile  6 May 2026 16:40:28 -0000       1.7
> +++ Makefile  18 Sep 2026 15:31:31 -0000
> @@ -9,6 +9,7 @@ DATE =                20251214
>  VERSION =    0.0.${DATE}
>  DISTNAME =   gn-${DATE}
>  PKGNAME =    gn-${VERSION}
> +REVISION =   0
>  
>  # gn.googlesource.com does not provide stable snapshots
>  SITES =              https://codeberg.org/vlkrs/gn/archive/
> @@ -34,8 +35,7 @@ WRKDIST =   ${WRKDIR}/gn
>  WANTLIB += ${COMPILER_LIBCXX} c m
>  
>  post-patch:
> -     ${SUBST_CMD} ${WRKSRC}/src/util/exe_path.cc \
> -             ${WRKSRC}/src/gn/command_format_unittest.cc
> +     ${SUBST_CMD} ${WRKSRC}/src/gn/command_format_unittest.cc
>  
>  do-build:
>       ${SETENV} ${MAKE_ENV} ninja -C${WRKSRC}/out -j${MAKE_JOBS} -v
> Index: patches/patch-build_gen_py
> ===================================================================
> RCS file: /cvs/ports/devel/gn/patches/patch-build_gen_py,v
> diff -u -p -r1.2 patch-build_gen_py
> --- patches/patch-build_gen_py        21 Mar 2025 22:33:25 -0000      1.2
> +++ patches/patch-build_gen_py        18 Sep 2026 15:31:31 -0000
> @@ -3,7 +3,7 @@ Set version based on port version, remov
>  Index: build/gen.py
>  --- build/gen.py.orig
>  +++ build/gen.py
> -@@ -241,25 +241,16 @@ def is_gcc(cxx):
> +@@ -245,25 +245,16 @@ def is_gcc(cxx):
>     return ret.returncode == 0 and "#define __GNUC__" in ret.stdout and not 
> "#define __clang__" in ret.stdout
>   
>   def GenerateLastCommitPosition(host, header):
> @@ -31,7 +31,7 @@ Index: build/gen.py
>   
>     # Only write/touch this file if the commit position has changed.
>     old_contents = ''
> -@@ -432,10 +423,8 @@ def WriteGNNinja(path, platform, host, options, args_l
> +@@ -441,10 +432,8 @@ def WriteGNNinja(path, platform, host, options, args_l
>           cflags.extend(['-D_LIBCPP_DEBUG=1', '-D_GLIBCXX_DEBUG=1'])
>       else:
>         cflags.append('-DNDEBUG')
> Index: patches/patch-src_util_exe_path_cc
> ===================================================================
> RCS file: /cvs/ports/devel/gn/patches/patch-src_util_exe_path_cc,v
> diff -u -p -r1.1.1.1 patch-src_util_exe_path_cc
> --- patches/patch-src_util_exe_path_cc        3 May 2023 12:30:17 -0000       
> 1.1.1.1
> +++ patches/patch-src_util_exe_path_cc        18 Sep 2026 15:31:31 -0000
> @@ -1,20 +1,19 @@
> -Use hardcoded path to gn binary
> -
>  Index: src/util/exe_path.cc
>  --- src/util/exe_path.cc.orig
>  +++ src/util/exe_path.cc
> -@@ -117,13 +117,7 @@ base::FilePath GetExePath() {
> - #else
> - 
> - base::FilePath GetExePath() {
> --  base::FilePath result;
> --  const char kProcSelfExe[] = "/proc/self/exe";
> --  if (!ReadSymbolicLink(base::FilePath(kProcSelfExe), &result)) {
> --    NOTREACHED() << "Unable to resolve " << kProcSelfExe << ".";
> --    return base::FilePath();
> --  }
> --  return result;
> -+  return base::FilePath("${LOCALBASE}/bin/gn");
> +@@ -81,6 +81,15 @@ base::FilePath GetExePath() {
> +   return base::FilePath(buf);
>   }
>   
> - #endif
> ++#elif defined(OS_OPENBSD)
> ++
> ++base::FilePath GetExePath() {
> ++  char execpath[PATH_MAX];
> ++  if (getexecpath(execpath, sizeof(execpath)) != 0)
> ++    return base::FilePath();
> ++  return base::FilePath(execpath);
> ++}
> ++
> + #elif defined(OS_HAIKU)
> + 
> + base::FilePath GetExePath() {
> 

Reply via email to