Skip to content

Commit

Permalink
improvement: rework rockspecs to get rid of a Makefile on macOS / iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
luau-project committed Jan 10, 2025
1 parent 9ace573 commit b1ddcff
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 154 deletions.
24 changes: 0 additions & 24 deletions Makefile.macosx

This file was deleted.

93 changes: 28 additions & 65 deletions rockspecs/lua-hash-0.0.1-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,69 +20,35 @@ dependencies = {
"lua >= 5.1"
}

local function external_dependencies_plat()
return {
["CRYPTO"] = {
header = "openssl/evp.h"
}
}
end

external_dependencies = {
platforms = {
linux = external_dependencies_plat(),
freebsd = external_dependencies_plat(),
openbsd = external_dependencies_plat(),
netbsd = external_dependencies_plat(),
dragonfly = external_dependencies_plat()
}
}

local function build_plat(plat)
if (plat == "macosx" or plat == "macos") then
local function build_platform_modules(plat)
if (plat == 'default') then
return {
type = "make",
makefile = "Makefile.macosx",
build_variables = {
CFLAGS = "$(CFLAGS)",
LIBFLAG = "$(LIBFLAG)",
CFLAGS_EXTRA = "-DLUA_HASH_BUILD_SHARED -DLUA_HASH_USE_APPLE",
LIBFLAG_EXTRA = "",
LUA_INCDIR = "$(LUA_INCDIR)",
OBJ_EXTENSION = "$(OBJ_EXTENSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
},
install_variables = {
INSTALL_PREFIX = "$(PREFIX)",
INSTALL_LIBDIR = "$(LIBDIR)",
LUA_VERSION = "$(LUA_VERSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "crypto" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_OPENSSL" },
incdirs = { "src", "$(CRYPTO_INCDIR)" },
libdirs = { "$(CRYPTO_LIBDIR)" }
}
}
elseif (plat == "windows" or plat == "cygwin") then
elseif (plat == 'windows' or plat == 'cygwin') then
return {
type = "builtin",
modules = {
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "bcrypt" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_WIN32" },
incdirs = { "src" },
libdirs = { }
}
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "bcrypt" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_WIN32" },
incdirs = { "src" },
libdirs = { }
}
}
elseif (plat == "linux" or plat == "bsd") then
elseif (plat == 'macosx' or plat == 'macos') then
return {
type = "builtin",
modules = {
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "crypto" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_OPENSSL" },
incdirs = { "src", "$(CRYPTO_INCDIR)" },
libdirs = { "$(CRYPTO_LIBDIR)" }
}
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_APPLE" },
incdirs = { "src" },
libdirs = { }
}
}
else
Expand All @@ -91,15 +57,12 @@ local function build_plat(plat)
end

build = {
type = "builtin",
modules = build_platform_modules('default'),
platforms = {
macosx = build_plat("macosx"),
macos = build_plat("macos"),
windows = build_plat("windows"),
cygwin = build_plat("cygwin"),
linux = build_plat("linux"),
freebsd = build_plat("bsd"),
openbsd = build_plat("bsd"),
netbsd = build_plat("bsd"),
dragonfly = build_plat("bsd")
windows = build_platform_modules('windows'),
cygwin = build_platform_modules('cygwin'),
macos = build_platform_modules('macos'),
macosx = build_platform_modules('macosx')
}
}
93 changes: 28 additions & 65 deletions rockspecs/lua-hash-dev-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,35 @@ dependencies = {
"lua >= 5.1"
}

local function external_dependencies_plat()
return {
["CRYPTO"] = {
header = "openssl/evp.h"
}
}
end

external_dependencies = {
platforms = {
linux = external_dependencies_plat(),
freebsd = external_dependencies_plat(),
openbsd = external_dependencies_plat(),
netbsd = external_dependencies_plat(),
dragonfly = external_dependencies_plat()
}
}

local function build_plat(plat)
if (plat == "macosx" or plat == "macos") then
local function build_platform_modules(plat)
if (plat == 'default') then
return {
type = "make",
makefile = "Makefile.macosx",
build_variables = {
CFLAGS = "$(CFLAGS)",
LIBFLAG = "$(LIBFLAG)",
CFLAGS_EXTRA = "-DLUA_HASH_BUILD_SHARED -DLUA_HASH_USE_APPLE",
LIBFLAG_EXTRA = "",
LUA_INCDIR = "$(LUA_INCDIR)",
OBJ_EXTENSION = "$(OBJ_EXTENSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
},
install_variables = {
INSTALL_PREFIX = "$(PREFIX)",
INSTALL_LIBDIR = "$(LIBDIR)",
LUA_VERSION = "$(LUA_VERSION)",
LIB_EXTENSION = "$(LIB_EXTENSION)"
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "crypto" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_OPENSSL" },
incdirs = { "src", "$(CRYPTO_INCDIR)" },
libdirs = { "$(CRYPTO_LIBDIR)" }
}
}
elseif (plat == "windows" or plat == "cygwin") then
elseif (plat == 'windows' or plat == 'cygwin') then
return {
type = "builtin",
modules = {
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "bcrypt" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_WIN32" },
incdirs = { "src" },
libdirs = { }
}
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "bcrypt" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_WIN32" },
incdirs = { "src" },
libdirs = { }
}
}
elseif (plat == "linux" or plat == "bsd") then
elseif (plat == 'macosx' or plat == 'macos') then
return {
type = "builtin",
modules = {
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { "crypto" },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_OPENSSL" },
incdirs = { "src", "$(CRYPTO_INCDIR)" },
libdirs = { "$(CRYPTO_LIBDIR)" }
}
["lua-hash"] = {
sources = { "src/lua-hash.c" },
libraries = { },
defines = { "LUA_HASH_BUILD_SHARED", "LUA_HASH_USE_APPLE" },
incdirs = { "src" },
libdirs = { }
}
}
else
Expand All @@ -90,15 +56,12 @@ local function build_plat(plat)
end

build = {
type = "builtin",
modules = build_platform_modules('default'),
platforms = {
macosx = build_plat("macosx"),
macos = build_plat("macos"),
windows = build_plat("windows"),
cygwin = build_plat("cygwin"),
linux = build_plat("linux"),
freebsd = build_plat("bsd"),
openbsd = build_plat("bsd"),
netbsd = build_plat("bsd"),
dragonfly = build_plat("bsd")
windows = build_platform_modules('windows'),
cygwin = build_platform_modules('cygwin'),
macos = build_platform_modules('macos'),
macosx = build_platform_modules('macosx')
}
}

0 comments on commit b1ddcff

Please sign in to comment.