some packages

This commit is contained in:
2026-02-15 14:49:42 +01:00
parent b4564fa5bb
commit a19e668908
23 changed files with 231 additions and 24 deletions

View File

@@ -1 +1 @@
Checks: '*,clang-analyzer-*,-llvmlibc-*,-fuchsia-*,-altera-*,-abseil-*,-android-*,-modernize-use-trailing-return-type,-readability-identifier-length,-*-readability-todo,-*-magic-numbers,-readability-function-cognitive-complexity,-*-easily-swappable-parameters,-*-non-private-member-variables-in-classes,-*-no-recursion,-concurrency-mt-unsafe,-*-runtime-int,-*-non-const-global-variables'
Checks: '*,clang-analyzer-*,-llvmlibc-*,-fuchsia-*,-altera-*,-abseil-*,-android-*,-modernize-use-trailing-return-type,-readability-identifier-length,-*-readability-todo,-*-magic-numbers,-readability-function-cognitive-complexity,-*-easily-swappable-parameters,-*-non-private-member-variables-in-classes,-*-no-recursion,-concurrency-mt-unsafe,-*-runtime-int,-*-non-const-global-variables,-performance-inefficient-string-concatenation'

12
packages/bzip2.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "bzip2")
(version "1.0.8")
(homepage "https://sourceware.org/bzip2/")
(src (tar
(url "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz")
(dir "bzip2-1.0.8")
(blake3 "97af3f520629c65fe41292f77e6ca798fe594d7987bfb2aebe7c6fcdc7ab5ed2")))
(build
(make
(make_flags "CFLAGS=\"-O2 -fPIC\"")
(install_flags "PREFIX=/usr"))))

View File

@@ -2,7 +2,7 @@
(name "emacs")
(version "30.2")
(homepage "https://www.gnu.org/software/emacs/")
(dependencies "libncurses" "libgnutls")
(dependencies libncurses libgnutls)
(src (tar
(url "https://mirror.netcologne.de/gnu/emacs/emacs-30.2.tar.gz")
(dir "emacs-30.2")

11
packages/gettext.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "gettext")
(version "1.0")
(homepage "https://www.gnu.org/software/gettext/")
(src (tar
(url "https://ftp.gnu.org/pub/gnu/gettext/gettext-1.0.tar.gz")
(dir "gettext-1.0")
(blake3 "32f6a70452d4f035215ece179cbe95b4e22d5e6096bc2fe444b895f8c2ab64dd")))
(build
(configure_make
(configure_flags "--disable-dependency-tracking"))))

11
packages/git.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "git")
(version "2.53.0")
(homepage "https://git-scm.com/")
(dependencies zlib gettext xz)
(src (tar
(url "https://www.kernel.org/pub/software/scm/git/git-2.53.0.tar.gz")
(dir "git-2.53.0")
(blake3 "6ae1f287a09019677f704184588883d68a8116807cc14c6a138adea5ca9636e0")))
(build
(configure_make)))

12
packages/libglib.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "glib")
(version "2.86.4")
(homepage "https://www.gtk.org/")
(dependencies meson ninja git libffi pkg-config slang)
(src (tar
(url "https://download.gnome.org/sources/glib/2.86/glib-2.86.4.tar.xz")
(dir "glib-2.86.4")
(blake3 "1f407dc9204b9bd54e74ddf5af6968690ed61465a788a44a54518721e972795b")))
(build
(meson
(configure_flags "--libdir=lib"))))

View File

@@ -2,7 +2,7 @@
(name "libgmp")
(version "6.3.0")
(homepage "https://gmplib.org/")
(dependencies "xz" "m4")
(dependencies xz m4)
(src (tar
(url "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz")
(dir "gmp-6.3.0")

View File

@@ -2,7 +2,7 @@
(name "libgnutls")
(version "3.8.12")
(homepage "https://gnutls.org/")
(dependencies "xz" "pkg-config" "libnettle" "libp11-kit")
(dependencies xz pkg-config libnettle libp11-kit)
(src (tar
(url "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.12.tar.xz")
(dir "gnutls-3.8.12")

View File

@@ -8,4 +8,4 @@
(blake3 "fbec55697a01f99b9cc3f25be55e73ae7091f4c53e5d81a1ea15734c4e5b7238")))
(build
(configure_make
(configure_flags "--disable-widec --without-tests --without-progs --without-manpages"))))
(configure_flags "--disable-widec --without-tests --without-manpages"))))

View File

