From 70c3c15d792145a42ea4b666703fc0813d40f4cf Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Mon, 9 Sep 2024 11:33:52 -0500 Subject: Add build --- init | 15 +++++++++++++++ meta.lua | 46 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/init b/init index 642d265..2e6353a 100755 --- a/init +++ b/init @@ -1 +1,16 @@ #!/bin/sh -ex + +cd lua-cjson +luarocks config variables.CFLAGS " $CFLAGS" +luarocks make --pack-binary-rock *.rockspec +obj=$(ls *.rock) +cp $obj /root +cd /root +if [ -z $(echo $CFLAGS | grep -o -E -- '( |^)-g( |$)') ]; then + # Release build, delete docs/ and tests/ + zip -d $obj docs/ docs/* tests/ tests/* + # And pack the library with upx + unzip $obj lib/* + find lib -type f | xargs upx --no-progress + zip -r "$obj" lib +fi diff --git a/meta.lua b/meta.lua index 347dd6c..bd48194 100644 --- a/meta.lua +++ b/meta.lua @@ -1,6 +1,42 @@ -return { - ["lua-cjson"] = { - requires = {}, - produces = {}, - } +local lua_versions = { + ["51"] = true, + ["52"] = true, + ["53"] = true, + ["54"] = true, +} +local optimizations = { + tiny = "-Oz", + size = "-Os", + zero = "-O0", + one = "-O1", + two = "-O2", + three = "-O3", } +local debug = { + release = "", + debug = "-g", +} +local compilers = {--[["mingw32",]]"mingw64"--[[,"clang32","clang64"]]} +local package = "lua-cjson" + +local builds = {} +for version, _, name, optimization, rel, flag, _, image in cartesian(lua_versions, optimizations, debug, compilers) do + builds[package .. "-" .. version .. "-" .. name .. "-" .. rel .. "-" .. image] = { + image = "image-luarocks-" .. version.. "-" .. image, + requires = { + {"git", package}, + {"cicd","image-luarocks-" .. version .. "-" .. image}, + {"cicd","lua" .. version .. "-" .. name .. "-" .. rel .. "-" .. image .. ":lua" .. version .. ".dll"}, + }, + produces = { + ["lua-cjson-2.1.0.14-1.mingw32-x86_64.rock"] = {"luarocks.sh", package, image, version, name, rel}, + }, + env = { + CFLAGS = optimization .. " " .. flag, + rockver = version:gsub("(%d)(%d)$","%1.%2"), + version = version + }, + } +end + +return builds -- cgit v1.2.3-55-g6feb