ports/devel/godot/files/patch-drivers_unix_os__unix.cpp
Kurt Jaeger 22d1c0735c devel/godot: Update to 2.1 and add minimal devel/godot-tools slave port
- Update to 2.1 release
- Add LICENSE_FILE for MIT license
- Add CCBYv3 license for logo
- Add devel/xdg-user-dirs, devel/xdg-utils and x11/xmessage to RUN_DEPENDS
- Add xrandr to USE_XORG
- Replace USE_OPENSSL=yes with USES+=ssl
- Add gl to USE_GL
- Remove GLU dependency - glu.h was included from imported glew.h
  but GLU components are not used
- Add DEBUG option and clarify build targets
- Replace TOOLS option with devel/godot-tools port, while devel/godot
  port used as runtime
- Allow to build ALSA and PulseAudio drivers independently
- Allow to build RtAudio driver with OSS or ALSA or PulseAudio
- Set OSS option by default
- Add desktop entry for godot-tools
- Add sed patch to fix executable paths inside of
  ${WRKSRC}/platform/x11/os_x11.cpp file
- Remove mkdir, because of COPYTREE_SHARE usage, which recreates
  destination directories
- Remove RM command for demos/2d/hexamap/.fscache file, because the
  file is not available for current version
- Add patch to enable OSS usage for RtAudio driver on FreeBSD
- Add patch to fix issue(s) with OS_Unix::execute and
  OS_Unix::get_executable_path functions on FreeBSD
- Add patch to fix layout of --help text
- Remove pkg-plist and use dynamic package list with PORTDATA and PLIST_FILES
- Use current head commit of 2.1 branch from new github repo
  godotengine/godot-demo-projects to install examples (this was
  previously part of godot repo)

PR:		209742
Submitted by:	lightside@gmx.com
Approved by:	FreeBSD@Shaneware.biz
2016-08-24 19:21:11 +00:00

50 lines
1.5 KiB
C++

--- drivers/unix/os_unix.cpp.orig 2016-08-09 07:52:15 UTC
+++ drivers/unix/os_unix.cpp
@@ -50,6 +50,7 @@
#ifdef __FreeBSD__
#include <sys/param.h>
+#include <sys/sysctl.h>
#endif
#include <stdarg.h>
#include <sys/time.h>
@@ -371,17 +372,7 @@ Error OS_Unix::execute(const String& p_p
args.push_back((char*)cs[i].get_data());// shitty C cast
args.push_back(0);
-#ifdef __FreeBSD__
- if(p_path.find("/")) {
- // exec name contains path so use it
- execv(p_path.utf8().get_data(),&args[0]);
- }else{
- // use program name and search through PATH to find it
- execvp(getprogname(),&args[0]);
- }
-#else
execv(p_path.utf8().get_data(),&args[0]);
-#endif
// still alive? something failed..
fprintf(stderr,"**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n",p_path.utf8().get_data());
abort();
@@ -503,11 +494,16 @@ String OS_Unix::get_executable_path() co
}
return b;
#elif defined(__FreeBSD__)
- char resolved_path[MAXPATHLEN];
-
- realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
-
- return String(resolved_path);
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+ char buf[MAXPATHLEN];
+ size_t len = sizeof(buf);
+ if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
+ WARN_PRINT("Couldn't get executable path from sysctl");
+ return OS::get_executable_path();
+ }
+ String b;
+ b.parse_utf8(buf);
+ return b;
#elif defined(__APPLE__)
char temp_path[1];
uint32_t buff_size=1;