@@ -2,7 +2,7 @@
(name "libnettle")
(version "3.10")
(homepage "https://www.lysator.liu.se/~nisse/nettle/")
(dependencies "libgmp")
(dependencies libgmp)
(src (tar
(url "https://ftp.gnu.org/gnu/nettle/nettle-3.10.tar.gz")
(dir "nettle-3.10")

14
packages/libopenssl.shrap Normal file
View File

@@ -0,0 +1,14 @@
(package
(name "libopenssl")
(version "3.6.1")
(homepage "https://openssl-library.org/")
(dependencies perl)
(src (tar
(url "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz")
(dir "openssl-3.6.1")
(blake3 "90c0c093c5f09397f840cce374e4e6f56134727ac0867aaeccb5314aa3196544")))
(build
(perl_configure_make
(configure_flags "linux-x86_64 shared --prefix=/usr --libdir=lib"))
(shell "cp -v /usr/lib/libssl.so.3 /lib/x86_64-linux-gnu/libssl.so.3 || true")
(shell "cp -v /usr/lib/libcrypto.so.3 /lib/x86_64-linux-gnu/libcrypto.so.3 || true")))

View File

@@ -2,7 +2,7 @@
(name "libp11-kit")
(version "0.26.2")
(homepage "https://p11-glue.github.io/p11-glue/p11-kit.html")
(dependencies "xz" "libffi")
(dependencies xz libffi)
(src (tar
(url "https://github.com/p11-glue/p11-kit/releases/download/0.26.2/p11-kit-0.26.2.tar.xz")
(dir "p11-kit-0.26.2")

11
packages/mc.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "mc")
(version "4.8.33")
(homepage "https://midnight-commander.org/")
(dependencies xz pkg-config libglib slang)
(src (tar
(url "https://ftp.osuosl.org/pub/midnightcommander/mc-4.8.33.tar.xz")
(dir "mc-4.8.33")
(blake3 "cad9c1587f2976b9e42016191a72c4f23a07222c96ec7a9454a1a66ce639ac63")))
(build
(configure_make)))

11
packages/meson.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "meson")
(version "1.10.1")
(homepage "https://mesonbuild.com/")
(dependencies python)
(src (tar
(url "https://github.com/mesonbuild/meson/releases/download/1.10.1/meson-1.10.1.tar.gz")
(dir "meson-1.10.1")
(blake3 "7a2bd021b804d21b1d81f156490568da1fb1e35e8c9f2fc909a8b46f1f76e2e2")))
(build
(shell "python setup.py install")))

12
packages/ninja.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "ninja")
(version "1.13.1")
(homepage "https://ninja-build.org/")
(dependencies python)
(src (tar
(url "https://github.com/ninja-build/ninja/archive/refs/tags/v1.13.1.tar.gz")
(dir "ninja-1.13.1")
(blake3 "80192c6c1f2fc686d78b111048b0fced694e5462b5b549006b25bec9ba07a4d0")))
(build
(shell "./configure.py --bootstrap")
(shell "mv ./ninja /usr/bin/")))

11
packages/perl.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "perl")
(version "5.42.0")
(homepage "https://www.perl.org/")
(src (tar
(url "https://www.cpan.org/src/5.0/perl-5.42.0.tar.gz")
(dir "perl-5.42.0")
(blake3 "9d3e6aee850d69fb90c629a9e435da75f67c9ee0461d6e3e2c100e64f27fa9a5")))
(build
(perl_configure_make
(configure_flags "-des"))))

View File

@@ -1,11 +1,11 @@
(package
(name "pkg-config")
(version "0.29")
(homepage "www.freedesktop.org/wiki/Software/pkg-config/")
(version "2.5.1")
(homepage "https://github.com/pkgconf/pkgconf")
(src (tar
(url "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.tar.gz")
(dir "pkg-config-0.29")
(blake3 "16d375630d2b8f41086e9d00cd207ec9e2a74d7bfc57510ea088071840522f06")))
(url "https://distfiles.ariadne.space/pkgconf/pkgconf-2.5.1.tar.xz")
(dir "pkgconf-2.5.1")
(blake3 "c524d73c938e7382d3c12c9cfba16ed32ee092ab21b3e9659a095b5628ea2e88")))
(build
(configure_make
(configure_flags "CFLAGS=-Wno-format-nonliteral --with-internal-glib"))))
(configure_make)
(shell "ln -sf /usr/bin/pkgconf /usr/bin/pkg-config")))

14
packages/python.shrap Normal file
View File

@@ -0,0 +1,14 @@
(package
(name "python3")
(version "3.14.3")
(homepage "https://www.python.org/")
(dependencies zlib libopenssl bzip2)
(src (tar
(url "https://www.python.org/ftp/python/3.14.3/Python-3.14.3.tgz")
(dir "Python-3.14.3")
(blake3 "24c87671a9bf9d1b5543093c1f76b7540bbcfc430217ee1faa34ad3a856d43c3")))
(build
(configure_make)
(shell "ln -sf /usr/bin/python3 /usr/bin/python")
(shell "python -m ensurepip --upgrade")
(shell "python -m pip install --upgrade setuptools wheel truststore")))

11
packages/qemu.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "qemu")
(version "10.2.1")
(homepage "https://www.qemu.org/")
(dependencies xz python ninja pkg-config libglib)
(src (tar
(url "https://download.qemu.org/qemu-10.2.1.tar.xz")
(dir "qemu-10.2.1")
(blake3 "c4ac0f9dbe06a68950ef2d999a411584bc8474b8576123848c593af7bc03fb1d")))
(build
(configure_make)))

