diff --git a/packer/README.md b/packer/README.md index ed9c1f0..1cde670 100644 --- a/packer/README.md +++ b/packer/README.md @@ -1,5 +1,52 @@ # sarasacw-omrf-packer +`sarasacw-omrf-packer` is the distribution packer of the Sarasas Chip Workshop Oh My Rust FFI (OMRF) toolset. +Given a Rust project that exposes a C-friendly FFI as a `cdylib`, it assembles a CMake-style redistributable tree. +It involves header files, the built dynamic library, and generated CMake and pkg-config package files, +and it can additionally bundle the result into a zip archive. + +It targets Rust FFI projects that need to be distributed and consumed like ordinary CMake/pkg-config packages, +including on MSVC-only Windows toolchains where pkg-config alone is not enough. + +## Status + +Barely works for the specific workflow of Sarasas Chip Workshop. +And will be improved by new requirement coming from Sarasas Chip Workshop devlopment. + +Projects declare the minimum required packer version through the `min_version` field in their `[package.metadata.omrf]` table; +running an older packer than requested fails fast with a clear error. + +## License + +Licensed under the MIT License. + +## Usage + +Install from PyPI (the project is built with `uv`, but `pipx install` or `pip install` work just as well on the published wheel): + +```console +uv tool install sarasacw-omrf-packer +``` + +The packer does not build the project itself. Build it first -- `cargo build --release`, adding `--target ` for cross-compilation -- then run: + +```console +sarasacw-omrf-packer -m path/to/Cargo.toml +``` + +`cargo` and `rustc` are resolved from `PATH`; override them with the environment variables listed in the [Environment Variables](#environment-variables) section. + +### Command-line options + +| Option | Required | Description | +|---|---|---| +| `-m`, `--manifest ` | yes | Path to the `Cargo.toml` of the project to pack. | +| `-d`, `--dist-dir ` | no | Directory where the redistributable tree is materialized (`bin/`, `include/`, `lib/`, ...). | +| `-z`, `--dist-zip ` | no | Path of the zip archive produced from the redistributable tree. | +| `-t`, `--target ` | no | Target triple to pack for (e.g. `x86_64-pc-windows-msvc`). Defaults to the host toolchain triple. | + +`--dist-dir` and `--dist-zip` are independent: pass either, both, or neither. Omitting both performs a dry run that validates the configuration without writing any output. Run `sarasacw-omrf-packer --help` for the authoritative list. + ## Metadata All packer used properties are stored in target Rust manifest file as metadata style. @@ -77,5 +124,7 @@ requires = ["libfoo >= 1.0", "libbar"] ## Environment Variables -- `OMRF_PACKER_CARGO`: Path to the `cargo` executable used to collect project metadata. When unset, the packer invokes `cargo` as resolved from `PATH`. -- `OMRF_PACKER_RUSTC`: Path to the `rustc` executable used to resolve the host toolchain triple. When unset, the packer invokes `rustc` as resolved from `PATH`. +- `OMRF_PACKER_CARGO`: Path to the `cargo` executable used to collect project metadata. +When unset, the packer invokes `cargo` as resolved from `PATH`. +- `OMRF_PACKER_RUSTC`: Path to the `rustc` executable used to resolve the host toolchain triple. +When unset, the packer invokes `rustc` as resolved from `PATH`. diff --git a/packer/pyproject.toml b/packer/pyproject.toml index 67f468a..3525b2f 100644 --- a/packer/pyproject.toml +++ b/packer/pyproject.toml @@ -1,12 +1,26 @@ [project] name = "sarasacw-omrf-packer" version = "1.0.0" -description = "Add your description here" +description = "The packer for Rust, specifically designed for the SarasaCW OMRF project, to distribute C-friendly FFI dynamic library as CMake package." readme = "README.md" authors = [ { name = "yyc12345", email = "yyc12321@outlook.com" } ] requires-python = ">=3.13" +license = { text = "MIT" } +keywords = ["rust", "ffi", "cmake", "pkg-config", "packaging", "omrf"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3 :: Only", +] dependencies = [ "jinja2==3.1.6", "semver>=3.0.4", @@ -15,6 +29,11 @@ dependencies = [ [project.scripts] sarasacw-omrf-packer = "sarasacw_omrf_packer:main" +[project.urls] +Homepage = "https://github.com/SarasasChipWorkshop/sarasacw-omrf" +Repository = "https://github.com/SarasasChipWorkshop/sarasacw-omrf" +Issues = "https://github.com/SarasasChipWorkshop/sarasacw-omrf/issues" + [build-system] requires = ["uv_build>=0.8.0,<0.9"] build-backend = "uv_build"