{"id":29009757,"url":"https://github.com/levicook/elf-magic","last_synced_at":"2026-04-28T00:31:16.370Z","repository":{"id":301081504,"uuid":"1007798407","full_name":"levicook/elf-magic","owner":"levicook","description":"Automatic compile-time ELF exports for Solana programs. One-liner integration, zero config, just works. ✨","archived":false,"fork":false,"pushed_at":"2025-06-28T04:46:06.000Z","size":178,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-10T05:25:31.603Z","etag":null,"topics":["automation","build-tools","cargo","elf","rust","solana","workspace"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levicook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-24T14:44:07.000Z","updated_at":"2025-08-23T18:15:53.000Z","dependencies_parsed_at":"2025-06-25T04:24:16.860Z","dependency_job_id":"f1ab133e-0989-4c2e-a5de-7ddd8734b2ae","html_url":"https://github.com/levicook/elf-magic","commit_stats":null,"previous_names":["levicook/elf-magic"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/levicook/elf-magic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levicook%2Felf-magic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levicook%2Felf-magic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levicook%2Felf-magic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levicook%2Felf-magic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levicook","download_url":"https://codeload.github.com/levicook/elf-magic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levicook%2Felf-magic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32361477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","build-tools","cargo","elf","rust","solana","workspace"],"created_at":"2025-06-25T15:14:19.153Z","updated_at":"2026-04-28T00:31:16.364Z","avatar_url":"https://github.com/levicook.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elf-magic ✨\n\n\u003e Automatic compile-time ELF exports for Solana programs. One-liner integration, zero config, just works.\n\nStop wrestling with Solana program builds. `elf-magic` automatically discovers all your programs, builds them, and generates clean Rust code so your ELF bytes are always available as constants.\n\n## Quick Start\n\n```bash\n# Create an ELF crate in your workspace\ncargo new my-elves --lib\n```\n\nAdd to `my-elves/Cargo.toml`:\n\n```toml\n[build-dependencies]\nelf-magic = \"0.5\"\n```\n\nAdd to `my-elves/build.rs`:\n\n```rust\nfn main() { elf_magic::build().unwrap(); }\n```\n\n```bash\ncargo build  # magic ✨\n```\n\n## What You Get\n\nAfter building, your ELF crate exports constants for every Solana program in your workspace:\n\n**Your hand-written `src/lib.rs`:**\n\n```rust\n//! ELF binaries for my Solana programs.\n\ninclude!(env!(\"ELF_MAGIC_GENERATED_PATH\"));\n```\n\n**Generated at build time (in `$OUT_DIR`):**\n\n```rust\npub const TOKEN_MANAGER_ELF: \u0026[u8] = include_bytes!(env!(\"TOKEN_MANAGER_ELF_PATH\"));\npub const GOVERNANCE_ELF: \u0026[u8] = include_bytes!(env!(\"GOVERNANCE_ELF_PATH\"));\n\npub fn elves() -\u003e Vec\u003c(\u0026'static str, \u0026'static [u8])\u003e {\n    vec![\n        (\"token_manager\", TOKEN_MANAGER_ELF),\n        (\"governance\", GOVERNANCE_ELF),\n    ]\n}\n```\n\nUse your programs anywhere:\n\n```rust\nuse my_elves::{TOKEN_MANAGER_ELF, GOVERNANCE_ELF};\n\n// Deploy, test, embed - whatever you need\nlet program_id = deploy_program(TOKEN_MANAGER_ELF)?;\n```\n\n## Three Modes for Every Workflow\n\n### 🪄 [Magic Mode](docs/modes/magic.md) (Default)\n\n**Zero config, just works**\n\n```bash\ncargo build  # Discovers and builds all programs automatically\n```\n\nPerfect for: Single workspaces, development, getting started\n\n### 🎛️ [Permissive Mode](docs/modes/permissive.md)\n\n**Multi-workspace with exclusions**\n\n```toml\n[package.metadata.elf-magic]\nmode = \"permissive\"\nglobal_deny = [\"package:*-test\"]\nworkspaces = [\n    { manifest_path = \"./Cargo.toml\", deny = [\"target:dev*\"] },\n    { manifest_path = \"examples/Cargo.toml\" }\n]\n```\n\nPerfect for: Complex repos, excluding test programs, multi-workspace projects\n\n### 🎯 [Laser Eyes Mode](docs/modes/laser-eyes.md)\n\n**Precision targeting**\n\n```toml\n[package.metadata.elf-magic]\nmode = \"laser-eyes\"\nworkspaces = [\n    { manifest_path = \"./Cargo.toml\", only = [\"target:token_manager\", \"target:governance\"] }\n]\n```\n\nPerfect for: Production builds, CI optimization, focused development\n\n## Rich Build Reporting\n\nFirst build shows what's happening:\n\n```bash\n$ cargo build\nMode: magic (1 workspace specified)\n\nWorkspace: ./Cargo.toml\n  + token_manager\n  + governance\n\nGenerated constants with 2 Solana programs\n   Compiling token-manager v0.1.0\n   Compiling governance v0.1.0\n   Compiling my-elves v0.1.0\n   Finished dev [unoptimized + debuginfo] target(s)\n```\n\nThe `+` shows included programs, `-` shows excluded programs.\n\n## How It Works\n\nThe magic behind the one-liner:\n\n1. **🔍 Auto-discovery**: `cargo metadata` finds all workspace members\n2. **🎯 Smart filtering**: `crate-type = [\"cdylib\"]` identifies Solana programs\n3. **🔨 Automatic building**: `cargo build-sbf` runs when source changes\n4. **📝 Code generation**: Target names become `TARGET_NAME_ELF` constants\n5. **⚡ Incremental**: Only rebuilds what changed\n\n## Installation\n\nAdd to your ELF crate's `Cargo.toml`:\n\n```toml\n[build-dependencies]\nelf-magic = \"0.5\"\n```\n\n## Documentation\n\n- **🪄 [Magic Mode](docs/modes/magic.md)** - Zero config auto-discovery\n- **🎛️ [Permissive Mode](docs/modes/permissive.md)** - Multi-workspace with exclusions\n- **🎯 [Laser Eyes Mode](docs/modes/laser-eyes.md)** - Precision targeting\n- **📖 [Usage Guide](docs/usage.md)** - Using your generated constants\n- **🏗️ [Architecture](docs/architecture.md)** - How it works under the hood\n\n## Examples\n\nWorks with any workspace layout:\n\n**Single Workspace** (Magic Mode)\n\n```\nmy-workspace/\n├── Cargo.toml            # Workspace root\n├── my-elves/             # Generated ELF exports\n│   ├── build.rs          # One-liner magic ✨\n│   └── src/lib.rs        # Hand-written wrapper\n└── programs/\n    ├── token-manager/    # Your Solana programs\n    └── governance/\n```\n\n**Multi-Workspace** (Permissive/Laser Eyes Mode)\n\n```\narch-network/\n├── Cargo.toml            # Main workspace (5 programs)\n├── elves/                # ELF exports with advanced config\n└── examples/             # Separate workspaces\n    ├── basic/Cargo.toml  # Independent workspace\n    └── advanced/Cargo.toml\n```\n\n## Requirements\n\n- Rust 2021 edition\n- [Solana CLI tools](https://docs.solana.com/cli/install-solana-cli-tools) for `cargo build-sbf`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevicook%2Felf-magic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevicook%2Felf-magic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevicook%2Felf-magic/lists"}