# Generated by go2rpm 1.14.0
%bcond check 1

# https://github.com/gokcehan/lf
%global goipath       github.com/gokcehan/lf
Version:              r33
%global tag           %{version}

%gometa -L -f

%global common_description %{expand:
Terminal file manager.}

%global golicenses      LICENSE
%global godocs          CONTRIBUTING.md README.md doc.md

Name:           lf
Release:        %autorelease
Summary:        Terminal file manager

License:        MIT
URL:            %{gourl}
Source:         %{gosource}

# Provided as script in /etc/profile.d
Provides: lfcd

# Obsoletes subpackages for integrations
Obsoletes: %{name}-zsh-integration < r30-2
Obsoletes: %{name}-fish-integration < r30-2
Obsoletes: %{name}-vim-plugin < r30-2

%description %{common_description}


%gopkg

%prep
%goprep -A

%generate_buildrequires
%go_generate_buildrequires

%build
CGO_ENABLED=0 LDFLAGS="$LDFLAGS -X main.gVersion=%{version}" %gobuild -o %{name} %{goipath}

%install
%gopkginstall
install -m 0755 -Dvp %{name}                %{buildroot}%{_bindir}/%{name}
install -m 0644 -Dvp %{name}.desktop        %{buildroot}%{_datadir}/applications/%{name}.desktop
# docs
install -m 0644 -Dvp %{name}.1              %{buildroot}%{_mandir}/man1/%{name}.1
install -m 0644 -Dvp etc/%{name}rc.example  %{buildroot}%{_pkgdocdir}/%{name}rc.example
install -m 0644 -Dvp etc/colors.example     %{buildroot}%{_pkgdocdir}/colors.example
install -m 0644 -Dvp etc/icons.example      %{buildroot}%{_pkgdocdir}/icons.example
# shell completions
install -m 0644 -Dvp etc/%{name}.bash       %{buildroot}%{bash_completions_dir}/%{name}
install -m 0644 -Dvp etc/%{name}.zsh        %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
install -m 0644 -Dvp etc/%{name}.fish       %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
# lfcd
install -m 0644 -Dvp etc/%{name}cd.sh       %{buildroot}%{_sysconfdir}/profile.d/%{name}cd.sh
install -m 0644 -Dvp etc/%{name}cd.sh       %{buildroot}%{_datadir}/zsh/site-functions/%{name}cd
install -m 0644 -Dvp etc/%{name}cd.fish     %{buildroot}%{_datadir}/fish/vendor_functions.d/%{name}cd.fish
# lf.vim
install -m 0644 -Dvp etc/%{name}.vim        %{buildroot}%{_datadir}/vim/vimfiles/plugin/%{name}.vim

%if %{with check}
%check
%gocheck
%endif


%files
%license %{golicenses}
%dir %{_docdir}/{%name}
%doc %{_mandir}/man1/{%name}.1*
%doc %{_pkgdocdir}/*
%{_bindir}/%{name}
# directories provides by 'filesystem' and 'setup'
%{_datadir}/applications/%{name}.desktop
%{bash_completions_dir}/%{name}
%{_sysconfdir}/profile.d/%{name}cd.sh
# zsh
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}
%{_datadir}/zsh/site-functions/%{name}cd
# fish
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%dir %{_datadir}/fish/vendor_functions.d
%{_datadir}/fish/vendor_completions.d/%{name}.fish
%{_datadir}/fish/vendor_functions.d/%{name}cd.fish
# lf.vim
%dir %{_datadir}/vim
%dir %{_datadir}/vim/vimfiles
%dir %{_datadir}/vim/vimfiles/plugin
%{_datadir}/vim/vimfiles/plugin/%{name}.vim

%gopkgfiles


%changelog
%autochangelog