mirror of
https://linux.maple.camp/git/ahill/maplelinux-bootstrap.git
synced 2026-02-11 02:03:37 +00:00
Converted mapleconf to Lua
This commit is contained in:
@@ -24,14 +24,13 @@
|
||||
| libarchive | Tim Kientzle | Mostly BSD 2-Clause license | Free |
|
||||
| libcap | Andrew G. Morgan | BSD 3-Clause license *or* GNU General Public License version 2 | Slightly Copyleft |
|
||||
| libelf | Various | GNU General Public License version 2 *and* GNU Lesser General Public License version 3 | Copyleft |
|
||||
| libffi | Anthony Green, Red Hat, Inc and others | MIT License | Free |
|
||||
| LibreSSL | Various | Various | Free |
|
||||
| libyaml | Ingy döt Net and Kirill Simonov | MIT License | Free |
|
||||
| The GNU Portable Library Tool | Free Software Foundation, Inc. | GNU General Public License version 2 | Copyleft |
|
||||
| Limine | Mintsuki and Contributors | BSD 2-Clause license | Free |
|
||||
| Linux | Linus Torvalds and Contributors | Mostly GNU General Public License version 2 with Linux Syscall Note | Copyleft |
|
||||
| Liquid template engine | Tobias Luetke | MIT License | Free |
|
||||
| LLVM | Various | Mostly Apache License version 2.0 with LLVM exceptions | Free |
|
||||
| Lua | Lua.org, PUC-Rio | MIT License | Free |
|
||||
| LuaPosix | luaposix authors | MIT License | Free |
|
||||
| GNU m4 | Free Software Foundation, Inc. | GNU General Public License version 3 | Copyleft |
|
||||
| GNU Make | Free Software Foundation, Inc. | GNU General Public License version 3 | Copyleft |
|
||||
| Maple Linux Bootstrap Scripts | Alexander Hill, Nicholas McDaniel, and Contributors | ISC License | Free |
|
||||
@@ -46,11 +45,11 @@
|
||||
| Perl | Larry Wall and others | GNU General Public License version 1 | Copyleft |
|
||||
| pkgconf | Various | ISC License | Free |
|
||||
| Python | Python Software Foundation, BeOpen, and CWI | Python Software Foundation License Version 2 | Copyleft |
|
||||
| Ruby | Various | Various | Mixed |
|
||||
| GNU sed | Free Software Foundation, Inc. | GNU General Public License version 3 | Copyleft |
|
||||
| GNU tar | Free Software Foundation, Inc. | GNU General Public License version 3 | Copyleft |
|
||||
| tinytoml | Fourier Transformer | MIT License | Free |
|
||||
| xz | Various | Mostly BSD 0-Clause license | Slightly Copyleft |
|
||||
| Zlib | Jean-loup Gailly and Mark Adler | Zlib License | Free |
|
||||
| Zsh | The Zsh development group | Mostly MIT License (Modern Variant) | Slightly Copyleft |
|
||||
|
||||
If any of the information listed above is inaccurate, please send me an e-mail or submit a patch and it will be corrected. ~ahill
|
||||
If any of the information listed above is inaccurate, please send me an e-mail or submit a patch and it will be corrected. ~ahill
|
||||
|
||||
@@ -38,16 +38,15 @@ Definitions:
|
||||
| `libarchive` | Yes | Yes |
|
||||
| `libcap2` | Yes | Yes |
|
||||
| `libelf` | Yes | Yes |
|
||||
| `libffi` | Yes | Yes |
|
||||
| `libmnl` |
|
||||
| `libnftnl` |
|
||||
| `libressl` | Yes | Yes |
|
||||
| `libtool` | Yes | Yes |
|
||||
| `libyaml` | Yes | Yes |
|
||||
| `limine` | Yes | Yes |
|
||||
| `linux` | Yes | Yes |
|
||||
| `liquid` | Yes | Yes |
|
||||
| `llvm` | Yes | Yes |
|
||||
| `lua` | Yes | Yes |
|
||||
| `luaposix` | Yes | Yes |
|
||||
| `m4` | Yes | Yes |
|
||||
| `make` | Yes | Yes |
|
||||
| `mawk` | Yes | Yes |
|
||||
@@ -64,10 +63,10 @@ Definitions:
|
||||
| `pkgconf` | Yes | Yes |
|
||||
| `pipewire` |
|
||||
| `python` | Yes | Yes |
|
||||
| `ruby` | Yes | Yes |
|
||||
| `sed` | Yes | Yes |
|
||||
| `shadow` |
|
||||
| `tar` | Yes | Yes |
|
||||
| `tinytoml` |
|
||||
| `xlibre-xserver` |
|
||||
| `xz` | Yes | Yes |
|
||||
| `zlib` | Yes | Yes |
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<svg height="16" version="1.1" width="1024" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect fill="black" height="100%" width="100%" />
|
||||
<rect fill="blue" height="10" width="509" x="3" y="3" />
|
||||
<rect fill="cornflowerblue" height="10" width="78" x="512" y="3" />
|
||||
<rect fill="white" height="10" width="392" x="590" y="3" />
|
||||
<rect fill="mediumpurple" height="10" width="20" x="982" y="3" />
|
||||
<rect fill="indianred" height="10" width="20" x="1002" y="3" />
|
||||
<rect fill="crimson" height="10" width="0" x="1022" y="3" />
|
||||
<rect fill="blue" height="10" width="519" x="3" y="3" />
|
||||
<rect fill="cornflowerblue" height="10" width="80" x="522" y="3" />
|
||||
<rect fill="white" height="10" width="399" x="602" y="3" />
|
||||
<rect fill="mediumpurple" height="10" width="0" x="1001" y="3" />
|
||||
<rect fill="indianred" height="10" width="20" x="1001" y="3" />
|
||||
<rect fill="crimson" height="10" width="0" x="1021" y="3" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
@@ -232,7 +232,8 @@ for name in $SOURCES; do
|
||||
$TREETAP install $($TREETAP variable $SPEC/$name/$name.spec TT_PACKAGE) $BOOTSTRAP/root
|
||||
done
|
||||
|
||||
# Install Treetap
|
||||
# Install Maple Linux Tools
|
||||
cp $BOOTSTRAP/../scripts/mapleconf $BOOTSTRAP/root/bin/
|
||||
cp $TREETAP $BOOTSTRAP/root/bin/
|
||||
|
||||
# Prepare for chroot build
|
||||
@@ -269,6 +270,8 @@ SOURCES=(
|
||||
limine
|
||||
linux
|
||||
llvm
|
||||
lua
|
||||
luaposix
|
||||
m4
|
||||
make
|
||||
mawk
|
||||
@@ -284,6 +287,7 @@ SOURCES=(
|
||||
python
|
||||
sed
|
||||
tar
|
||||
tinytoml
|
||||
xz
|
||||
zlib
|
||||
zsh
|
||||
|
||||
@@ -1,48 +1,129 @@
|
||||
#!/bin/ruby
|
||||
#!/bin/lua
|
||||
|
||||
# Copyright (c) 2026 Alexander Hill
|
||||
--[[ Copyright (c) 2026 Alexander Hill
|
||||
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE. ]]
|
||||
|
||||
require "liquid"
|
||||
require "psych"
|
||||
local posix = require("posix")
|
||||
local tinytoml = require("tinytoml")
|
||||
|
||||
# TODO: Tie these variables to command line arguments. ~ahill
|
||||
$config = Psych.safe_load_file "/etc/maple.yml"
|
||||
$sysroot = "/"
|
||||
$templates = "/usr/share/mapleconf"
|
||||
-- TODO: Tie these variables to command line arguments. ~ahill
|
||||
local config = tinytoml.parse("/etc/maple.toml")
|
||||
local sysroot = "/"
|
||||
local templates = "/usr/share/mapleconf"
|
||||
|
||||
def render_directory(stack)
|
||||
path = stack.empty? ? "/" : "/#{stack.join "/"}/"
|
||||
local function render_template(source, target)
|
||||
-- Symbol Reference:
|
||||
-- {"literal", string} - Writes `string` to the target
|
||||
-- {"value", name} - Writes `config[name]` to the target
|
||||
local raw = source:read("*all")
|
||||
local result = ""
|
||||
local template = {}
|
||||
|
||||
Dir.foreach $templates + path do |entry|
|
||||
next if entry =~ /^\.+$/
|
||||
fullpath = path + entry
|
||||
-- Tokenize the given template for easy processing later on ~ahill
|
||||
local current = 0
|
||||
local last = 0
|
||||
local literal = true
|
||||
|
||||
if File.directory? $templates + fullpath
|
||||
Dir.mkdir $sysroot + fullpath unless File.exist? $sysroot + fullpath
|
||||
render_directory stack + [entry]
|
||||
while current do
|
||||
current = string.find(raw, "@", current + 1)
|
||||
|
||||
elsif File.file? $templates + fullpath
|
||||
puts fullpath
|
||||
template = Liquid::Template.parse(File.read $templates + fullpath)
|
||||
File.write $sysroot + fullpath, template.render($config)
|
||||
if current then
|
||||
if literal then
|
||||
table.insert(template, { "literal", string.sub(raw, last + 1, current - 1) })
|
||||
literal = false
|
||||
|
||||
else
|
||||
puts "What even is #{fullpath}? If you know, yell at Alex."
|
||||
else
|
||||
if current - last == 1 then
|
||||
table.insert(template, { "literal", "@" })
|
||||
|
||||
else
|
||||
table.insert(template, { "value", string.sub(raw, last + 1, current - 1) })
|
||||
end
|
||||
literal = true
|
||||
end
|
||||
|
||||
else
|
||||
table.insert(template, { "literal", string.sub(raw, last + 1) })
|
||||
end
|
||||
|
||||
last = current
|
||||
end
|
||||
end
|
||||
|
||||
for _, v in ipairs(template) do
|
||||
if v[1] == "literal" then
|
||||
result = result .. v[2]
|
||||
elseif v[1] == "value" then
|
||||
if config[v[2]] then
|
||||
result = result .. config[v[2]]
|
||||
else
|
||||
print("Unable to locate value \"" .. v[2] .. "\"")
|
||||
return
|
||||
end
|
||||
else
|
||||
print("BUG: Symbol type " .. v[1] .. " was not recognized!")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
target:write(result)
|
||||
end
|
||||
|
||||
render_directory []
|
||||
local function render_directory(stack)
|
||||
local path
|
||||
if #stack == 0 then
|
||||
path = "/"
|
||||
else
|
||||
path = "/" .. table.concat(stack, "/") .. "/"
|
||||
end
|
||||
|
||||
local files = posix.dir(templates .. path)
|
||||
for _, entry in ipairs(files) do
|
||||
if not string.match(entry, "^%.+$") then
|
||||
local fullpath = path .. entry
|
||||
|
||||
local stat = posix.stat(templates .. fullpath)
|
||||
if stat.type == "directory" then
|
||||
if not posix.access(sysroot .. fullpath) then
|
||||
posix.mkdir(sysroot .. fullpath)
|
||||
end
|
||||
|
||||
local newstack = {}
|
||||
-- Why does Lua lack the ability to copy tables? ~ahill
|
||||
for _, v in ipairs(stack) do
|
||||
table.insert(newstack, v)
|
||||
end
|
||||
table.insert(newstack, entry)
|
||||
render_directory(newstack)
|
||||
|
||||
elseif stat.type == "regular" then
|
||||
print("Updating " .. fullpath)
|
||||
|
||||
local template = io.open(templates .. fullpath, "r")
|
||||
if template then
|
||||
local target = io.open(sysroot .. fullpath, "w")
|
||||
if target then
|
||||
render_template(template, target)
|
||||
target:close()
|
||||
end
|
||||
template:close()
|
||||
end
|
||||
|
||||
else
|
||||
print("BUG: Directory entry type " .. stat.type .. " not recognized.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
render_directory{}
|
||||
|
||||
@@ -64,10 +64,8 @@ echo "Done!"
|
||||
# NOTE: git requires curl, expat, and gettext to build. ~ahill
|
||||
# NOTE: Python requires bzip2, expat, LibreSSL, ncurses, xz, and zlib to build. ~ahill
|
||||
# NOTE: LLVM requires CMake and Python to build. ~ahill
|
||||
# NOTE: Ruby requires autoconf, libffi, and libyaml to build. ~ahill
|
||||
# NOTE: Liquid requires Ruby to build. ~ahill
|
||||
cd /maple
|
||||
LAYER0="bc byacc bzip2 coreutils diffutils expat findutils grep gzip initramfs-tools libressl m4 make mawk muon musl ncurses patch perl pkgconf sed tar xz zlib zsh"
|
||||
LAYER0="bc byacc bzip2 coreutils diffutils expat findutils grep gzip initramfs-tools libressl lua luaposix m4 make mawk muon musl ncurses patch perl pkgconf sed tar tinytoml xz zlib zsh"
|
||||
LAYER1="autoconf automake curl flex gettext groff libarchive libcap2 libelf libtool nano openrc python"
|
||||
LAYER2="cmake dash fortune-mod git kmod llvm nasm"
|
||||
LAYER3="limine linux"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="f3a3082a23b37c293a4fcd1053147b371f2ff91fa7ea1b2a52e335676bac82dc"
|
||||
SRC_NAME="libffi"
|
||||
SRC_URL="https://github.com/libffi/libffi/releases/download/v3.5.2/libffi-3.5.2.tar.gz"
|
||||
SRC_VERSION="3.5.2"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd libffi-$SRC_VERSION/
|
||||
./configure $TT_AUTOCONF_COMMON --disable-static
|
||||
make -O -j $TT_PROCS
|
||||
make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4"
|
||||
SRC_NAME="libyaml"
|
||||
SRC_URL="https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz"
|
||||
SRC_VERSION="0.2.5"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd yaml-$SRC_VERSION/
|
||||
./configure $TT_AUTOCONF_COMMON --disable-static
|
||||
make -O -j $TT_PROCS
|
||||
make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="f3314240c846140d7be742e405882302f01dbecc51b8dd44d97cdad62d978f03"
|
||||
SRC_NAME="liquid"
|
||||
SRC_URL="https://github.com/Shopify/liquid/archive/refs/tags/v5.11.0.tar.gz"
|
||||
SRC_VERSION="5.11.0"
|
||||
|
||||
SRC_FILENAME="$SRC_NAME-$SRC_VERSION.tar.gz"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd liquid-$SRC_VERSION/
|
||||
gem build liquid.gemspec
|
||||
gem install \
|
||||
--install-dir $TT_INSTALLDIR/lib/ruby/gems/4.0.0 \
|
||||
--local \
|
||||
--ignore-dependencies \
|
||||
--verbose \
|
||||
./liquid-$SRC_VERSION.gem
|
||||
}
|
||||
22
sources/lua/lua.spec
Normal file
22
sources/lua/lua.spec
Normal file
@@ -0,0 +1,22 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="57ccc32bbbd005cab75bcc52444052535af691789dba2b9016d5c50640d68b3d"
|
||||
SRC_NAME="lua"
|
||||
SRC_URL="https://lua.org/ftp/lua-5.5.0.tar.gz"
|
||||
SRC_VERSION="5.5.0"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd lua-$SRC_VERSION/
|
||||
# NOTE: Lua automatically assumes that GCC is installed, which is not the
|
||||
# case here. CC is manually defined as a result. ~ahill
|
||||
# TODO: Tweak luaconf.h to contain the correct directories. ~ahill
|
||||
make -O -j $TT_PROCS CC=$CC
|
||||
make -O -j $TT_PROCS install \
|
||||
INSTALL_BIN=$TT_INSTALLDIR$TT_BINDIR \
|
||||
INSTALL_CMOD=$TT_INSTALLDIR$TT_LIBDIR/lua/5.5 \
|
||||
INSTALL_INC=$TT_INSTALLDIR$TT_INCLUDEDIR \
|
||||
INSTALL_LIB=$TT_INSTALLDIR$TT_LIBDIR \
|
||||
INSTALL_LMOD=$TT_INSTALLDIR$TT_DATADIR/lua/5.5 \
|
||||
INSTALL_MAN=$TT_INSTALLDIR$TT_DATADIR/man/man1 \
|
||||
INSTALL_TOP=$TT_INSTALLDIR$TT_PREFIX
|
||||
}
|
||||
19
sources/luaposix/luaposix.spec
Normal file
19
sources/luaposix/luaposix.spec
Normal file
@@ -0,0 +1,19 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="82cd9a96c41a4a3205c050206f0564ff4456f773a8f9ffc9235ff8f1907ca5e6"
|
||||
SRC_NAME="luaposix"
|
||||
SRC_URL="https://github.com/luaposix/luaposix/archive/refs/tags/v36.3.tar.gz"
|
||||
SRC_VERSION="36.3"
|
||||
|
||||
SRC_FILENAME="luaposix-$SRC_VERSION.tar.gz"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd luaposix-$SRC_VERSION/
|
||||
./build-aux/luke
|
||||
./build-aux/luke install PREFIX=$TT_INSTALLDIR
|
||||
# NOTE: I may be wrong since I've never used it before, but it seems that
|
||||
# "luke" doesn't install the library to the correct path, nor does it
|
||||
# have an option to correct it. ~ahill
|
||||
mkdir -p $TT_INSTALLDIR/usr
|
||||
mv $TT_INSTALLDIR/share $TT_INSTALLDIR/usr/
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="3924be2d05db30f4e35f859bf028be85f4b7dd01714142fd823e4af5de2faf9d"
|
||||
SRC_NAME="ruby"
|
||||
SRC_URL="https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.1.tar.gz"
|
||||
SRC_VERSION="4.0.1"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd ruby-$SRC_VERSION/
|
||||
# NOTE: Yes, Ruby has a configuration script already, but it lacks the
|
||||
# --enable-year2038 option, so we rebuild it. ~ahill
|
||||
./autogen.sh
|
||||
./configure $TT_AUTOCONF_COMMON --enable-year2038 --without-gcc
|
||||
make -O -j $TT_PROCS
|
||||
make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR
|
||||
}
|
||||
14
sources/tinytoml/tinytoml.spec
Normal file
14
sources/tinytoml/tinytoml.spec
Normal file
@@ -0,0 +1,14 @@
|
||||
# Maintainer: Alexander Hill <ahill@breadpudding.dev>
|
||||
SRC_HASH="b806637ce2f79f80cc7a1920a13ba3fe8e6ed51202bcf54f90738d0ce808b201"
|
||||
SRC_NAME="tinytoml"
|
||||
SRC_URL="https://github.com/FourierTransformer/tinytoml/archive/refs/tags/1.0.0.tar.gz"
|
||||
SRC_VERSION="1.0.0"
|
||||
|
||||
SRC_FILENAME="tinytoml-$SRC_VERSION.tar.gz"
|
||||
|
||||
build() {
|
||||
tar xf ../$SRC_FILENAME
|
||||
cd tinytoml-$SRC_VERSION/
|
||||
mkdir -p $TT_INSTALLDIR$TT_DATADIR/lua/5.5
|
||||
cp tinytoml.lua $TT_INSTALLDIR$TT_DATADIR/lua/5.5/
|
||||
}
|
||||
Reference in New Issue
Block a user