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