commit 10bd9fd28573e4bf3a508404606edfc969384e1d
parent d64cdc8bc46cff23aea4e7537070594fc6836f04
Author: Michael Savage <mikejsavage@gmail.com>
Date: Thu, 24 Dec 2015 14:53:18 +0000
Fix building on OpenBSD
Diffstat:
3 files changed, 73 insertions(+), 35 deletions(-)
diff --git a/Makefile.mess b/Makefile.mess
@@ -1,13 +1,3 @@
-# This is more or less what libressl does
-# See http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/lib/libssl/src/crypto/mem_clr.c?rev=1.4&content-type=text/x-cvsweb-markup
-CFLAGS += -DOPENSSL_cleanse=explicit_bzero
-
-# Make pwd.h define bcrypt_newnhash/bcrypt_checkpass
-CFLAGS += -D__BSD_VISIBLE
-
-# GCC whines without this. Assume everyone has strndup anyway
-CFLAGS += -DHAVE_STRNDUP
-
# Let Luarocks point us to the right headers
ifdef LUA_INCDIR
CFLAGS += -I$(LUA_INCDIR)
@@ -16,32 +6,46 @@ endif
# OS detection
uname := $(shell uname -s)
-ifneq ($(uname),Darwin)
+ifeq ($(uname),OpenBSD)
LDFLAGS += -shared
else
- LDFLAGS += -bundle -undefined dynamic_lookup
-endif
-
-CFLAGS += -Iinclude
-
-SRCS += compat/safebfuns.c
-SRCS += compat/bcrypt/bcrypt.c
-SRCS += compat/bcrypt/blowfish.c
-SRCS += compat/arc4random/arc4random.c
-SRCS += compat/strlcpy.c
-SRCS += compat/sha/sha512.c
-
-ifeq ($(uname),Linux)
- SRCS += compat/getentropy/getentropy_linux.c
- LDFLAGS += -lrt
-endif
-
-ifeq ($(uname),Darwin)
- SRCS += compat/getentropy/getentropy_osx.c
-endif
-
-ifeq ($(uname),FreeBSD)
- SRCS += compat/getentropy/getentropy_freebsd.c
+ # This is more or less what libressl does
+ # See http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/lib/libssl/src/crypto/mem_clr.c?rev=1.4&content-type=text/x-cvsweb-markup
+ CFLAGS += -DOPENSSL_cleanse=explicit_bzero
+
+ # Make pwd.h define bcrypt_newnhash/bcrypt_checkpass
+ CFLAGS += -D__BSD_VISIBLE
+
+ # GCC whines without this. Assume everyone has strndup anyway
+ CFLAGS += -DHAVE_STRNDUP
+
+ ifneq ($(uname),Darwin)
+ LDFLAGS += -shared
+ else
+ LDFLAGS += -bundle -undefined dynamic_lookup
+ endif
+
+ CFLAGS += -Iinclude
+
+ SRCS += compat/safebfuns.c
+ SRCS += compat/bcrypt/bcrypt.c
+ SRCS += compat/bcrypt/blowfish.c
+ SRCS += compat/arc4random/arc4random.c
+ SRCS += compat/strlcpy.c
+ SRCS += compat/sha/sha512.c
+
+ ifeq ($(uname),Linux)
+ SRCS += compat/getentropy/getentropy_linux.c
+ LDFLAGS += -lrt
+ endif
+
+ ifeq ($(uname),Darwin)
+ SRCS += compat/getentropy/getentropy_osx.c
+ endif
+
+ ifeq ($(uname),FreeBSD)
+ SRCS += compat/getentropy/getentropy_freebsd.c
+ endif
endif
compat/safebfuns.o: compat/safebfuns.c
diff --git a/Makefile.obsd b/Makefile.obsd
@@ -5,6 +5,6 @@ LDADD = -lcrypto
CFLAGS += `pkg-config --cflags lua51`
SHLIB_MAJOR = 2
-SHLIB_MINOR = 0
+SHLIB_MINOR = 1
.include <bsd.lib.mk>
diff --git a/rockspec/bcrypt-2.1-2.rockspec b/rockspec/bcrypt-2.1-2.rockspec
@@ -0,0 +1,34 @@
+package = "bcrypt"
+version = "2.1-2"
+
+source = {
+ url = "git://github.com/mikejsavage/lua-bcrypt.git",
+ tag = "v2.1-2",
+}
+
+description = {
+ summary = "A Lua wrapper for bcrypt",
+ homepage = "http://github.com/mikejsavage/lua-bcrypt",
+ license = "ISC",
+ maintainer = "Mike Savage",
+}
+
+dependencies = {
+ "lua >= 5.1",
+}
+
+build = {
+ type = "make",
+
+ install_pass = false,
+
+ build_variables = {
+ LUA_INCDIR = "$(LUA_INCDIR)",
+ },
+
+ install = {
+ lib = {
+ [ "bcrypt" ] = "bcrypt.so",
+ },
+ },
+}