From b1ddcff9ea6f74a42c78992220b08c19ae3d2951 Mon Sep 17 00:00:00 2001 From: luau-project Date: Fri, 10 Jan 2025 14:55:16 -0300 Subject: [PATCH] improvement: rework rockspecs to get rid of a Makefile on macOS / iOS --- Makefile.macosx | 24 -------- rockspecs/lua-hash-0.0.1-1.rockspec | 93 +++++++++-------------------- rockspecs/lua-hash-dev-1.rockspec | 93 +++++++++-------------------- 3 files changed, 56 insertions(+), 154 deletions(-) delete mode 100644 Makefile.macosx diff --git a/Makefile.macosx b/Makefile.macosx deleted file mode 100644 index db19220..0000000 --- a/Makefile.macosx +++ /dev/null @@ -1,24 +0,0 @@ -OBJ_EXTENSION = o -LIB_EXTENSION = so -CFLAGS_EXTRA = -DLUA_HASH_BUILD_SHARED -DLUA_HASH_USE_APPLE -LIBFLAG_EXTRA = - -LUA_DIR = /usr/local -LUA_INCDIR = $(LUA_DIR)/include - -LUA_VERSION = 5.1 -INSTALL_PREFIX = /usr/local -INSTALL_LIBDIR = $(INSTALL_PREFIX)/lib/lua/$(LUA_VERSION) - -all: src/lua-hash.$(LIB_EXTENSION) - -src/lua-hash.$(LIB_EXTENSION): src/lua-hash.$(OBJ_EXTENSION) - $(CC) $(LIBFLAG_EXTRA) $(LIBFLAG) -o $@ $< - -src/lua-hash.$(OBJ_EXTENSION): src/lua-hash.c - $(CC) -c $(CFLAGS_EXTRA) $(CFLAGS) -I$(LUA_INCDIR) $< -o $@ - -install: src/lua-hash.$(LIB_EXTENSION) - cp $< $(INSTALL_LIBDIR) - -.PHONY: all install diff --git a/rockspecs/lua-hash-0.0.1-1.rockspec b/rockspecs/lua-hash-0.0.1-1.rockspec index a2a1ce2..59be499 100644 --- a/rockspecs/lua-hash-0.0.1-1.rockspec +++ b/rockspecs/lua-hash-0.0.1-1.rockspec @@ -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 @@ -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') } } diff --git a/rockspecs/lua-hash-dev-1.rockspec b/rockspecs/lua-hash-dev-1.rockspec index 0e6d2c2..ed1cf5a 100644 --- a/rockspecs/lua-hash-dev-1.rockspec +++ b/rockspecs/lua-hash-dev-1.rockspec @@ -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 @@ -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') } }