Soc Virnyl Estela 2022-11-24 19:37:33 +00:00 committed by Git OBS Bridge
parent 9b5ebf6568
commit c1d9c9b503

View File

@ -81,18 +81,14 @@ URL: https://github.com/JuliaLang/juliaup
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: cargo_config
BuildRequires: cargo-packaging
BuildRequires: rust+cargo
%if 0%{?suse_version}
BuildRequires: cargo-packaging
%endif
%provides_julia_versioned julia
Provides: julia = %{latest_julia_version}
Obsoletes: julia < %{latest_julia_version}
%if 0%{?suse_version}
PreReq: update-alternatives
%endif
%description
A cross-platform installer for the Julia programming language.
@ -108,60 +104,30 @@ mkdir .cargo
cp %{SOURCE2} .cargo/config
%build
%if 0%{?rhel} > 7 || 0%{?fedora}
unset LIBSSH2_SYS_USE_PKG_CONFIG
export RUSTFLAGS="%{rustflags}"
cargo build --offline --release --no-default-features
%endif
%if 0%{?suse_version}
%{cargo_build} --no-default-features
%endif
%install
%if 0%{?rhel} > 7 || 0%{?fedora}
unset LIBSSH2_SYS_USE_PKG_CONFIG
export RUSTFLAGS="%{rustflags}"
cargo install --offline --release --no-default-features --no-track --root="%{buildroot}%{_prefix}" --path .
%endif
%if 0%{?suse_version}
%{cargo_install} --no-default-features
%endif
%if 0%{?rhel} > 7 || 0%{?fedora}
ln -sfv %{_bindir}/julia %{buildroot}%{_bindir}/julialauncher
%endif
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -sfv %{_sysconfdir/alternatives/julia %{buildroot}%{_bindir}/julia
%endif
%post
%if 0%{?suse_version}
"%_sbindir/update-alternatives" --install \
"%{_bindir}/julia" julia "%{_bindir}/julialauncher" $(echo %{latest_julia_version} | sed 's/\.//g')
%endif
%pre
%if 0%{?suse_version}
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then
"%{_sbindir}/update-alternatives" --remove julia "%{_bindir}/julialauncher";
fi;
%endif
%postun
%if 0%{?suse_version}
if [ ! -f %{_bindir}/julia ] ; then
"%{_sbindir}/update-alternatives" --remove julia "%{_bindir}/julialauncher"
fi
%endif
%files
%if 0%{?suse_version}
%ghost %_sysconfdir/alternatives/julia
%endif
%license LICENSE
%doc README.md
%{_bindir}/juliainstaller