From edf05590e666ca35a3a512aa49e26e9eae153ece Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Fri, 22 Nov 2024 17:41:20 -0600 Subject: Break bit32 into it's own build target. --- bit32 | 18 ++++++++++++++++++ init | 20 +++++--------------- meta.lua | 35 +++++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 23 deletions(-) create mode 100755 bit32 diff --git a/bit32 b/bit32 new file mode 100755 index 0000000..90534bd --- /dev/null +++ b/bit32 @@ -0,0 +1,18 @@ +#!/bin/sh -ex + +cd lua-compat-5.3 +cp rockspecs/bit32-scm-1.rockspec . +luarocks config variables.CFLAGS " $CFLAGS" +luarocks make --pack-binary-rock bit32-scm-1.rockspec +obj="bit32-scm-1.$(luarocks config arch).rock" +cp $obj /root +cd /root +if [ -z $(echo $CFLAGS | grep -o -E -- '( |^)-g( |$)') ]; then + # Release build, delete docs/ and tests/ + zip -d $obj doc/ doc/* + # And pack the library with upx + unzip $obj lib/* + upx --no-progress lib/* + zip -r "$obj" lib + rm -rf lib +fi diff --git a/init b/init index 5ffad4d..86d8c92 100755 --- a/init +++ b/init @@ -2,27 +2,17 @@ cd lua-compat-5.3 cp rockspecs/compat53-$packver.rockspec . -cp rockspecs/bit32-$packver.rockspec . luarocks config variables.CFLAGS " $CFLAGS" luarocks make --pack-binary-rock compat53-$packver.rockspec -luarocks make --pack-binary-rock bit32-$packver.rockspec -obj1="compat53-$packver.$(luarocks config arch).rock" -obj2="bit32-$packver.$(luarocks config arch).rock" -cp $obj1 /root -cp $obj2 /root +obj="compat53-$packver.$(luarocks config arch).rock" +cp $obj /root cd /root if [ -z $(echo $CFLAGS | grep -o -E -- '( |^)-g( |$)') ]; then # Release build, delete docs/ and tests/ - zip -d $obj1 doc/ doc/* - zip -d $obj2 doc/ doc/* + zip -d $obj doc/ doc/* # And pack the library with upx - unzip $obj1 lib/* + unzip $obj lib/* upx --no-progress lib/compat53/* - zip -r "$obj1" lib - rm -rf lib - - unzip $obj2 lib/* - upx --no-progress lib/* - zip -r "$obj2" lib + zip -r "$obj" lib rm -rf lib fi diff --git a/meta.lua b/meta.lua index 1b67b20..7362ad1 100644 --- a/meta.lua +++ b/meta.lua @@ -1,4 +1,4 @@ -local package_versions = { +local compat_versions = { ["scm-1"] = true, ["0.12-1"] = true } @@ -24,22 +24,41 @@ local debug = { local compilers = {--[["mingw32",]]"mingw64"--[[,"clang32","clang64"]]} local builds = {} -for package_version, _, version, _, name, optimization, rel, flag, _, image in cartesian(package_versions, lua_versions, optimizations, debug, compilers) do - local buildname = "lua-compat-53-".. package_version:gsub("[%W]","-") .. "-" .. version .. "-" .. name .. "-" .. rel .. "-" .. image - builds[buildname] = { - image = "image-luarocks-" .. version.. "-" .. image, +for version, _, name, optimization, rel, flag, _, image in cartesian(lua_versions, optimizations, debug, compilers) do + for package_version,_ in pairs(compat_versions) do + local buildname = "lua-compat-53-" .. version .. "-" .. name .. "-" .. rel .. "-" .. image + builds[buildname] = { + image = "image-luarocks-" .. version.. "-" .. image, + requires = { + {"git", "lua-compat-5.3"}, + {"cicd","image-luarocks-" .. version .. "-" .. image}, + {"cicd","lua" .. version .. "-" .. name .. "-" .. rel .. "-" .. image .. ":lua" .. version .. ".dll"}, + }, + produces = { + ["compat53-" .. package_version .. ".mingw32-x86_64.rock"] = {"luarocks.sh", "compat53", image, version, name, rel}, + }, + env = { + CFLAGS = optimization .. " " .. flag, + packver = package_version, + rockver = version:gsub("(%d)(%d)$","%1.%2"), + version = version + }, + } + end + local buildname2 = "lua-bit32-" .. version .. "-" .. name .. "-" .. rel .. "-" .. image + builds[buildname2] = { + image = "image-luarocks-" .. version .. "-" .. image, + entrypoint="bit32", requires = { {"git", "lua-compat-5.3"}, {"cicd","image-luarocks-" .. version .. "-" .. image}, {"cicd","lua" .. version .. "-" .. name .. "-" .. rel .. "-" .. image .. ":lua" .. version .. ".dll"}, }, produces = { - ["compat53-" .. package_version .. ".mingw32-x86_64.rock"] = {"luarocks.sh", "compat53", image, version, name, rel}, - ["bit32-" .. package_version .. ".mingw32-x86_64.rock"] = {"luarocks.sh", "bit32", image, version, name, rel}, + ["bit32-scm-1.mingw32-x86_64.rock"] = {"luarocks.sh", "bit32", image, version, name, rel}, }, env = { CFLAGS = optimization .. " " .. flag, - packver = package_version, rockver = version:gsub("(%d)(%d)$","%1.%2"), version = version }, -- cgit v1.2.3-55-g6feb