opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: d8c1cec97602458a636b0bec85a81d49404ee3da
Parent: 39dcec2763a720e1637bbbc9d4c27602a727f5d4
Author: Michael Forney
Date:   Thu, 11 Jan 2024 14:41:05 -0800

Make man page compression optional

Diffstat:
Mconfig.def.lua | 3+++
Mninja.lua | 16++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/config.def.lua b/config.def.lua @@ -9,6 +9,9 @@ C.builddir = 'out' -- install prefix (needed by some packages) C.prefix = '' +-- compress man pages +C.gzman=true, + --[[ package/file selection diff --git a/ninja.lua b/ninja.lua @@ -486,13 +486,21 @@ end function man(srcs, section) for _, src in ipairs(srcs) do + local out = src..'.gz' if not src:match('^[$/]') then src = '$srcdir/'..src + out = '$outdir/'..out end - local i = src:reverse():find('.', 1, true) - local srcsection = section or src:match('[^.]*$') - local outsrc = src:sub(1, #src - i + 1) .. srcsection - file('share/man/man'..srcsection..'/'..outsrc:match('[^/]*$'), '644', src) + + local base = src:match('[^/]*$') + local ext = base:match('%.([^.]*)$') + if ext then base = base:sub(1, -(#ext + 2)) end + if section then ext = section end + if config.gzman ~= false then + build('gzip', out, src) + src = out + end + file('share/man/man'..ext..'/'..base..'.'..ext, '644', src) end end