From 6ab35e7c87e11902fefcbf72214f7dd24dcbfcd7 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Fri, 25 Oct 2024 21:06:57 -0500 Subject: Inital packaging --- init | 16 ++++++++++++++++ lpeg-1.1.0-2.rockspec | 35 +++++++++++++++++++++++++++++++++++ meta.lua | 47 ++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 lpeg-1.1.0-2.rockspec diff --git a/init b/init index 642d265..df9b983 100755 --- a/init +++ b/init @@ -1 +1,17 @@ #!/bin/sh -ex + +cp lpeg-packaging/*.rockspec lpeg +cd lpeg +luarocks config variables.CFLAGS " $CFLAGS" +luarocks make --pack-binary-rock lpeg-1.1.0-2.rockspec +obj="lpeg-1.1.0-2.$(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 docs/ docs/* tests/ tests/* + # And pack the library with upx + unzip $obj lib/* + upx --no-progress lib/* + zip -r "$obj" lib +fi diff --git a/lpeg-1.1.0-2.rockspec b/lpeg-1.1.0-2.rockspec new file mode 100644 index 0000000..22da586 --- /dev/null +++ b/lpeg-1.1.0-2.rockspec @@ -0,0 +1,35 @@ +package = 'LPeg' +version = '1.1.0-2' +source = { + url = 'https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.1.0.tar.gz', + md5 = '842a538b403b5639510c9b6fffd2c75b', +} +description = { + summary = 'Parsing Expression Grammars For Lua', + detailed = [[ + LPeg is a new pattern-matching library for Lua, based on Parsing + Expression Grammars (PEGs). The nice thing about PEGs is that it + has a formal basis (instead of being an ad-hoc set of features), + allows an efficient and simple implementation, and does most things + we expect from a pattern-matching library (and more, as we can + define entire grammars). + + This version is re-packaged for lua4win with code borrowed from + Gary V. Vaughan + ]], + homepage = 'https://www.inf.puc-rio.br/~roberto/lpeg.html', + maintainer = 'Alexander Pickering ', + license = 'MIT/X11' +} +dependencies = { + 'lua >= 5.1' +} +build = { + type = 'builtin', + modules = { + lpeg = { + 'lpcap.c', 'lpcode.c', 'lpcset.c', 'lpprint.c', 'lptree.c', 'lpvm.c' + }, + re = 're.lua' + } +} diff --git a/meta.lua b/meta.lua index 89419c4..3d870b0 100644 --- a/meta.lua +++ b/meta.lua @@ -1,6 +1,43 @@ -return { - ["lpeg"] = { - 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", + debug = "-Og" } +local debug = { + release = "", + debug = "-g", +} +local compilers = {--[["mingw32",]]"mingw64"--[[,"clang32","clang64"]]} + +local builds = {} +for version, _, name, optimization, rel, flag, _, image in cartesian(lua_versions, optimizations, debug, compilers) do + local buildname = "lpeg-" .. version .. "-" .. name .. "-" .. rel .. "-" .. image + builds[buildname] = { + image = "image-luarocks-" .. version.. "-" .. image, + requires = { + {"git", "lpeg"}, + {"cicd","image-luarocks-" .. version .. "-" .. image}, + {"cicd","lua" .. version .. "-" .. name .. "-" .. rel .. "-" .. image .. ":lua" .. version .. ".dll"}, + }, + produces = { + ["lpeg-1.1.0-2.mingw32-x86_64.rock"] = {"luarocks.sh", "lpeg", 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