Merge branch 'khorben/netbsd'

This commit is contained in:
2017-12-13 23:07:41 +01:00
7 changed files with 26 additions and 6 deletions
+9 -3
View File
@@ -31,9 +31,15 @@ else
ifeq ($(platform),Darwin)
LUAPLATFORM = macosx
else
LUALIB += -ldl
LDLIBS += -ltermcap -lncurses
LUAPLATFORM = linux
ifeq ($(platform),NetBSD)
LDLIBS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
LDLIBS += -ltermcap -lncurses
LUAPLATFORM = netbsd
else
LUALIB += -ldl
LDLIBS += -ltermcap -lncurses
LUAPLATFORM = linux
endif
endif
endif
+1 -1
View File
@@ -146,7 +146,7 @@ bitslice_test_nonces_t bitslice_test_nonces_dispatch;
#if defined (_WIN32)
#define malloc_bitslice(x) __builtin_assume_aligned(_aligned_malloc((x), MAX_BITSLICES/8), MAX_BITSLICES/8)
#define free_bitslice(x) _aligned_free(x)
#elif defined (__APPLE__)
#elif defined (__APPLE__) || defined(__NetBSD__)
static void *malloc_bitslice(size_t x) {
char *allocated_memory;
if (posix_memalign((void**)&allocated_memory, MAX_BITSLICES/8, x)) {
+1 -1
View File
@@ -147,7 +147,7 @@ inline uint32_t *MALLOC_BITARRAY(uint32_t x)
{
#if defined (_WIN32)
return __builtin_assume_aligned(_aligned_malloc((x), __BIGGEST_ALIGNMENT__), __BIGGEST_ALIGNMENT__);
#elif defined (__APPLE__)
#elif defined (__APPLE__) || defined(__NetBSD__)
uint32_t *allocated_memory;
if (posix_memalign((void**)&allocated_memory, __BIGGEST_ALIGNMENT__, x)) {
return NULL;
+3
View File
@@ -704,6 +704,9 @@ void xor(unsigned char *dst, unsigned char *src, size_t len) {
int32_t le24toh (uint8_t data[3]) {
return (data[2] << 16) | (data[1] << 8) | data[0];
}
#ifdef le32toh
# undef le32toh
#endif
uint32_t le32toh (uint8_t *data) {
return (uint32_t)( (data[3]<<24) | (data[2]<<16) | (data[1]<<8) | data[0]);
}
+3
View File
@@ -82,6 +82,9 @@ void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length);
void xor(unsigned char *dst, unsigned char *src, size_t len);
int32_t le24toh(uint8_t data[3]);
#ifdef le32toh
# undef le32toh
#endif
uint32_t le32toh (uint8_t *data);
void rol(uint8_t *data, const size_t len);
+5
View File
@@ -559,6 +559,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@@ -576,7 +577,11 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
for (;;)
{
#ifdef KERN_PROC_ARGV
int mib[4] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
#else
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
#endif
size_t size = sizeof(buffer1);
if (sysctl(mib, (u_int)(sizeof(mib) / sizeof(mib[0])), path, &size, NULL, 0) != 0)
+4 -1
View File
@@ -26,7 +26,7 @@ MYOBJS=
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
PLATS= aix ansi bsd freebsd generic linux macosx mingw netbsd posix solaris
LUA_A= liblua.a
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
@@ -114,6 +114,9 @@ mingw:
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
$(MAKE) "LUAC_T=luac.exe" luac.exe
netbsd:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib" SYSLIBS="-Wl,-E -lreadline -ltermcap -lncurses"
posix:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"