Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added BSD support #742

Merged
merged 2 commits into from
Apr 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Bootstrap.mak
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ linux: $(SRC)
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`

bsd: $(SRC)
mkdir -p build/bootstrap
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" $? -lm
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`

windows-base: $(SRC)
if not exist build\bootstrap (mkdir build\bootstrap)
cl /Fo.\build\bootstrap\ /Fe.\build\bootstrap\premake_bootstrap.exe /DPREMAKE_NO_BUILTIN_SCRIPTS /I"$(LUA_DIR)" user32.lib ole32.lib advapi32.lib $**
Expand Down
4 changes: 4 additions & 0 deletions contrib/curl/lib/curl_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
# include "config-linux.h"
#endif

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include "config-linux.h"
#endif

#ifdef __APPLE__ && __MACH__
# include "config-osx.h"
#endif
Expand Down
5 changes: 3 additions & 2 deletions contrib/curl/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project "curl-lib"
"**.h",
"**.c"
}

filter { "system:windows" }
defines { "USE_SCHANNEL", "USE_WINDOWS_SSPI" }

Expand All @@ -25,7 +25,7 @@ project "curl-lib"
filter { "system:not windows", "system:not macosx" }
defines { "USE_MBEDTLS" }

filter { "system:linux" }
filter { "system:linux or bsd" }
defines { "CURL_HIDDEN_SYMBOLS" }

-- find the location of the ca bundle
Expand All @@ -35,6 +35,7 @@ project "curl-lib"
"/etc/pki/tls/certs/ca-bundle.crt",
"/usr/share/ssl/certs/ca-bundle.crt",
"/usr/local/share/certs/ca-root.crt",
"/usr/local/share/certs/ca-root-nss.crt",
"/etc/ssl/cert.pem" } do
if os.isfile(f) then
ca = f
Expand Down
2 changes: 1 addition & 1 deletion contrib/libzip/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project "zip-lib"
"**.c"
}

filter "system:linux"
filter "system:linux or bsd"
defines { "HAVE_SSIZE_T_LIBZIP", "HAVE_CONFIG_H" }

filter "system:windows"
Expand Down
15 changes: 15 additions & 0 deletions src/host/premake.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include <CoreFoundation/CFBundle.h>
#endif

#if PLATFORM_BSD
#include <sys/types.h>
#include <sys/sysctl.h>
#endif

#define ERROR_MESSAGE "Error: %s\n"

Expand Down Expand Up @@ -262,6 +266,17 @@ int premake_locate_executable(lua_State* L, const char* argv0)
int len = readlink("/proc/curproc/file", buffer, PATH_MAX - 1);
if (len < 0)
len = readlink("/proc/curproc/exe", buffer, PATH_MAX - 1);
if (len < 0)
{
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
size_t cb = sizeof(buffer);
sysctl(mib, 4, buffer, &cb, NULL, 0);
len = (int)cb;
}
if (len > 0)
{
buffer[len] = 0;
Expand Down