$OpenBSD: patch-tools_build_src_engine_pathsys_h,v 1.3 2021/09/19 05:23:29 rsadowski Exp $

[PATCH] Add a default exec path logic.

This adds default/fallback logic to determine the b2 exec absolute path
as possible. It uses the arg0 and current dir or path to construct the
liekliest path.

* Fix `b2` executable path determination for platforms that don't have a
  native method of getting the path to executables, like OpenBSD.

Index: tools/build/src/engine/pathsys.h
--- tools/build/src/engine/pathsys.h.orig
+++ tools/build/src/engine/pathsys.h
@@ -108,6 +108,14 @@ namespace b2
                 (p.size() >= 1 && (p[0] == '/' || p[0] == '\\'));
             #endif
         }
+        inline bool is_relative(const std::string &p)
+        {
+            return
+                (p.size() >= 3 && (
+                    (p[0] == '.' && p[1] == '.' && (p[2] == '/' || p[2] == '\\')) ||
+                    (p[0] == '.' && (p[1] == '/' || p[1] == '\\'))
+                    ));
+        }
         std::string normalize(const std::string &p);
     }
 }
