generate cool dependency graph
This commit is contained in:
12
packages/cmake.shrap
Normal file
12
packages/cmake.shrap
Normal file
@@ -0,0 +1,12 @@
|
||||
(package
|
||||
(name "cmake")
|
||||
(version "4.2.3")
|
||||
(homepage "https://cmake.org/")
|
||||
(dependencies libopenssl)
|
||||
(src (tar
|
||||
(url "https://github.com/Kitware/CMake/releases/download/v4.2.3/cmake-4.2.3.tar.gz")
|
||||
(dir "cmake-4.2.3")
|
||||
(blake3 "d4cf435ab124932c313d4c8a125c8a3add3d171587438e8c82773a44b038fd34")))
|
||||
(build
|
||||
(shell "./bootstrap --prefix=/usr --parallel=8")
|
||||
(shell "make install")))
|
||||
12
packages/curl.shrap
Normal file
12
packages/curl.shrap
Normal file
@@ -0,0 +1,12 @@
|
||||
(package
|
||||
(name "curl")
|
||||
(version "8.18.0")
|
||||
(homepage "https://curl.se/")
|
||||
(dependencies libopenssl libpsl)
|
||||
(src (tar
|
||||
(url "https://curl.se/download/curl-8.18.0.tar.gz")
|
||||
(dir "curl-8.18.0")
|
||||
(blake3 "f8ae3cff5077c358793d154d2fd9815272cb7590750309221ea63c953b261653")))
|
||||
(build
|
||||
(configure_make
|
||||
(configure_flags "--with-openssl"))))
|
||||
11
packages/elfutils.shrap
Normal file
11
packages/elfutils.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "elfutils")
|
||||
(version "0.194")
|
||||
(homepage "https://sourceware.org/elfutils/")
|
||||
(dependencies bzip2 zlib pkg-config m4)
|
||||
(src (tar
|
||||
(url "https://sourceware.org/elfutils/ftp/0.194/elfutils-0.194.tar.bz2")
|
||||
(dir "elfutils-0.194")
|
||||
(blake3 "1a01558cb4a36adef77594463bd96e2c1149d9434d280c10eabe6dd5a1cb767b")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/gperf.shrap
Normal file
10
packages/gperf.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "gperf")
|
||||
(version "3.3")
|
||||
(homepage "https://www.gnu.org/software/gperf/")
|
||||
(src (tar
|
||||
(url "https://ftp.gnu.org/pub/gnu/gperf/gperf-3.3.tar.gz")
|
||||
(dir "gperf-3.3")
|
||||
(blake3 "6ad90515e3b8ac191a8ecef4e75fbb260236f8e78078ac099d5eccc175af0782")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/intltool.shrap
Normal file
11
packages/intltool.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "intltool")
|
||||
(version "0.50.2")
|
||||
(homepage "https://freedesktop.org/wiki/Software/intltool/")
|
||||
(dependencies perl-xml-parser)
|
||||
(src (tar
|
||||
(url "https://launchpad.net/intltool/trunk/0.50.2/+download/intltool-0.50.2.tar.gz")
|
||||
(dir "intltool-0.50.2")
|
||||
(blake3 "a27cae85d307ebea401518933f33c66f72dc5a96d724f1c810b74f8c915e4b66")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/libexpat.shrap
Normal file
10
packages/libexpat.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "libexpat")
|
||||
(version "2.7.4")
|
||||
(homepage "https://libexpat.github.io/")
|
||||
(src (tar
|
||||
(url "https://github.com/libexpat/libexpat/releases/download/R_2_7_4/expat-2.7.4.tar.gz")
|
||||
(dir "expat-2.7.4")
|
||||
(blake3 "0fb72ab81c753e20bc000c90cf1b71287d3de9fa48b3063e3a562d50a9697224")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/libfreetype.shrap
Normal file
10
packages/libfreetype.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "libfreetype")
|
||||
(version "2.14.1")
|
||||
(homepage "https://freetype.org/")
|
||||
(src (tar
|
||||
(url "https://download.savannah.gnu.org/releases/freetype/freetype-2.14.1.tar.gz")
|
||||
(dir "freetype-2.14.1")
|
||||
(blake3 "c54a9d7dcacd02ffb5d2f2e18f51d2256a563a96e6f46fc05ec1f4af04f17b40")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/libicu.shrap
Normal file
10
packages/libicu.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "libicu")
|
||||
(version "78.1")
|
||||
(homepage "https://icu.unicode.org/")
|
||||
(src (tar
|
||||
(url "https://github.com/unicode-org/icu/releases/download/release-78.1/icu4c-78.1-sources.tgz")
|
||||
(dir "icu/source")
|
||||
(blake3 "31fa3f3a5db60f6deab67abea7b80957cfa1809b83b61d01ecc093867c7d101a")))
|
||||
(build
|
||||
(configure_make)))
|
||||
13
packages/libjpeg.shrap
Normal file
13
packages/libjpeg.shrap
Normal file
@@ -0,0 +1,13 @@
|
||||
(package
|
||||
(name "libjpeg")
|
||||
(version "3.1.3")
|
||||
(homepage "https://libjpeg-turbo.org/")
|
||||
(dependencies cmake ninja nasm)
|
||||
(src (tar
|
||||
(url "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.3/libjpeg-turbo-3.1.3.tar.gz")
|
||||
(dir "libjpeg-turbo-3.1.3")
|
||||
(blake3 "fbcee6fae3d00fd550af865bec1af4d363f5e1feeaf85b60247ca6db1908b10e")))
|
||||
(build
|
||||
(cmake_ninja)
|
||||
(shell "ln -sf /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib/")
|
||||
(shell "ln -sf /usr/lib/x86_64-linux-gnu/pkgconfig/libjpeg.pc /usr/lib/pkgconfig/")))
|
||||
10
packages/liboniguruma.shrap
Normal file
10
packages/liboniguruma.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "liboniguruma")
|
||||
(version "6.9.10")
|
||||
(homepage "https://github.com/kkos/oniguruma")
|
||||
(src (tar
|
||||
(url "https://github.com/kkos/oniguruma/releases/download/v6.9.10/onig-6.9.10.tar.gz")
|
||||
(dir "onig-6.9.10")
|
||||
(blake3 "dac1a1022daf2826c5e062495923f7e920424b4c304f0eb5b6501fa48301f0d4")))
|
||||
(build
|
||||
(configure_make)))
|
||||
@@ -2,11 +2,10 @@
|
||||
(name "libp11-kit")
|
||||
(version "0.26.2")
|
||||
(homepage "https://p11-glue.github.io/p11-glue/p11-kit.html")
|
||||
(dependencies xz libffi)
|
||||
(dependencies xz libffi pkg-config libtasn1)
|
||||
(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")
|
||||
(blake3 "93de717427982d3904905b0ea2997345c06dd35456c281ef3aa7bae2fd9242ed")))
|
||||
(build
|
||||
(configure_make
|
||||
(configure_flags "--without-libtasn1"))))
|
||||
(configure_make)))
|
||||
|
||||
11
packages/libpng.shrap
Normal file
11
packages/libpng.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "libpng")
|
||||
(version "1.6.55")
|
||||
(homepage "https://www.libpng.org/pub/png/libpng.html")
|
||||
(dependencies zlib)
|
||||
(src (tar
|
||||
(url "https://download.sourceforge.net/libpng/libpng-1.6.55.tar.gz")
|
||||
(dir "libpng-1.6.55")
|
||||
(blake3 "e7def717135b4cd49360e5331939586b8eeecb46d156c24b1e524348e438e816")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/libpsl.shrap
Normal file
11
packages/libpsl.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "libpsl")
|
||||
(version "0.21.5")
|
||||
(homepage "https://github.com/rockdaboot/libpsl")
|
||||
(dependencies python)
|
||||
(src (tar
|
||||
(url "https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz")
|
||||
(dir "libpsl-0.21.5")
|
||||
(blake3 "75520a5e4ef205ad5fcb236075182c9e7aeb4f3122ebdb32854a14f49dc52676")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/libtasn1.shrap
Normal file
10
packages/libtasn1.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "libtasn1")
|
||||
(version "4.21.0")
|
||||
(homepage "https://www.gnu.org/software/libtasn1/")
|
||||
(src (tar
|
||||
(url "https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.21.0.tar.gz")
|
||||
(dir "libtasn1-4.21.0")
|
||||
(blake3 "b156973b5629fe15050b4eaee334e50deddfaa6f907645be1c3d58f3ce93bf53")))
|
||||
(build
|
||||
(configure_make)))
|
||||
10
packages/libtiff.shrap
Normal file
10
packages/libtiff.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "libtiff")
|
||||
(version "4.7.1")
|
||||
(homepage "https://libtiff.gitlab.io/libtiff/")
|
||||
(src (tar
|
||||
(url "http://download.osgeo.org/libtiff/tiff-4.7.1.tar.gz")
|
||||
(dir "tiff-4.7.1")
|
||||
(blake3 "5536f49e2879c96a1eaa69abe87fe3dfcb34f4c27f903edc34f9645b4d0c6432")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/libtool.shrap
Normal file
11
packages/libtool.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "libtool")
|
||||
(version "2.5.4")
|
||||
(homepage "https://www.gnu.org/software/libtool/")
|
||||
(dependencies m4)
|
||||
(src (tar
|
||||
(url "https://mirror.easyname.at/gnu/libtool/libtool-2.5.4.tar.gz")
|
||||
(dir "libtool-2.5.4")
|
||||
(blake3 "81545a672c9c67a6bd1fbb583cab60cbb04ef9d18389a2fc20a1c211c75ba5a7")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/libwebp.shrap
Normal file
11
packages/libwebp.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "libwebp")
|
||||
(version "1.6.0")
|
||||
(homepage "https://libwebp.com/")
|
||||
(dependencies libjpeg libtiff)
|
||||
(src (tar
|
||||
(url "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.6.0.tar.gz")
|
||||
(dir "libwebp-1.6.0")
|
||||
(blake3 "561ab69419b391c5dbba6b448f610d9a6bdb6a631d7067518ceba48109e23fc9")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/libxml2.shrap
Normal file
11
packages/libxml2.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "libxml2")
|
||||
(version "2.15.1")
|
||||
(homepage "https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home")
|
||||
(dependencies xz)
|
||||
(src (tar
|
||||
(url "https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.tar.xz")
|
||||
(dir "libxml2-2.15.1")
|
||||
(blake3 "f4041b4e375a362b0ca2c829b2b8a1ff6ffb3b2aa972f86d4f6b7b5a11db7738")))
|
||||
(build
|
||||
(configure_make)))
|
||||
12
packages/llvm.shrap
Normal file
12
packages/llvm.shrap
Normal file
@@ -0,0 +1,12 @@
|
||||
(package
|
||||
(name "llvm")
|
||||
(version "21.1.8")
|
||||
(homepage "https://llvm.org/")
|
||||
(dependencies xz cmake python ninja)
|
||||
(src (tar
|
||||
(url "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-21.1.8.tar.gz")
|
||||
(dir "llvm-project-llvmorg-21.1.8/llvm")
|
||||
(blake3 "1f31353d644097c18a13ffc0a5d5ec5ba8d5926c836e27101cd749beeff246a9")))
|
||||
(build
|
||||
(cmake_ninja
|
||||
(configure_flags "-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=\"X86\" -DLLVM_ENABLE_PROJECTS=\"clang;lld;lldb\""))))
|
||||
10
packages/nasm.shrap
Normal file
10
packages/nasm.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "nasm")
|
||||
(version "3.01rc9")
|
||||
(homepage "https://www.nasm.us/")
|
||||
(src (tar
|
||||
(url "https://www.nasm.us/pub/nasm/releasebuilds/3.01rc9/nasm-3.01rc9.tar.gz")
|
||||
(dir "nasm-3.01rc9")
|
||||
(blake3 "a56adcd15d2f2c67aff016f5051a08133c24cfd053d8c5073c1ad42d4859ff14")))
|
||||
(build
|
||||
(configure_make)))
|
||||
12
packages/perl-xml-parser.shrap
Normal file
12
packages/perl-xml-parser.shrap
Normal file
@@ -0,0 +1,12 @@
|
||||
(package
|
||||
(name "perl-xml-parser")
|
||||
(version "2.47")
|
||||
(homepage "https://metacpan.org/pod/XML::Parser")
|
||||
(dependencies perl libexpat)
|
||||
(src (tar
|
||||
(url "https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.47.tar.gz")
|
||||
(dir "XML-Parser-2.47")
|
||||
(blake3 "933aa44de3efe104be847a2acb5bdf4ff85241ba866a4edb613fb7ec6d573a16")))
|
||||
(build
|
||||
(shell "perl Makefile.PL")
|
||||
(make)))
|
||||
12
packages/php.shrap
Normal file
12
packages/php.shrap
Normal file
@@ -0,0 +1,12 @@
|
||||
(package
|
||||
(name "php")
|
||||
(version "8.5.3")
|
||||
(homepage "https://www.php.net/")
|
||||
(dependencies pkg-config libxml2 sqlite3 openssl zlib bzip2 curl libpng libwebp libfreetype libicu liboniguruma)
|
||||
(src (tar
|
||||
(url "https://www.php.net/distributions/php-8.5.3.tar.gz")
|
||||
(dir "php-8.5.3")
|
||||
(blake3 "717d92bb41ce7c62c579469dfd5fec79f99ea0aeeeedfb813a749986b075cfdf")))
|
||||
(build
|
||||
(configure_make
|
||||
(configure_flags "--with-curl --with-zlib --with-openssl --with-bz2 --enable-xml --enable-mbstring --enable-intl --enable-gd --enable-exif --with-gettext --with-webp --with-jpeg --with-mysqli --with-freetype"))))
|
||||
@@ -2,11 +2,10 @@
|
||||
(name "postgresql")
|
||||
(version "18.2")
|
||||
(homepage "https://www.postgresql.org/")
|
||||
(dependencies pkg-config bison flex perl libreadline zlib)
|
||||
(dependencies pkg-config bison flex perl libreadline zlib libicu)
|
||||
(src (tar
|
||||
(url "https://ftp.postgresql.org/pub/source/v18.2/postgresql-18.2.tar.gz")
|
||||
(dir "postgresql-18.2")
|
||||
(blake3 "ae352f4fecabf9ada3fe22e46f952507d6970864b6f9494d7a7e3b65bd009463")))
|
||||
(build
|
||||
(configure_make
|
||||
(configure_flags "--without-icu"))))
|
||||
(configure_make)))
|
||||
|
||||
10
packages/sqlite3.shrap
Normal file
10
packages/sqlite3.shrap
Normal file
@@ -0,0 +1,10 @@
|
||||
(package
|
||||
(name "sqlite3")
|
||||
(version "3.51.2")
|
||||
(homepage "https://sqlite.org/")
|
||||
(src (tar
|
||||
(url "https://sqlite.org/2026/sqlite-autoconf-3510200.tar.gz")
|
||||
(dir "sqlite-autoconf-3510200")
|
||||
(blake3 "7ba8d2c972fb11430e8ce3ca2b2b0c3d583be6da5c8faf7cba50a12eb699601e")))
|
||||
(build
|
||||
(configure_make)))
|
||||
11
packages/wget.shrap
Normal file
11
packages/wget.shrap
Normal file
@@ -0,0 +1,11 @@
|
||||
(package
|
||||
(name "wget")
|
||||
(version "1.25.0")
|
||||
(homepage "https://www.gnu.org/software/wget/")
|
||||
(dependencies pkg-config libgnutls)
|
||||
(src (tar
|
||||
(url "https://ftp.gnu.org/gnu/wget/wget-1.25.0.tar.gz")
|
||||
(dir "wget-1.25.0")
|
||||
(blake3 "be2581f92173acf6d7e74f0c167b5c59da21b1f44a468b4608dd243a10c0857e")))
|
||||
(build
|
||||
(configure_make)))
|
||||
82
src/main.cc
82
src/main.cc
@@ -82,17 +82,28 @@ void install_package(const std::string &name) {
|
||||
|
||||
if (src_type == "tar") {
|
||||
std::string archive_path = "/tmp/shrap/" + Util::basename(src_url);
|
||||
|
||||
Util::shell_command("./curl -L -o " + archive_path + " " + src_url);
|
||||
|
||||
std::string expected_hash = src.get_one("blake3").value;
|
||||
std::string hash = Util::hash_file(archive_path);
|
||||
|
||||
if (expected_hash != hash) {
|
||||
std::cerr << "Checksum check failed.\n";
|
||||
std::cerr << "Expected: " << expected_hash << "\n";
|
||||
std::cerr << "Got: " << hash << "\n";
|
||||
std::exit(1);
|
||||
bool needs_download = true;
|
||||
|
||||
// dont redownload if checksum matches
|
||||
if (std::ifstream(archive_path)) {
|
||||
std::string current_hash = Util::hash_file(archive_path);
|
||||
if (current_hash == expected_hash) {
|
||||
needs_download = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_download) {
|
||||
Util::shell_command("./curl -L -o " + archive_path + " " + src_url);
|
||||
|
||||
std::string hash = Util::hash_file(archive_path);
|
||||
if (expected_hash != hash) {
|
||||
std::cerr << "Checksum check failed.\n";
|
||||
std::cerr << "Expected: " << expected_hash << "\n";
|
||||
std::cerr << "Got: " << hash << "\n";
|
||||
std::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Util::shell_command("tar xf " + archive_path + " -C /tmp/shrap/");
|
||||
@@ -140,6 +151,19 @@ void install_package(const std::string &name) {
|
||||
|
||||
Util::shell_command("make " + make_flags + " -j " + jobs, src_path);
|
||||
Util::shell_command("make install " + install_flags, src_path);
|
||||
} else if (step_type == "cmake_ninja") {
|
||||
std::string configure_flags;
|
||||
try {
|
||||
configure_flags = step.get_one("configure_flags").value;
|
||||
} catch (std::out_of_range &) {
|
||||
}
|
||||
|
||||
Util::shell_command("mkdir -p build", src_path);
|
||||
Util::shell_command("cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr " +
|
||||
configure_flags + " ..",
|
||||
src_path + "/build");
|
||||
Util::shell_command("ninja -j" + jobs, src_path + "/build");
|
||||
Util::shell_command("ninja install", src_path + "/build");
|
||||
} else if (step_type == "meson") {
|
||||
std::string configure_flags;
|
||||
try {
|
||||
@@ -159,13 +183,30 @@ void install_package(const std::string &name) {
|
||||
}
|
||||
}
|
||||
|
||||
void generate_graph() {
|
||||
std::ofstream out("/tmp/shrap/graph.dot");
|
||||
|
||||
out << "digraph dependencies {\n";
|
||||
out << " rankdir=LR;\n";
|
||||
|
||||
for (const auto &[pkg_name, pkg] : packages) {
|
||||
out << " \"" << pkg_name << "\";\n";
|
||||
try {
|
||||
for (const auto &dep : pkg.get("dependencies").children) {
|
||||
out << " \"" << pkg_name << "\" -> \"" << dep.value << "\";\n";
|
||||
}
|
||||
} catch (std::out_of_range &) {
|
||||
}
|
||||
}
|
||||
out << "}\n";
|
||||
out.close();
|
||||
|
||||
Util::shell_command("dot -Tpng graph.dot > graph.png", "/tmp/shrap");
|
||||
std::cout << "Graph saved to /tmp/shrap/graph.png\n";
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
auto args = std::span(argv, static_cast<size_t>(argc));
|
||||
|
||||
if (geteuid() != 0) {
|
||||
std::cerr << "This program needs to be ran as root.\n";
|
||||
return 1;
|
||||
}
|
||||
Util::shell_command("mkdir -p /tmp/shrap");
|
||||
|
||||
load_packages();
|
||||
@@ -175,13 +216,16 @@ int main(int argc, char **argv) {
|
||||
std::string arg = args[i];
|
||||
if (arg == "-r") {
|
||||
flag_raw = true;
|
||||
} else if (arg == "-g") {
|
||||
generate_graph();
|
||||
return 0;
|
||||
} else {
|
||||
to_install.push_back(arg);
|
||||
}
|
||||
}
|
||||
|
||||
if (to_install.empty()) {
|
||||
std::cerr << "Usage: " << args[0] << " [-r] package1 [package2 ...]\n";
|
||||
std::cerr << "Usage: " << args[0] << " [-g] [-r] package1 [package2 ...]\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -189,9 +233,15 @@ int main(int argc, char **argv) {
|
||||
to_install = resolve_dependencies(to_install);
|
||||
}
|
||||
|
||||
if (geteuid() != 0) {
|
||||
std::cerr << "This program needs to be ran as root.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "\nFollowing packages will be installed:\n";
|
||||
for (const std::string &pkg : to_install) {
|
||||
std::cout << " - " << pkg << std::endl;
|
||||
std::cout << " - " << pkg << " (" << packages[pkg].get_one("version").value
|
||||
<< ")" << std::endl;
|
||||
}
|
||||
std::cin.get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user