## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%ifarch aarch64 armv7hl ppc64le
%bcond_with tests
%else
%bcond_without tests
%endif

Name:           dub
Version:        1.38.1
Release:        %autorelease
Summary:        Package and build management system for D

License:        MIT
URL:            https://github.com/dlang/dub
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0:         dub_1.38.0_no-copy.patch

ExclusiveArch:  %{ldc_arches}

BuildRequires:  curl-devel
BuildRequires:  ldc

%description
DUB is a package and build manager for D applications and libraries.

%prep
%autosetup -p1

%build
ldmd2 -run build.d %{_d_optflags}
./bin/dub scripts/man/gen_man.d

%install
install -Dpm0755 -t %{buildroot}%{_bindir} bin/dub
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 scripts/man/dub*.1
install -Dpm0644 scripts/bash-completion/dub.bash %{buildroot}%{_datadir}/bash-completion/completions/dub
install -Dpm0644 -t %{buildroot}%{_datadir}/fish/completions scripts/fish-completion/dub.fish
install -Dpm0644 -t %{buildroot}%{_datadir}/zsh/site-functions scripts/zsh-completion/_dub

%if %{with tests}
%check
# Compiler to use for the test suite
export DC=ldmd2
# Path to dub binary
export DUB="%{buildroot}%{_bindir}/dub"
# Some tests require dub in the system path
export PATH="%{buildroot}%{_bindir}:$PATH"
dub test
pushd test
# Neuter the test suite for now, as it depends on a lot of unpackaged modules
./run-unittest.sh || true
%endif

%files
%license LICENSE
%doc ARCHITECTURE.md CONTRIBUTING.md README.md
%doc architecture.png architecture.graphmlz
%doc examples
%{_bindir}/dub
%{_mandir}/man1/dub*.1*
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/dub
%dir %{_datadir}/fish
%dir %{_datadir}/fish/completions
%{_datadir}/fish/completions/dub.fish
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_dub

%changelog
## START: Generated by rpmautospec
* Sun Aug 11 2024 Grillo del Mal <grillo@delmal.cl> - 1.38.1-1
- Update to 1.38.1

* Mon Aug 05 2024 Grillo del Mal <grillo@delmal.cl> - 1.38.0-1
- Update to 1.38.0

* Thu Oct 05 2023 Grillo del Mal <grillo@delmal.cl> - 1.34.0-1
- Add fix to include readonly libraries

* Mon Jul 24 2023 Kalev Lember <klember@redhat.com> - 1.33.1-1
- Update to 1.33.1

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.31.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Mar 16 2023 Kalev Lember <klember@redhat.com> - 1.31.1-3
- Exclude self tests on ppc64le as well

* Thu Mar 16 2023 Kalev Lember <klember@redhat.com> - 1.31.1-2
- Reorder tests to fix the build

* Thu Mar 16 2023 Kalev Lember <klember@redhat.com> - 1.31.1-1
- Update to 1.31.1

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.23.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Jul 27 2022 Kalev Lember <klember@redhat.com> - 1.23.0-5
- Rebuilt for ldc 1.30

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.23.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.23.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Mon Jan 17 2022 Davide Cavalca <dcavalca@fedoraproject.org> - 1.23.0-2
- Gate out tests on ARM for now

* Mon Jan 17 2022 Davide Cavalca <dcavalca@fedoraproject.org> - 1.23.0-1
- Initial import; Fixes: RHBZ#2041108
## END: Generated by rpmautospec