11
packages/slang.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "slang")
(version "2.3.3")
(homepage "https://www.jedsoft.org/slang/")
(dependencies bzip2)
(src (tar
(url "https://www.jedsoft.org/releases/slang/slang-2.3.3.tar.bz2")
(dir "slang-2.3.3")
(blake3 "4ab1b174e27f6518dac9a3c54d356b4d966c567c2eab3a5bfc6d5561388e2243")))
(build
(configure_make)))

View File

@@ -2,7 +2,7 @@
(name "vim")
(version "9.1.2148")
(homepage "https://www.vim.org/")
(dependencies "libncurses")
(dependencies libncurses)
(src (tar
(url "https://github.com/vim/vim/archive/refs/tags/v9.1.2148.tar.gz")
(dir "vim-9.1.2148")

View File

@@ -27,18 +27,20 @@ void install_package(const std::string &name) {
}
}
Expr src = pkg.get("src").children[0];
std::cout << "\n\n\tInstalling " << pkg.get_one("name").value << " ("
<< pkg.get_one("version").value << ")...\n\n\n";
Expr src = pkg.get_one("src");
std::string src_type = src.children[0].value;
std::string src_url = src.get("url").children[0].value;
std::string src_path = "/tmp/shrap/" + src.get("dir").children[0].value;
std::string src_url = src.get_one("url").value;
std::string src_path = "/tmp/shrap/" + src.get_one("dir").value;
if (src_type == "tar") {
std::string archive_path = "/tmp/shrap/" + Util::basename(src_url);
// TODO: ship ca certificates
Util::shell_command("./curl -k -L -o " + archive_path + " " + src_url);
Util::shell_command("./curl -L -o " + archive_path + " " + src_url);
std::string expected_hash = src.get("blake3").children[0].value;
std::string expected_hash = src.get_one("blake3").value;
std::string hash = Util::hash_file(archive_path);
if (expected_hash != hash) {
@@ -61,7 +63,7 @@ void install_package(const std::string &name) {
if (step_type == "configure_make") {
std::string configure_flags;
try {
configure_flags = step.get("configure_flags").children[0].value;
configure_flags = step.get_one("configure_flags").value;
} catch (std::out_of_range &) {
}
@@ -69,6 +71,43 @@ void install_package(const std::string &name) {
src_path);
Util::shell_command("make -j " + jobs, src_path);
Util::shell_command("make install", src_path);
} else if (step_type == "perl_configure_make") {
std::string configure_flags;
try {
configure_flags = step.get_one("configure_flags").value;
} catch (std::out_of_range &) {
}
Util::shell_command("./Configure " + configure_flags, src_path);
Util::shell_command("make -j " + jobs, src_path);
Util::shell_command("make install", src_path);
} else if (step_type == "make") {
std::string make_flags;
try {
make_flags = step.get_one("make_flags").value;
} catch (std::out_of_range &) {
}
std::string install_flags;
try {
install_flags = step.get_one("install_flags").value;
} catch (std::out_of_range &) {
}
Util::shell_command("make " + make_flags + " -j " + jobs, src_path);
Util::shell_command("make install " + install_flags, src_path);
} else if (step_type == "meson") {
std::string configure_flags;
try {
configure_flags = step.get_one("configure_flags").value;
} catch (std::out_of_range &) {
}
Util::shell_command(
"meson setup --prefix=/usr builddir " + configure_flags, src_path);
Util::shell_command("meson compile -C builddir -j" + jobs, src_path);
Util::shell_command("meson install -C builddir", src_path);
} else if (step_type == "shell") {
Util::shell_command(step.children[1].value, src_path);
} else {
throw std::runtime_error("unrecognized step type");
}

View File

@@ -28,6 +28,20 @@ public:
throw std::out_of_range("key not found: " + key);
}
[[nodiscard]] Expr get_one(const std::string &key) const {
if (type != Type::List) {
throw std::runtime_error("get() called on non-list");
}
for (const auto &child : children) {
if (child.type == Type::List && child.children.size() >= 2 &&
child.children[0].type == Type::Atom &&
child.children[0].value == key) {
return child.children[1];
}
}
throw std::out_of_range("key not found: " + key);
}
static Expr parse(std::istream &in) { return parse_expr(in); }
private:
@@ -82,10 +96,23 @@ private:
}
auto c = static_cast<char>(in.get());
if (c == '"') {
if (c == '\\') {
if (!in) {
throw std::runtime_error("unexpected EOF after escape character");
}
auto next = static_cast<char>(in.get());
if (next == '"') {
result += '"'; // handle escaped quote
} else {
result += '\\';
result += next;
}
} else if (c == '"') {
break;
} else {
result += c;
}
result += c;
}
return result;
}