summaryrefslogtreecommitdiff
path: root/science/py-tensorflow/files/bazel/fix-environ.patch
diff options
context:
space:
mode:
authorAnthony Donnelly <amzo1337@gmail.com>2022-09-13 13:21:29 -0700
committerYuri Victorovich <yuri@FreeBSD.org>2022-09-13 13:32:36 -0700
commit56dc0e449f2a0fdf190cfc1de367b148cbb5e467 (patch)
treed7af37d6282446e80c5c5e924f18790c0558d831 /science/py-tensorflow/files/bazel/fix-environ.patch
parentnet-mgmt/zabbix62-server: Add PORTSCOUT (diff)
science/py-tensorflow: Update 1.15.5 -> 2.9.1
Big thank you to Anthony Donnelly for updating this difficult port. PR: 266303
Diffstat (limited to 'science/py-tensorflow/files/bazel/fix-environ.patch')
-rw-r--r--science/py-tensorflow/files/bazel/fix-environ.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/science/py-tensorflow/files/bazel/fix-environ.patch b/science/py-tensorflow/files/bazel/fix-environ.patch
new file mode 100644
index 000000000000..2e38ce60543d
--- /dev/null
+++ b/science/py-tensorflow/files/bazel/fix-environ.patch
@@ -0,0 +1,42 @@
+--- a/llvm/lib/Support/Unix/Program.inc 2022-09-06 21:14:28.808580000 +0100
++++ b/llvm/lib/Support/Unix/Program.inc 2022-09-06 21:16:15.007790000 +0100
+@@ -54,10 +54,8 @@
+ #define USE_NSGETENVIRON 0
+ #endif
+
+-#if !USE_NSGETENVIRON
++#if USE_NSGETENVIRON
+ extern char **environ;
+-#else
+-#include <crt_externs.h> // _NSGetEnviron
+ #endif
+ #endif
+
+@@ -240,14 +238,6 @@
+ }
+ }
+
+- if (!Envp)
+-#if !USE_NSGETENVIRON
+- Envp = const_cast<const char **>(environ);
+-#else
+- // environ is missing in dylibs.
+- Envp = const_cast<const char **>(*_NSGetEnviron());
+-#endif
+-
+ constexpr int maxRetries = 8;
+ int retries = 0;
+ pid_t PID;
+@@ -308,11 +298,7 @@
+
+ // Execute!
+ std::string PathStr = std::string(Program);
+- if (Envp != nullptr)
+- execve(PathStr.c_str(), const_cast<char **>(Argv),
+- const_cast<char **>(Envp));
+- else
+- execv(PathStr.c_str(), const_cast<char **>(Argv));
++ execv(PathStr.c_str(), const_cast<char **>(Argv));
+ // If the execve() failed, we should exit. Follow Unix protocol and
+ // return 127 if the executable was not found, and 126 otherwise.
+ // Use _exit rather than exit so that atexit functions and static