From b09d172ff92f187bf965a6efe3d3f4de6c0b6413 Mon Sep 17 00:00:00 2001 From: sisungo Date: Fri, 14 Aug 2026 10:08:12 +0800 Subject: [PATCH 01/15] feat: change llvm triple to unknown- vendor Signed-off-by: sisungo --- lib/arch.py | 12 ++++++------ packages/llvm-project/pkgbuild.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/arch.py b/lib/arch.py index c53c189..f52aa97 100644 --- a/lib/arch.py +++ b/lib/arch.py @@ -4,16 +4,16 @@ from . import packie all: dict[str, dict[str, str]] = { "aarch64-semios-linux": { - "CC": "clang -target aarch64-semios-linux-musl", - "CXX": "clang++ -target aarch64-semios-linux-musl", + "CC": "clang -target aarch64-unknown-linux-musl", + "CXX": "clang++ -target aarch64-unknown-linux-musl", }, "x86_64-semios-linux": { - "CC": "clang -target x86_64-semios-linux-musl", - "CXX": "clang++ -target x86_64-semios-linux-musl", + "CC": "clang -target x86_64-unknown-linux-musl", + "CXX": "clang++ -target x86_64-unknown-linux-musl", }, "riscv64-semios-linux": { - "CC": "clang -target riscv64-semios-linux-musl", - "CXX": "clang++ -target riscv64-semios-linux-musl", + "CC": "clang -target riscv64-unknown-linux-musl", + "CXX": "clang++ -target riscv64-unknown-linux-musl", }, } _target: str = packie.host_arch() diff --git a/packages/llvm-project/pkgbuild.py b/packages/llvm-project/pkgbuild.py index 12e0062..a1e9a77 100644 --- a/packages/llvm-project/pkgbuild.py +++ b/packages/llvm-project/pkgbuild.py @@ -28,7 +28,7 @@ srcdir = None packname = None def llvm_host_triple(): - return arch.get_target().replace("-semios-linux", "-semios-linux-musl") + return arch.get_target().replace("-semios-linux", "-unknown-linux-musl") def cmake(sourcedir, args): builddir = os.getcwd() + f"/../_build_{sourcedir}" @@ -76,7 +76,7 @@ def auto_pack_dev(composer, name, devbins=[], extdirs=["lib/cmake"]): composer.makedir("lib") for i in os.listdir("lib"): prefix = None - if os.path.isdir(i) and f"lib/{i}" in extdirs: + if os.path.isdir(f"lib/{i}") and f"lib/{i}" in extdirs: composer.add_dir(f"lib/{i}", f"lib/{i}") elif ".so" in i: prefix = get_prefix(f"lib{name}") @@ -132,7 +132,7 @@ def build_clang(): "-DCLANG_DEFAULT_CXX_STDLIB=libc++", "-DCLANG_DEFAULT_RTLIB=compiler-rt", "-DLLVM_INCLUDE_TESTS=OFF", - f"-DC_INCLUDE_DIRS=/lib/{arch.get_target()}/include", + f"-DC_INCLUDE_DIRS=/lib/{arch.get_target()}/include:{get_prefix('clang')}/lib/clang/{pkgver_major}/include", ] cmake("clang", import_llvm() + options) -- 2.55.0 From fd5cde82bbaa5555b7094ea322a353ed6d030a92 Mon Sep 17 00:00:00 2001 From: sisungo Date: Fri, 14 Aug 2026 16:55:50 +0800 Subject: [PATCH 02/15] feat: add package rust Signed-off-by: sisungo --- packages/rust/bootstrap.toml.in | 740 ++++++++++++++++++++++++++++++++ packages/rust/pkgbuild.py | 77 ++++ 2 files changed, 817 insertions(+) create mode 100644 packages/rust/bootstrap.toml.in create mode 100644 packages/rust/pkgbuild.py diff --git a/packages/rust/bootstrap.toml.in b/packages/rust/bootstrap.toml.in new file mode 100644 index 0000000..585e6cb --- /dev/null +++ b/packages/rust/bootstrap.toml.in @@ -0,0 +1,740 @@ +# bootstrap.toml.in: Bootstrap Config Template +# +# Replacing Stubs: +# - %RUSTVERSION%: Version of rust +# - %CARGOPATH%: Absolute path of cargo +# - %RUSTCPATH%: Absolute path of rustc +# - %INSTALLPREFIX%: Install prefix + +# ============================================================================= +# Global Settings +# ============================================================================= + +# Use different pre-set defaults than the global defaults. +# +# See `src/bootstrap/defaults` for more information. +# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`). +profile = "dist" + +# ============================================================================= +# Tweaking how LLVM is compiled +# ============================================================================= + +# Don't download Rust CI LLVM, instead, we compile it by our own. +llvm.download-ci-llvm = false + +# Indicates whether the LLVM build is a Release or Debug build +llvm.optimize = true + +# Indicates whether LLVM should be built with ThinLTO. Note that this will +# only succeed if you use clang, lld, llvm-ar, and llvm-ranlib in your C/C++ +# toolchain (see the `cc`, `cxx`, `linker`, `ar`, and `ranlib` options below). +# More info at: https://clang.llvm.org/docs/ThinLTO.html#clang-bootstrap +llvm.thin-lto = true + +# Indicates whether an LLVM Release build should include debug info +llvm.release-debuginfo = false + +# Indicates whether the LLVM assertions are enabled or not +# NOTE: When assertions are disabled, bugs in the integration between rustc and LLVM can lead to +# unsoundness (segfaults, etc.) in the rustc process itself, not just in the generated code. +llvm.assertions = false + +# Indicates whether the LLVM testsuite is enabled in the build or not. Does +# not execute the tests as part of the build as part of x.py build et al, +# just makes it possible to do `ninja check-llvm` in the staged LLVM build +# directory when doing LLVM development as part of Rust development. +llvm.tests = false + +# Indicates whether the LLVM plugin is enabled or not +llvm.plugins = false + +# Whether to build Enzyme as AutoDiff backend. +llvm.enzyme = false + +# Whether to build LLVM with support for it's gpu offload runtime. +llvm.offload = false + +# Absolute path to the directory containing ClangConfig.cmake +llvm.offload-clang-dir = "" + +# When true, link libstdc++ statically into the rustc_llvm. +# This is useful if you don't want to use the dynamic version of that +# library provided by LLVM. +llvm.static-libstdcpp = false + +# Enable LLVM to use zstd for compression. +llvm.libzstd = false + +# Whether to use Ninja to build LLVM. This runs much faster than make. +llvm.ninja = true + +# LLVM targets to build support for. +#llvm.targets = + +# LLVM experimental targets to build support for. +#llvm.experimental-targets = + +# Cap the number of parallel linker invocations when compiling LLVM. +#llvm.link-jobs = + +# Whether to build LLVM as a dynamically linked library (as opposed to statically linked). +# Under the hood, this passes `--shared` to llvm-config. +# NOTE: To avoid performing LTO multiple times, we suggest setting this to `true` when `thin-lto` is enabled. +llvm.link-shared = true + +# When building llvm, this configures what is being appended to the version. +llvm.version-suffix = "-rust-%RUSTVERSION%" + +# Use libc++ when building LLVM instead of libstdc++. This is the default on +# platforms already use libc++ as the default C++ library, but this option +# allows you to use libc++ even on platforms when it's not. You need to ensure +# that your host compiler ships with libc++. +llvm.use-libcxx = true + +# The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. +#llvm.use-linker = (path) + +# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES` +#llvm.allow-old-toolchain = false + +# Whether to include the Polly optimizer. +llvm.polly = false + +# Whether to build the clang compiler. +llvm.clang = false + +# Whether to enable llvm compilation warnings. +llvm.enable-warnings = false + +# Custom CMake defines to set when building LLVM. +llvm.build-config = {"LLVM_ENABLE_LIBCXX" = "ON"} + +# ============================================================================= +# General build configuration options +# ============================================================================= + +# The default stage to use for the `check` subcommand +#build.check-stage = 0 + +# The default stage to use for the `doc` subcommand +#build.doc-stage = 0 + +# The default stage to use for the `build` subcommand +#build.build-stage = 1 + +# The default stage to use for the `test` subcommand +#build.test-stage = 1 + +# The default stage to use for the `dist` subcommand +#build.dist-stage = 2 + +# The default stage to use for the `install` subcommand +#build.install-stage = 2 + +# The default stage to use for the `bench` subcommand +#build.bench-stage = 2 + +# A descriptive string to be appended to version output (e.g., `rustc --version`), +# which is also used in places like debuginfo `DW_AT_producer`. This may be useful for +# supplementary build information, like distro-specific package versions. +# +# IMPORTANT: Changing this value changes crate IDs and symbol name mangling, making +# compiled artifacts incompatible. PGO profiles cannot be reused across different +# descriptions, and incremental compilation caches are invalidated. Keep this value +# consistent when reusing build artifacts. +# +# The Rust compiler will differentiate between versions of itself, including +# based on this string, which means that if you wish to be compatible with +# upstream Rust you need to set this to "". However, note that if you set this to "" but +# are not actually compatible -- for example if you've backported patches that change +# behavior -- this may lead to miscompilations or other bugs. +#build.description = "" + +# Build triple for the pre-compiled snapshot compiler. If `rustc` is set, this must match its host +# triple (see `rustc --version --verbose`; cross-compiling the rust build system itself is NOT +# supported). If `rustc` is unset, this must be a platform with pre-compiled host tools +# (https://doc.rust-lang.org/nightly/rustc/platform-support.html). The current platform must be +# able to run binaries of this build triple. +# +# If `rustc` is present in path, this defaults to the host it was compiled for. +# Otherwise, `x.py` will try to infer it from the output of `uname`. +# If `uname` is not found in PATH, we assume this is `x86_64-pc-windows-msvc`. +# This may be changed in the future. +#build.build = "x86_64-unknown-linux-gnu" (as an example) + +# Which triples to produce a compiler toolchain for. Each of these triples will be bootstrapped from +# the build triple themselves. In other words, this is the list of triples for which to build a +# compiler that can RUN on that triple. +# +# Defaults to just the `build` triple. +#build.host = [build.build] (list of triples) + +# Which triples to build libraries (core/alloc/std/test/proc_macro) for. Each of these triples will +# be bootstrapped from the build triple themselves. In other words, this is the list of triples for +# which to build a library that can CROSS-COMPILE to that triple. +# +# Defaults to `host`. If you set this explicitly, you likely want to add all +# host triples to this list as well in order for those host toolchains to be +# able to compile programs for their native target. +#build.target = build.host (list of triples) + +# Use this directory to store build artifacts. Paths are relative to the current directory, not to +# the root of the repository. +#build.build-dir = "build" + +# Instead of downloading the src/stage0 version of Cargo specified, use +# this Cargo binary instead to build all Rust code +# If you set this, you likely want to set `rustc` as well. +build.cargo = "%CARGOPATH%" + +# Instead of downloading the src/stage0 version of the compiler +# specified, use this rustc binary instead as the stage0 snapshot compiler. +# If you set this, you likely want to set `cargo` as well. +build.rustc = "%RUSTCPATH%" + +# Use this rustdoc binary as the stage0 snapshot rustdoc. +# If unspecified, then the binary "rustdoc" (with platform-specific extension, e.g. ".exe") +# in the same directory as "rustc" will be used. +#build.rustdoc = "/path/to/rustdoc" + +# Instead of downloading the src/stage0 version of rustfmt specified, +# use this rustfmt binary instead as the stage0 snapshot rustfmt. +#build.rustfmt = "/path/to/rustfmt" + +# Instead of downloading the src/stage0 version of cargo-clippy specified, +# use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy. +# +# Note that this option should be used with the same toolchain as the `rustc` option above. +# Otherwise, clippy is likely to fail due to a toolchain conflict. +#build.cargo-clippy = "/path/to/cargo-clippy" + +# Whether to build documentation by default. If false, rustdoc and +# friends will still be compiled but they will not be used to generate any +# documentation. +# +# You can still build documentation when this is disabled by explicitly passing paths, +# e.g. `x doc library`. +build.docs = true + +# Flag to specify whether CSS, JavaScript, and HTML are minified when +# docs are generated. JSON is always minified, because it's enormous, +# and generated in already-minified form from the beginning. +build.docs-minification = true + +# Flag to specify whether private items should be included in the library docs. +build.library-docs-private-items = false + +# Indicate whether to build compiler documentation by default. +# You can still build documentation when this is disabled by explicitly passing a path: `x doc compiler`. +build.compiler-docs = false + +# Indicate whether git submodules are managed and updated automatically. +build.submodules = false + +# The path to (or name of) the GDB executable to use. This is only used for +# executing the debuginfo test suite. +#build.gdb = + +# The path to (or name of) the LLDB executable to use. This is only used for +# executing the debuginfo test suite. +#build.lldb = + +# The node.js executable to use. Note that this is only used for the emscripten +# target when running tests, otherwise this can be omitted. +#build.nodejs = + +# The yarn executable to use. Note that this is used for rustdoc-gui tests and +# tidy js extra-checks, otherwise this can be omitted. +# +# Under Windows this should be `yarn.cmd` or path to it (verified on nodejs v18.06), or +# error will be emitted. +#build.yarn = + +# Python interpreter to use for various tasks throughout the build, notably +# rustdoc tests, and some dist bits and pieces. +# +# Defaults to the Python interpreter used to execute x.py. +#build.python = + +# The path to the REUSE executable to use. Note that REUSE is not required in +# most cases, as our tooling relies on a cached (and shrunk) copy of the +# REUSE output present in the git repository and in our source tarballs. +# +# REUSE is only needed if your changes caused the overall licensing of the +# repository to change, and the cached copy has to be regenerated. +# +# Defaults to the "reuse" command in the system path. +#build.reuse = + +# Force Cargo to check that Cargo.lock describes the precise dependency +# set that all the Cargo.toml files create, instead of updating it. +build.locked-deps = false + +# Indicate whether the vendored sources are used for Rust dependencies or not. +# +# Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you +# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code. +#build.vendor = + +# If you build the compiler more than twice (stage3+) or the standard library more than once +# (stage 2+), the third compiler and second library will get uplifted from stage2 and stage1, +# respectively. If you would like to disable this uplifting, and rather perform a full bootstrap, +# then you can set this option to true. +# +# This is only useful for verifying that rustc generates reproducible builds. +build.full-bootstrap = false + +# Set the bootstrap/download cache path. It is useful when building rust +# repeatedly in a CI environment. +#build.bootstrap-cache-path = /path/to/shared/cache + +# Enable a build of the extended Rust tool set which is not only the compiler +# but also tools such as Cargo. This will also produce "combined installers" +# which are used to install Rust and Cargo together. +# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies +# which tools should be built if `extended = true`. +# +# This is disabled by default. +build.extended = false + +# Set of tools to be included in the installation. +# +# If `extended = false`, the only one of these built by default is rustdoc. +# +# If `extended = true`, they are all included. +# +# If any enabled tool fails to build, the installation fails. +#build.tools = + +# Specify build configuration specific for some tool, such as enabled features. +# This option has no effect on which tools are enabled: refer to the `tools` option for that. +# +# For example, to build Miri with tracing support, use `tool.miri.features = ["tracing"]` +# +# The default value for the `features` array is `[]`. However, please note that other flags in +# `bootstrap.toml` might influence the features enabled for some tools. Also, enabling features +# in tools which are not part of the internal "extra-features" preset might not always work. +#build.tool.TOOL_NAME.features = [FEATURE1, FEATURE2] + +# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation +#build.verbose = + +# Build the sanitizer runtimes +build.sanitizers = false + +# Build the profiler runtime (required when compiling with options that depend +# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`). +build.profiler = false + +# Use the optimized LLVM C intrinsics for `compiler_builtins`, rather than Rust intrinsics. +# Choosing true requires the LLVM submodule to be managed by bootstrap (i.e. not external) +# so that `compiler-rt` sources are available. +# +# Setting this to a path removes the requirement for a C toolchain, but requires setting the +# path to an existing library containing the builtins library from LLVM's compiler-rt. +# +# Setting this to `false` generates slower code, but removes the requirement for a C toolchain in +# order to run `x check`. +build.optimized-compiler-builtins = true + +# Indicates whether the native libraries linked into Cargo will be statically +# linked or not. +build.cargo-native-static = false + +# Number of parallel jobs to be used for building and testing. If set to `0` or +# omitted, it will be automatically determined. This is the `-j`/`--jobs` flag +# passed to cargo invocations. +#build.jobs = + +# Default value for the `--extra-checks` flag of tidy. +# +# See `./x test tidy --help` for details. +# +# Note that if any value is manually given to bootstrap such as +# `./x test tidy --extra-checks=js`, this value is ignored. +# Use `--extra-checks=''` to temporarily disable all extra checks. +# +# Automatically enabled in the "tools" profile. +# Set to the empty string to force disable (recommended for hdd systems). +#build.tidy-extra-checks = "" + +# Indicates whether ccache is used when building certain artifacts (e.g. LLVM). +# Set to `true` to use the first `ccache` in PATH, or set an absolute path to use +# a specific version. +build.ccache = false + +# List of paths to exclude from the build and test processes. +# For example, exclude = ["tests/ui", "src/tools/tidy"]. +#build.exclude = [] + +# ============================================================================= +# General install configuration options +# ============================================================================= + +# Where to install the generated toolchain. Must be an absolute path. +install.prefix = "%INSTALLPREFIX%" + +# Where to install system configuration files. +# If this is a relative path, it will get installed in `prefix` above +install.sysconfdir = "/var/config" + +# Where to install documentation in `prefix` above +install.docdir = "share/doc/rust" + +# Where to install binaries in `prefix` above +install.bindir = "bin" + +# Where to install libraries in `prefix` above +install.libdir = "lib" + +# Where to install man pages in `prefix` above +install.mandir = "share/man" + +# Where to install data in `prefix` above +install.datadir = "share" + +# ============================================================================= +# Options for compiling Rust code itself +# ============================================================================= + +# Whether or not to optimize when compiling the compiler and standard library, +# and what level of optimization to use. +# WARNING: Building with optimize = false is NOT SUPPORTED. Due to bootstrapping, +# building without optimizations takes much longer than optimizing. Further, some platforms +# fail to build without this optimization (c.f. #65352). +# The valid options are: +# true - Enable optimizations (same as 3). +# false - Disable optimizations. +# 0 - Disable optimizations. +# 1 - Basic optimizations. +# 2 - Some optimizations. +# 3 - All optimizations. +# "s" - Optimize for binary size. +# "z" - Optimize for binary size, but also turn off loop vectorization. +#rust.optimize = true + +# Indicates that the build should be configured for debugging Rust. A +# `debug`-enabled compiler and standard library will be somewhat +# slower (due to e.g. checking of debug assertions) but should remain +# usable. +# +# Note: If this value is set to `true`, it will affect a number of +# configuration options below as well, if they have been left +# unconfigured in this file. +# +# Note: changes to the `debug` setting do *not* affect `optimize` +# above. In theory, a "maximally debuggable" environment would +# set `optimize` to `false` above to assist the introspection +# facilities of debuggers like lldb and gdb. To recreate such an +# environment, explicitly set `optimize` to `false` and `debug` +# to `true`. In practice, everyone leaves `optimize` set to +# `true`, because an unoptimized rustc with debugging +# enabled becomes *unusably slow* (e.g. rust-lang/rust#24840 +# reported a 25x slowdown) and bootstrapping the supposed +# "maximally debuggable" environment (notably libstd) takes +# hours to build. +# +rust.debug = false + +# Whether to download the stage 1 and 2 compilers from CI. This is useful if you +# are working on tools, doc-comments, or library (you will be able to build the +# standard library without needing to build the compiler). +# +# Set this to "if-unchanged" if you are working on `src/tools`, `tests` or +# `library` (on CI, `library` changes triggers in-tree compiler build) to speed +# up the build process if you don't need to build a compiler from the latest +# commit from `master`. +# +# Set this to `true` to always download or `false` to always use the in-tree +# compiler. +rust.download-rustc = false + +# Number of codegen units to use for each compiler invocation. A value of 0 +# means "the number of cores on this machine", and 1+ is passed through to the +# compiler. +# +# Uses the rustc defaults: https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units +rust.codegen-units = 1 + +# Sets the number of codegen units to build the standard library with, +# regardless of what the codegen-unit setting for the rest of the compiler is. +# NOTE: building with anything other than 1 is known to occasionally have bugs. +rust.codegen-units-std = 1 + +# Whether or not debug assertions are enabled for the compiler and standard library. +# These can help find bugs at the cost of a small runtime slowdown. +# +# Defaults to rust.debug value +rust.debug-assertions = false + +# Whether or not debug assertions are enabled for the standard library. +# Overrides the `debug-assertions` option, if defined. +# +# Defaults to rust.debug-assertions value +rust.debug-assertions-std = false + +# Whether or not debug assertions are enabled for the tools built by bootstrap. +# Overrides the `debug-assertions` option, if defined. +# +# Defaults to rust.debug-assertions value +rust.debug-assertions-tools = false + +# Whether or not to leave debug! and trace! calls in the rust binary. +# +# Defaults to rust.debug-assertions value +# +# If you see a message from `tracing` saying "some trace filter directives would enable traces that +# are disabled statically" because `max_level_info` is enabled, set this value to `true`. +rust.debug-logging = false + +# Whether or not to build rustc, tools and the libraries with randomized type layout +rust.randomize-layout = false + +# Whether or not overflow checks are enabled for the compiler and standard +# library. +# +# Defaults to rust.debug value +rust.overflow-checks = false + +# Whether or not overflow checks are enabled for the standard library. +# Overrides the `overflow-checks` option, if defined. +# +# Defaults to rust.overflow-checks value +rust.overflow-checks-std = false + +# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`. +# See https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo for available options. +# +# Can be overridden for specific subsets of Rust code (rustc, std or tools). +# Debuginfo for tests run with compiletest is not controlled by this option +# and needs to be enabled separately with `debuginfo-level-tests`. +# +# Note that debuginfo-level = 2 generates several gigabytes of debuginfo +# and will slow down the linking process significantly. +rust.debuginfo-level = 0 + +# Debuginfo level for the compiler. +rust.debuginfo-level-rustc = 0 + +# Debuginfo level for the standard library. +rust.debuginfo-level-std = 0 + +# Debuginfo level for the tools. +rust.debuginfo-level-tools = 0 + +# Debuginfo level for the test suites run with compiletest. +# FIXME(#61117): Some tests fail when this option is enabled. +#rust.debuginfo-level-tests = 0 + +# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE) +rust.backtrace = true + +# Whether to always use incremental compilation when building rustc +rust.incremental = false + +# The default linker that will be hard-coded into the generated +# compiler for targets that don't specify a default linker explicitly +# in their target specifications. Note that this is not the linker +# used to link said compiler. It can also be set per-target (via the +# `[target.]` block), which may be useful in a cross-compilation +# setting. +# +# See https://doc.rust-lang.org/rustc/codegen-options/index.html#linker for more information. +#rust.default-linker = + +# The "channel" for the Rust build to produce. The stable/beta channels only +# allow using stable features, whereas the nightly and dev channels allow using +# nightly features. +# +# You can set the channel to "auto-detect" to load the channel name from `src/ci/channel`. +# +# If using tarball sources, default value is "auto-detect", otherwise, it's "dev". +rust.channel = "auto-detect" + +# The root location of the musl installation directory. The library directory +# will also need to contain libunwind.a for an unwinding implementation. Note +# that this option only makes sense for musl targets that produce statically +# linked binaries. +# +# Defaults to /usr on musl hosts. Has no default otherwise. +#rust.musl-root = + +# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix +# platforms to ensure that the compiler is usable by default from the build +# directory (as it links to a number of dynamic libraries). This may not be +# desired in distributions, for example. +rust.rpath = true + +# Additional flags to pass to `rustc`. +# Takes precedence over bootstrap's own flags but not over per target rustflags nor env. vars. like RUSTFLAGS. +# Applies to all stages and targets. +# +#rust.rustflags = [] + +# Indicates whether symbols should be stripped using `-Cstrip=symbols`. +rust.strip = true + +# Forces frame pointers to be used with `-Cforce-frame-pointers`. +# This can be helpful for profiling at a small performance cost. +rust.frame-pointers = false + +# Indicates whether stack protectors should be used +# via the unstable option `-Zstack-protector`. +# +# Valid options are : `none`(default),`basic`,`strong`, or `all`. +# `strong` and `basic` options may be buggy and are not recommended, see rust-lang/rust#114903. +rust.stack-protector = "none" + +# Prints each test name as it is executed, to help debug issues in the test harness itself. +rust.verbose-tests = false + +# Flag indicating whether tests are compiled with optimizations (the -O flag). +rust.optimize-tests = true + +# Flag indicating whether codegen tests will be run or not. If you get an error +# saying that the FileCheck executable is missing, you may want to disable this. +# Also see the target's llvm-filecheck option. +rust.codegen-tests = false + +# Flag indicating whether git info will be retrieved from .git automatically. +# Having the git information can cause a lot of rebuilds during development. +rust.omit-git-hash = false + +# Whether to create a source tarball by default when running `x dist`. +# +# You can still build a source tarball when this is disabled by explicitly passing `x dist rustc-src`. +rust.dist-src = false + +# After building or testing an optional component (e.g. the nomicon or reference), append the +# result (broken, compiling, testing) into this JSON file. +#rust.save-toolstates = (path) + +# This array serves three distinct purposes: +# - Backends in this list will be automatically compiled and included in the sysroot of each +# rustc compiled by bootstrap. +# - The first backend in this list will be configured as the **default codegen backend** by each +# rustc compiled by bootstrap. In other words, if the first backend is e.g. cranelift, then when +# we build a stage 1 rustc, it will by default compile Rust programs using the Cranelift backend. +# This also means that stage 2 rustc would get built by the Cranelift backend. +# - Running `x dist` (without additional arguments, or with `--include-default-paths`) will produce +# a dist component/tarball for the Cranelift backend if it is included in this array. +# +# Note that the LLVM codegen backend is special and will always be built and distributed. +# +# Currently, the only standard options supported here are `"llvm"`, `"cranelift"` and `"gcc"`. +rust.codegen-backends = ["llvm"] + +# Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute, +rust.lld = false + +# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD. +# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH +# will be used. +# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used. +# +# On MSVC, LLD will not be used if we're cross linking. +# +# Explicitly setting the linker for a target will override this option when targeting MSVC. +rust.bootstrap-override-lld = false + +# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the +# sysroot. +rust.llvm-tools = false + +# Indicates whether the `self-contained` llvm-bitcode-linker, will be made available +# in the sysroot. It is required for running nvptx tests. +rust.llvm-bitcode-linker = false + +# Whether to deny warnings in crates. Set to `false` to avoid +# error: warnings are denied by `build.warnings` configuration +rust.deny-warnings = false + +# Print backtrace on internal compiler errors during bootstrap +rust.backtrace-on-ice = false + +# Whether to verify generated LLVM IR +rust.verify-llvm-ir = false + +# Compile the compiler with a non-default ThinLTO import limit. This import +# limit controls the maximum size of functions imported by ThinLTO. Decreasing +# will make code compile faster at the expense of lower runtime performance. +#rust.thin-lto-import-instr-limit = + +# Map debuginfo paths to `/rust/$sha/...`. +# Useful for reproducible builds. Generally only set for releases +rust.remap-debuginfo = true + +# Link the compiler and LLVM against `jemalloc` instead of the default libc allocator. +# This option is only tested on Linux and OSX. It can also be configured per-target in the +# [target.] section. +rust.jemalloc = false + +# Run tests in various test suites with the "nll compare mode" in addition to +# running the tests in normal mode. Largely only used on CI and during local +# development of NLL +rust.test-compare-mode = false + +# Global default for llvm-libunwind for all targets. See the target-specific +# documentation for llvm-libunwind below. Note that the target-specific +# option will override this if set. +rust.llvm-libunwind = 'system' + +# Enable symbol-mangling-version v0. This can be helpful when profiling rustc, +# as generics will be preserved in symbols (rather than erased into opaque T). +# When no setting is given, the new scheme will be used when compiling the +# compiler and its tools and the legacy scheme will be used when compiling the +# standard library. +# If an explicit setting is given, it will be used for all parts of the codebase. +rust.new-symbol-mangling = true + +# Size limit in bytes for move/copy annotations (-Zannotate-moves). Only types +# at or above this size will be annotated. If not specified, uses the default +# limit (65 bytes). +#rust.annotate-moves-size-limit = + +# Select LTO mode that will be used for compiling rustc. By default, thin local LTO +# (LTO within a single crate) is used (like for any Rust crate). You can also select +# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib, or "off" to disable +# LTO entirely. +rust.lto = "thin-local" + +# Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std` +#rust.validate-mir-opts = 3 + +# Configure `std` features used during bootstrap. +# +# Default features will be expanded in the following cases: +# - If `rust.llvm-libunwind` or `target.llvm-libunwind` is enabled: +# - "llvm-libunwind" will be added for in-tree LLVM builds. +# - "system-llvm-libunwind" will be added for system LLVM builds. +# - If `rust.backtrace` is enabled, "backtrace" will be added. +# - If `rust.profiler` or `target.profiler` is enabled, "profiler" will be added. +# - If building for a zkvm target, "compiler-builtins-mem" will be added. +# +# Since libstd also builds libcore and liballoc as dependencies and all their features are mirrored +# as libstd features, this option can also be used to configure features such as optimize_for_size. +#rust.std-features = + +# Set the number of threads for the compiler frontend used during compilation of Rust code (passed to `-Zthreads`). +# The valid options are: +# 0 - Set the number of threads according to the detected number of threads of the host system +# 1 - Use a single thread for compilation of Rust code (the default) +# N - Number of threads used for compilation of Rust code +# +rust.parallel-frontend-threads = 1 + +[target.x86_64-unknown-linux-musl] +llvm-libunwind = "system" +crt-static = false +musl-libdir = "/lib/x86_64-semios-linux" + +[target.aarch64-unknown-linux-musl] +llvm-libunwind = "system" +crt-static = false +musl-libdir = "/lib/aarch64-semios-linux" + +[target.riscv64-unknown-linux-musl] +llvm-libunwind = "system" +crt-static = false +musl-libdir = "/lib/riscv64-semios-linux" diff --git a/packages/rust/pkgbuild.py b/packages/rust/pkgbuild.py new file mode 100644 index 0000000..d51f897 --- /dev/null +++ b/packages/rust/pkgbuild.py @@ -0,0 +1,77 @@ +import os +import shutil +import subprocess + +from lib.make import * +from lib import arch + + +upstream_version = "1.97.1" + +version(upstream_version) +description("A language empowering everyone to build reliable and efficient software") +maintainer("sisungo ") +source_url(f"https://static.rust-lang.org/dist/rustc-{upstream_version}-src.tar.xz") + +builddep("shortcut/cmake") +builddep("shortcut/c++") +builddep("python") +builddep(f"libz-ng-dev @{arch.get_target()}") +builddep(f"linux-dev @{arch.get_target()}") +builddep(f"libunwind-dev @{arch.get_target()}") +builddep("curl") +builddep("grep") +builddep("sed") + + +def setup_musl_root(): + os.makedirs("../musl_root/lib", exist_ok=True) + for i in ["libc.a", "crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o", "libunwind.a"]: + shutil.copy2(f"/lib/{arch.get_target()}/{i}", f"../musl_root/lib/{i}") + +def configure(): + with open("../../bootstrap.toml.in") as file: + content = file.read() + content = content.replace("%RUSTVERSION%", upstream_version) + content = content.replace("%CARGOPATH%", shutil.which("cargo") or "cargo") + content = content.replace("%RUSTCPATH%", shutil.which("rustc") or "rustc") + content = content.replace("%INSTALLPREFIX%", get_prefix("rust")) + content = content.replace("%MUSLROOT%", os.getcwd() + "/../musl_root") + with open("bootstrap.toml", "wt+") as file: + file.write(content) + +def run_build(): + subprocess.run(["python3", "x.py", "build"], check=True) + +def run_install(): + os.environ["DESTDIR"] = os.getcwd() + "/../install_destdir" + subprocess.run(["python3", "x.py", "install"], check=True) + os.chdir(os.environ["DESTDIR"]) + # FIXME: Rust seemed not to process our directory name correctly, it is installed to pkg/rust. + os.chdir("pkg/rust") + + +def build(): + setup_musl_root() + configure() + run_build() + run_install() + +on_build(build) + + +def pack_rust(composer): + composer.makedir("lib") + composer.makedir("bin") + for i in os.listdir("."): + if ".so" in i: + composer.addfile(i, f"lib/{i}") + elif i in ["rustc", "rust-gdb", "rust-gdbgui", "rust-lldb", "rustdoc"]: + composer.addfile(i, f"bin/{i}") + composer.add_dir("rustlib", "lib/rustlib") + +package("rust") +dep("semi-libc @same-arch") +dep("libz @same-arch") +dep("libcxx @same-arch") +on_pack(pack_rust) -- 2.55.0 From 21dedb356890234bfa564da7adadd355837ed56f Mon Sep 17 00:00:00 2001 From: sisungo Date: Fri, 14 Aug 2026 19:11:44 +0800 Subject: [PATCH 03/15] feat: add package cargo Signed-off-by: sisungo --- packages/cargo/pkgbuild.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/cargo/pkgbuild.py diff --git a/packages/cargo/pkgbuild.py b/packages/cargo/pkgbuild.py new file mode 100644 index 0000000..d179971 --- /dev/null +++ b/packages/cargo/pkgbuild.py @@ -0,0 +1,33 @@ +from lib.make import * +from lib import rust + + +version("0.98.0") +description("The Rust package manager") +maintainer("sisungo ") +source_url("https://github.com/rust-lang/cargo/archive/refs/tags/0.98.0.tar.gz") + +builddep("shortcut/c") +builddep("cargo") +builddep("rust") +builddep(f"aws-lc-dev @{arch.get_target()}") +builddep(f"pkgconf @{arch.get_target()}") +builddep(f"libz-ng-dev @{arch.get_target()}") +builddep(f"libcurl-dev @{arch.get_target()}") +builddep(f"libgit2-dev @{arch.get_target()}") +builddep(f"libssh2-dev @{arch.get_target()}") + + +def build(): + rust.build() + +on_build(build) + + +package("cargo") +dep("libssl @same-arch") +dep("libcrypto @same-arch") +dep("libz @same-arch") +dep("semi-libc @same-arch") +recommend("rust") +rust.use_auto_pack(["bin"]) -- 2.55.0 From a405253451ac00018863646ee9b12072bba9a843 Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 12:47:13 +0800 Subject: [PATCH 04/15] fix: autostrip breaks hard links Signed-off-by: sisungo --- hooks/autostrip.py | 41 +++++++++++++++++++++++++++++++++++++---- lib/atombuild.py | 39 +++++++++++++++------------------------ lib/pkgcomposer.py | 21 +++++++++++---------- 3 files changed, 63 insertions(+), 38 deletions(-) diff --git a/hooks/autostrip.py b/hooks/autostrip.py index 8f93261..19deb12 100644 --- a/hooks/autostrip.py +++ b/hooks/autostrip.py @@ -1,6 +1,8 @@ import os import stat import subprocess +import tempfile +import shutil from lib import common @@ -13,6 +15,8 @@ def _is_elf(filepath): def autostrip(composer): + processed_inodes = {} + for ent in common.treedir(composer.workdir): if not ent.is_file(follow_symlinks=False): continue @@ -20,7 +24,36 @@ def autostrip(composer): continue if not _is_elf(ent.path): continue - oldperm = stat.S_IMODE(os.stat(ent.path).st_mode) - os.chmod(ent.path, 0o777) - subprocess.run([strip, ent.path], check=True) - os.chmod(ent.path, oldperm) + + stat_info = os.stat(ent.path) + inode_key = (stat_info.st_dev, stat_info.st_ino) + if inode_key in processed_inodes: + continue + processed_inodes[inode_key] = True + + oldperm = stat.S_IMODE(stat_info.st_mode) + + try: + with tempfile.NamedTemporaryFile(mode='wb', delete=False) as tmp_file: + tmp_path = tmp_file.name + shutil.copy2(ent.path, tmp_path) + os.chmod(tmp_path, 0o777) + + subprocess.run([strip, tmp_path], check=True) + + with open(tmp_path, 'rb') as tmp_file: + stripped_data = tmp_file.read() + + with open(ent.path, 'r+b') as original_file: + original_file.truncate(0) + original_file.write(stripped_data) + original_file.flush() + os.fsync(original_file.fileno()) + + os.chmod(ent.path, oldperm) + os.unlink(tmp_path) + + except Exception as e: + if 'tmp_path' in locals() and os.path.exists(tmp_path): + os.unlink(tmp_path) + raise RuntimeError(f"Failed to strip {ent.path}: {e}") from e diff --git a/lib/atombuild.py b/lib/atombuild.py index 86f9796..d75108c 100644 --- a/lib/atombuild.py +++ b/lib/atombuild.py @@ -13,8 +13,11 @@ BASE_REQUIREMENTS = [ # Packages for running `semios-packages` scripts "python", "packie", - "patch", "zstd", + "libarchive-tools", + # Packages for building packages that require patching + "patch", + # Packages for downloading various formats of tarballs "libz-ng", "liblzma", "libbzip2", @@ -92,32 +95,20 @@ def enter_build_env(root: str, cmd: list[str], chdir: str = "/"): subprocess.run( [ "bwrap", - "--bind", - root, - "/", + "--bind", root, "/", "--unshare-pid", "--unshare-user", - "--uid", - "0", - "--gid", - "0", - "--dev", - "/dev", - "--bind", - "/sys", - "/sys", - "--proc", - "/proc", + "--uid", "0", + "--gid", "0", + "--dev", "/dev", + "--bind", "/sys", "/sys", + "--proc", "/proc", "--clearenv", - "--setenv", - "HOME", - "/home/root", - "--setenv", - "PATH", - "/bin", - "--setenv", - "SEMIOS_PKGBUILD_IN_ATOMIC", - "1", + "--setenv", "HOME", "/home/root", + "--setenv", "PATH", "/bin", + "--setenv", "SEMIOS_PKGBUILD_IN_ATOMIC", "1", + "--setenv", "USER", "root", + "--setenv", "LOGNAME", "root", "--chdir", chdir, ] diff --git a/lib/pkgcomposer.py b/lib/pkgcomposer.py index 28aace4..0de456e 100644 --- a/lib/pkgcomposer.py +++ b/lib/pkgcomposer.py @@ -4,17 +4,10 @@ import shutil import subprocess import sys -if sys.version_info >= (3, 14): - _archive_format = "zstdtar" - _archive_suffix = ".tar.zst" -else: - _archive_format = "gztar" - _archive_suffix = ".tar.gz" - class PkgComposer: def __init__(self, pkgfile: str): - self.pkgfile = pkgfile + self.pkgfile = os.path.abspath(pkgfile) def setworkdir(self, workdir: str): self.workdir = workdir @@ -33,8 +26,16 @@ class PkgComposer: f.write("\n") def compose(self): - shutil.make_archive(self.pkgfile, _archive_format, self.workdir) - shutil.move(self.pkgfile + _archive_suffix, self.pkgfile) + subprocess.run( + [ + "tar", "cpf", f"{self.pkgfile}.tar", + "-C", self.workdir, + "--numeric-owner", + ".", + ], + check=True, + ) + subprocess.run(["zstd", "--rm", "-f", f"{self.pkgfile}.tar", "-o", self.pkgfile], check=True) def makedir(self, name: str): os.mkdir(f"{self.workdir}/bundle/{name}") -- 2.55.0 From 9810303b7130330d5b135dc2fd82294521dc7540 Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 17:41:38 +0800 Subject: [PATCH 05/15] feat: add package SPIRV-LLVM-Translator Signed-off-by: sisungo --- packages/SPIRV-LLVM-Translator/pkgbuild.py | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/SPIRV-LLVM-Translator/pkgbuild.py diff --git a/packages/SPIRV-LLVM-Translator/pkgbuild.py b/packages/SPIRV-LLVM-Translator/pkgbuild.py new file mode 100644 index 0000000..8fd6dd8 --- /dev/null +++ b/packages/SPIRV-LLVM-Translator/pkgbuild.py @@ -0,0 +1,37 @@ +from lib.make import * +from lib import cpp, arch + + +version("22.1.5") +description("A tool and a library for bi-directional translation between SPIR-V and LLVM IR") +maintainer("sisungo ") +source_url("https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v22.1.5.tar.gz") + +builddep("shortcut/cmake") +builddep("shortcut/c++") +builddep(f"libllvm-dev (~22.1.0) @{arch.get_target()}") +builddep(f"libllvm-static (~22.1.0) @{arch.get_target()}") +builddep("pkgconf") +builddep("spirv-headers") + + +def build(): + cpp.cmake([ + "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=ON", + f"-DLLVM_DIR=/lib/{arch.get_target()}/cmake/llvm", + f"-DSPIRV-Headers_SOURCE_DIR=/lib/{arch.get_target()}", + f"-DCMAKE_INSTALL_PREFIX={get_prefix('libllvmspirv-dev')}", + ]) + cpp.ninja() + cpp.ninja_install() + +on_build(build) + + +package("libllvmspirv-dev") +cpp.use_auto_pack(["dev"]) + +package("llvm-spirv") +dep("libllvm (~22.1.0) @same-arch") +dep("libcxx @same-arch") +cpp.use_auto_pack(["bin"]) -- 2.55.0 From d05fce73dcbc58a633c9b0b77488abd6c587e287 Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 20:49:02 +0800 Subject: [PATCH 06/15] feat: add python packaging lib Signed-off-by: sisungo --- lib/python.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lib/python.py diff --git a/lib/python.py b/lib/python.py new file mode 100644 index 0000000..2939330 --- /dev/null +++ b/lib/python.py @@ -0,0 +1,62 @@ +import os +import shutil +import subprocess + +from . import make, arch + + +PY3_VERSION = "3.14" + + +def build(): + subprocess.run(["python3", "-m", "build", "."], check=True) + +def install(): + if os.path.exists("../pyinstall"): + shutil.rmtree("../pyinstall") + for i in os.listdir("dist"): + if not i.endswith(".whl"): + continue + subprocess.run(["python3", "-m", "installer", f"--destdir=../pyinstall", f"dist/{i}"], check=True) + os.chdir("../pyinstall") + while len(os.listdir(".")) == 1: + os.chdir(os.listdir(".")[0]) + +def version(s: str): + make.version(f"{s}+python{PY3_VERSION}") + +def _depcommon(s: str): + if s == "python": + return f"python (~{PY3_VERSION}.0) @{arch.get_target()}" + elif ".py" in s: + if ")" in s: + return s.replace(")", f", +python{PY3_VERSION})") + else: + return s.replace(".py", f" (+python{PY3_VERSION})") + else: + return None + +def builddep(s: str): + if s == "$shortcut": + builddep("python") + builddep("build.py") + builddep("installer.py") + elif _depcommon(s): + make.builddep(_depcommon(s)) + else: + raise RuntimeError("unrecognized python dep") + +def dep(s: str): + if _depcommon(s): + make.dep(_depcommon(s)) + else: + raise RuntimeError("unrecognized python dep") + +def _auto_pack(composer): + base = f"lib/python{PY3_VERSION}/site-packages" + composer.makedirs(base) + for i in os.listdir("."): + composer.add_dir(i, f"{base}/{i}") + +def use_auto_pack(): + make.on_pack(_auto_pack) -- 2.55.0 From b368f771d2aba93bbbf03b695e6e167b98772ab9 Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 20:53:42 +0800 Subject: [PATCH 07/15] feat: add package packaging-py Signed-off-by: sisungo --- packages/packaging-py/pkgbuild.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/packaging-py/pkgbuild.py diff --git a/packages/packaging-py/pkgbuild.py b/packages/packaging-py/pkgbuild.py new file mode 100644 index 0000000..6631be9 --- /dev/null +++ b/packages/packaging-py/pkgbuild.py @@ -0,0 +1,22 @@ +from lib.make import * +from lib import python + + +python.version("26.3") +description("Core utilities for Python packages") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz") + +python.builddep("$shortcut") + + +def build(): + python.build() + python.install() + +on_build(build) + + +package("packaging.py") +python.dep("python") +python.use_auto_pack() -- 2.55.0 From 8a1a62599d2cfb57531530fce4890522f548ee5d Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 21:02:38 +0800 Subject: [PATCH 08/15] feat: add package build-py Signed-off-by: sisungo --- packages/build-py/pkgbuild.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 packages/build-py/pkgbuild.py diff --git a/packages/build-py/pkgbuild.py b/packages/build-py/pkgbuild.py new file mode 100644 index 0000000..290b2cc --- /dev/null +++ b/packages/build-py/pkgbuild.py @@ -0,0 +1,24 @@ +from lib.make import * +from lib import python + + +python.version("1.5.0") +description("A simple, correct Python build frontend") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/78/e0/df5e171f685f82f37b12e1f208064e24244911079d7b767447d1af7e0d70/build-1.5.0.tar.gz") + +python.builddep("$shortcut") +python.builddep("packaging.py (>=25.0)") + + +def build(): + python.build() + python.install() + +on_build(build) + + +package("build.py") +python.dep("python") +python.dep("packaging.py (>=25.0)") +python.use_auto_pack() -- 2.55.0 From 633bf71cb18d9d8a9f1683147c1e95d8e8378c9c Mon Sep 17 00:00:00 2001 From: sisungo Date: Sat, 15 Aug 2026 21:08:10 +0800 Subject: [PATCH 09/15] feat: add package installer-py Signed-off-by: sisungo --- packages/installer-py/pkgbuild.py | 22 ++++++++++++++++++++++ x.py | 1 + 2 files changed, 23 insertions(+) create mode 100644 packages/installer-py/pkgbuild.py diff --git a/packages/installer-py/pkgbuild.py b/packages/installer-py/pkgbuild.py new file mode 100644 index 0000000..b35587a --- /dev/null +++ b/packages/installer-py/pkgbuild.py @@ -0,0 +1,22 @@ +from lib.make import * +from lib import python + + +python.version("1.0.1") +description("A library for installing Python wheels.") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/06/fe/b9f481cf0cc867958a21338baa900357b7b7d86cac9b025948049d77923c/installer-1.0.1.tar.gz") + +python.builddep("$shortcut") + + +def build(): + python.build() + python.install() + +on_build(build) + + +package("installer.py") +python.dep("python") +python.use_auto_pack() diff --git a/x.py b/x.py index 3484849..f178d2f 100644 --- a/x.py +++ b/x.py @@ -118,6 +118,7 @@ def cmd_build_package(package: str): "name": pkgname, "version": pkgver, "arch": pkgarch, + "description": pkginfo[lib.make._key_description], "dependencies": pkginfo[lib.make._key_dependencies], "provides": pkginfo[lib.make._key_provides], "recommendations": pkginfo[lib.make._key_recommendations], -- 2.55.0 From 9711728da69f6f6fd7132169ab6d1c087b5aac03 Mon Sep 17 00:00:00 2001 From: sisungo Date: Sun, 16 Aug 2026 09:38:46 +0800 Subject: [PATCH 10/15] feat: add package PyYAML Signed-off-by: sisungo --- packages/PyYAML/pkgbuild.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/PyYAML/pkgbuild.py diff --git a/packages/PyYAML/pkgbuild.py b/packages/PyYAML/pkgbuild.py new file mode 100644 index 0000000..185d1bc --- /dev/null +++ b/packages/PyYAML/pkgbuild.py @@ -0,0 +1,22 @@ +from lib.make import * +from lib import python + + +python.version("6.0.3") +description("YAML parser and emitter for Python") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz") + +python.builddep("$shortcut") + + +def build(): + python.build() + python.install() + +on_build(build) + + +package("PyYAML.py") +python.dep("python") +python.use_auto_pack() -- 2.55.0 From a14d1e6ea09598b815bae7439e75993ed19eab3c Mon Sep 17 00:00:00 2001 From: sisungo Date: Sun, 16 Aug 2026 10:19:55 +0800 Subject: [PATCH 11/15] feat: add package MarkupSafe-py Signed-off-by: sisungo --- packages/MarkupSafe-py/pkgbuild.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/MarkupSafe-py/pkgbuild.py diff --git a/packages/MarkupSafe-py/pkgbuild.py b/packages/MarkupSafe-py/pkgbuild.py new file mode 100644 index 0000000..699a4bd --- /dev/null +++ b/packages/MarkupSafe-py/pkgbuild.py @@ -0,0 +1,22 @@ +from lib.make import * +from lib import python + + +python.version("3.0.3") +description("Safely add untrusted strings to HTML/XML markup.") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/7e/99/7690b6d4034fffd95959cbe0c02de8deb3098cc577c67bb6a24fe5d7caa7/markupsafe-3.0.3.tar.gz") + +python.builddep("$shortcut") + + +def build(): + python.build() + python.install() + +on_build(build) + + +package("MarkupSafe.py") +python.dep("python") +python.use_auto_pack() -- 2.55.0 From 02dede782332155377e685c8baeb07717a617fad Mon Sep 17 00:00:00 2001 From: sisungo Date: Sun, 16 Aug 2026 10:43:10 +0800 Subject: [PATCH 12/15] feat: add package Mako-py Signed-off-by: sisungo --- lib/python.py | 2 +- packages/Mako-py/pkgbuild.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 packages/Mako-py/pkgbuild.py diff --git a/lib/python.py b/lib/python.py index 2939330..4d897fe 100644 --- a/lib/python.py +++ b/lib/python.py @@ -32,7 +32,7 @@ def _depcommon(s: str): if ")" in s: return s.replace(")", f", +python{PY3_VERSION})") else: - return s.replace(".py", f" (+python{PY3_VERSION})") + return s.replace(".py", f".py (+python{PY3_VERSION})") else: return None diff --git a/packages/Mako-py/pkgbuild.py b/packages/Mako-py/pkgbuild.py new file mode 100644 index 0000000..b3aec6a --- /dev/null +++ b/packages/Mako-py/pkgbuild.py @@ -0,0 +1,29 @@ +import os + +from lib.make import * +from lib import python + + +python.version("1.4.1") +description("A super-fast templating language that borrows the best ideas from the existing templating languages.") +maintainer("sisungo ") +source_url("https://files.pythonhosted.org/packages/2a/12/b5fa2353e2754cd67fb9f83793fa48ff42c213a5da7e719869d2301f6ab8/mako-1.4.1.tar.gz") + +python.builddep("$shortcut") +python.builddep("MarkupSafe.py") + + +def build(): + python.build() + python.install() + os.chdir("lib") + while len(os.listdir(".")) == 1: + os.chdir(os.listdir(".")[0]) + +on_build(build) + + +package("Mako.py") +python.dep("python") +python.dep("MarkupSafe.py") +python.use_auto_pack() -- 2.55.0 From 452e767da4a37165f5a3ad4c2156ea9fc8aabc53 Mon Sep 17 00:00:00 2001 From: sisungo Date: Tue, 11 Aug 2026 20:32:18 +0800 Subject: [PATCH 13/15] feat: add package spirv-tools Signed-off-by: sisungo --- packages/spirv-tools/pkgbuild.py | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/spirv-tools/pkgbuild.py diff --git a/packages/spirv-tools/pkgbuild.py b/packages/spirv-tools/pkgbuild.py new file mode 100644 index 0000000..188663d --- /dev/null +++ b/packages/spirv-tools/pkgbuild.py @@ -0,0 +1,43 @@ +import os +import shutil + +from lib.make import * +from lib import cpp, arch + + +sdk_version = "1.4.357.0" + +version(sdk_version) +description("an API and commands for processing SPIR-V modules") +maintainer("sisungo ") +source_url("https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.4.357.0.tar.gz") + +builddep("shortcut/cmake") +builddep("shortcut/c++") +builddep(f"spirv-headers (={sdk_version}) @{arch.get_target()}") + + +def build(): + cpp.cmake([ + f"-DSPIRV-Headers_SOURCE_DIR=/lib/{arch.get_target()}", + "-DCMAKE_CXX_FLAGS=-Wno-error=switch", + f"-DCMAKE_INSTALL_PREFIX={get_prefix('spirv-tools-dev')}", + ]) + cpp.ninja() + cpp.ninja_install() + try: + os.rename("lib64", "lib") + os.rename("lib32", "lib") + except: + pass + +on_build(build) + + +package("spirv-tools") +dep("libcxx @same-arch") +cpp.use_auto_pack(["bin"]) + +package("spirv-tools-dev") +dep("spirv-tools (same)") +cpp.use_auto_pack(["lib", "dev"]) -- 2.55.0 From 3a1f472de29c1bbd4a397c7e595d504571ef0c1e Mon Sep 17 00:00:00 2001 From: sisungo Date: Sun, 16 Aug 2026 23:36:00 +0800 Subject: [PATCH 14/15] fix: lib/cpp auto pack ignores hpp files Signed-off-by: sisungo --- lib/cpp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cpp.py b/lib/cpp.py index fd9ad4b..2a8ab73 100644 --- a/lib/cpp.py +++ b/lib/cpp.py @@ -117,6 +117,7 @@ def _is_dev_file(ent) -> bool: or ent.name.endswith(".la") or ent.name.endswith(".pc") or ent.name.endswith(".h") + or ent.name.endswith(".hpp") or ent.name.endswith(".cmake") or ent.name.endswith(".inc") or ("Makefile" in ent.name) -- 2.55.0 From 0ada9d32fb4f83cd73400148590c7282ad304d56 Mon Sep 17 00:00:00 2001 From: sisungo Date: Mon, 17 Aug 2026 17:43:54 +0800 Subject: [PATCH 15/15] feat: add support of zip source archives Signed-off-by: sisungo --- lib/sources.py | 52 ++++++++++++++++++++++++++++++++++++++++---------- x.py | 1 + 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/lib/sources.py b/lib/sources.py index c643024..3748bdc 100644 --- a/lib/sources.py +++ b/lib/sources.py @@ -4,6 +4,7 @@ import sys import tarfile import urllib.parse import urllib.request +import zipfile def filename(url): @@ -128,6 +129,25 @@ def tar_common_root(tar: tarfile.TarFile) -> str | None: return root +def zip_common_root(zip_file: zipfile.ZipFile) -> str | None: + members = zip_file.infolist() + if not members: + return None + root = None + for member in members: + path = member.filename.replace('\\', '/').lstrip('./').lstrip('/') + if not path: + continue + this_root = path.split('/')[0] + if this_root in ('', '.', '..'): + continue + if root is None: + root = this_root + elif this_root != root: + return None + return root + + def sources_dir_name() -> str: with open("./target/sources.tag") as file: return file.read() @@ -139,16 +159,28 @@ def source_url(url: str): download_path = f"./target/{filename(url)}" download(url, download_path) - with tarfile.open(download_path, "r") as tar: - common_root = tar_common_root(tar) - extract_dir = "./target" - sources_dir = f"./target/{common_root}" - if common_root in ["", ".", "None"]: - extract_dir = "./target/sources" - sources_dir = "./target/sources" - tar.extractall(extract_dir) - with open("./target/sources.tag", "wt+") as file: - file.write(sources_dir) + if download_path.endswith(".zip"): + with zipfile.ZipFile(download_path, "r") as zip: + common_root = zip_common_root(zip) + else: + with tarfile.open(download_path, "r") as tar: + common_root = tar_common_root(tar) + + extract_dir = "./target" + sources_dir = f"./target/{common_root}" + if common_root in ["", ".", None]: + extract_dir = "./target/sources" + sources_dir = "./target/sources" + + if download_path.endswith(".zip"): + with zipfile.ZipFile(download_path, "r") as zip: + zip.extractall(extract_dir) + else: + with tarfile.open(download_path, "r") as tar: + tar.extractall(extract_dir) + + with open("./target/sources.tag", "wt+") as file: + file.write(sources_dir) def _git_repo_name(url: str) -> str: diff --git a/x.py b/x.py index f178d2f..2dd8a99 100644 --- a/x.py +++ b/x.py @@ -119,6 +119,7 @@ def cmd_build_package(package: str): "version": pkgver, "arch": pkgarch, "description": pkginfo[lib.make._key_description], + "maintainers": pkginfo[lib.make._key_maintainers], "dependencies": pkginfo[lib.make._key_dependencies], "provides": pkginfo[lib.make._key_provides], "recommendations": pkginfo[lib.make._key_recommendations], -- 2.55.0