# Built from a vendored crate tree (Source1) because elan is a leaf # application (a fork of rustup) with ~275 transitive crates, none of which # are packaged as rust-* in Fedora. This follows Fedora's "Packaging Rust # applications with bundled dependencies" guidelines. # Rust source files legitimately begin with inner attributes (#![...]), which # brp-mangle-shebangs misreads as shebangs. The only .rs files we ship are the # vendored debug sources, so exclude them from shebang mangling. %global __brp_mangle_shebangs_exclude_from \.rs$ Name: elan Version: 4.2.1 Release: 2%{?dist} Summary: Manage multiple Lean installations with ease # elan itself is "MIT OR Apache-2.0". The binary statically links ~275 # bundled crates whose combined license must be enumerated before a Fedora # submission (run `cargo_license` / add bundled(crate(...)) Provides). For # this COPR build we record elan's own license. # TODO(Fedora): expand License to the full combined set + add bundled Provides. License: MIT OR Apache-2.0 URL: https://github.com/leanprover/elan Source0: %{url}/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz Source1: %{name}-%{version}-vendor.tar.xz # Updated Cargo.lock: openssl-sys bumped 0.9.106 -> 0.9.117 (and openssl # 0.10.70 -> 0.10.81) so the build accepts OpenSSL 4.0 on rawhide. Matches the # vendored crate set in Source1. Source2: %{name}-%{version}-Cargo.lock ExclusiveArch: %{rust_arches} BuildRequires: cargo-rpm-macros >= 24 # elan links system OpenSSL and libcurl rather than bundling them (Fedora # policy; bundled OpenSSL also needs perl in the buildroot). The two crates # that hardcode openssl's "vendored" feature are patched in %prep. BuildRequires: openssl-devel BuildRequires: pkgconfig(openssl) BuildRequires: libcurl-devel BuildRequires: pkgconfig(libcurl) # Generate a man page from --help (upstream ships none). BuildRequires: help2man %global _description %{expand: elan is a small tool for managing your installations of the Lean theorem prover. It places lean and lake binaries in your PATH that automatically select and, if necessary, download the Lean toolchain described in a project's lean-toolchain file. Toolchains can also be installed, selected, run and removed manually. elan is a fork of rustup adapted for Lean.} %description %_description %prep %autosetup -n %{name}-%{version} -p1 # Replace the pristine Cargo.lock with the openssl-bumped one matching Source1. cp -p %{SOURCE2} Cargo.lock # Drop the hardcoded "vendored" feature on the openssl crate so we link the # system OpenSSL instead of compiling a bundled copy from source. sed -i 's/features = \["vendored"\], //' src/download/Cargo.toml sed -i 's/, features = \["vendored"\]//' src/elan-utils/Cargo.toml # Unpack the vendored crate tree alongside the sources and point cargo at it. tar -xf %{SOURCE1} %cargo_prep -v vendor %build %cargo_build %install %cargo_install # Upstream builds a single binary named "elan-init" (rustup style). Ship it # under the canonical "elan" name and provide "elan-init" as a symlink so the # documented one-time `elan-init` setup still works. mv %{buildroot}%{_bindir}/elan-init %{buildroot}%{_bindir}/%{name} ln -s %{name} %{buildroot}%{_bindir}/elan-init # Shell completions, generated by the freshly built binary. install -d %{buildroot}%{_datadir}/bash-completion/completions install -d %{buildroot}%{_datadir}/zsh/site-functions install -d %{buildroot}%{_datadir}/fish/vendor_completions.d %{buildroot}%{_bindir}/%{name} completions bash > %{buildroot}%{_datadir}/bash-completion/completions/%{name} || : %{buildroot}%{_bindir}/%{name} completions zsh > %{buildroot}%{_datadir}/zsh/site-functions/_%{name} || : %{buildroot}%{_bindir}/%{name} completions fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish || : # Man page, generated from the binary's --help (upstream ships none). help2man --no-info --section 1 \ --name 'manage multiple Lean toolchain installations' \ %{buildroot}%{_bindir}/%{name} > %{name}.1 install -Dpm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 ln -s %{name}.1 %{buildroot}%{_mandir}/man1/elan-init.1 %files %license LICENSE LICENSE-APACHE LICENSE-MIT %doc README.md CHANGELOG.md %{_bindir}/%{name} %{_bindir}/elan-init %{_datadir}/bash-completion/completions/%{name} %{_datadir}/zsh/site-functions/_%{name} %{_datadir}/fish/vendor_completions.d/%{name}.fish %{_mandir}/man1/%{name}.1* %{_mandir}/man1/elan-init.1* %changelog * Wed Jun 24 2026 Morgan Hough - 4.2.1-2 - Bump vendored openssl-sys to 0.9.117 (openssl 0.10.81) for OpenSSL 4.0 / rawhide compatibility * Mon Jun 22 2026 Morgan Hough - 4.2.1-1 - Initial package (Lean version manager), built from vendored crates