File rebar3.spec of Package rebar3

%define bname rebar3
Name: %bname
Version: 3.14.4
Release: 1
Summary: A sophisticated build-tool for Erlang projects that follows OTP principles
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/rebar/%bname
Source: %bname-%version.tar.xz
Source9: %name-rpmlintrc
#Patch0: %bname-%version-git.patch
BuildArch: noarch
Requires: erlang
Provides: erlang-%bname = %version-%release
Requires: update-alternatives
Conflicts: rebar

BuildRequires: rpm-macros-erlang >= 0.9.1 rpm-build-erlang >= 0.10.0
BuildRequires: rebar >= 2.6.1-7
BuildRequires: update-alternatives
BuildRequires: erlang-public_key-devel
BuildRequires: erlang-erlware_commons >= 1.4.0
BuildRequires: erlang-parse_trans >= 3.3.1
BuildRequires: erlang-bbmustache >= 1.10.0
BuildRequires: erlang-certifi >= 2.5.3
BuildRequires: erlang-providers >= 1.8.1
BuildRequires: erlang-providers-devel >= 1.8.1
BuildRequires: erlang-relx >= 4.3.0
BuildRequires: erlang-cf >= 0.3.1
BuildRequires: erlang-eunit_formatters >= 0.5.0
BuildRequires: erlang-cth_readable >= 1.4.8
BuildRequires: erlang-getopt >= 1.0.1
BuildRequires: erlang-ssl_verify_fun >= 1.1.6
BuildRequires: erlang-termcap

%description
Rebar3 is an Erlang build tool that makes it easy to compile and test Erlang
applications, port drivers and releases. %bname is a self-contained Erlang script,
so it's easy to distribute or even embed directly in a project. Where possible,
%bname uses standard Erlang/OTP conventions for project structures, thus
minimizing the amount of build configuration work. %bname also provides dependency
management, enabling application writers to easily re-use common libraries from a
variety of locations (git, hg, etc).


%package static
Summary: A sophisticated build-tool for Erlang projects that follows OTP principles
Group: Development/Tools/Other
Provides: %name-bundle = %version-%release
Requires: erlang
Requires: erlang-otp-base erlang-syntax_tools
Requires: erlang_app(asn1) erlang_app(crypto) erlang_app(ssl) erlang_app(public_key)

%description static
%bname is an Erlang build tool that makes it easy to compile and test Erlang
applications, port drivers and releases. %bname is a self-contained Erlang script,
so it's easy to distribute or even embed directly in a project. Where possible,
%bname uses standard Erlang/OTP conventions for project structures, thus
minimizing the amount of build configuration work. %bname also provides dependency
management, enabling application writers to easily re-use common libraries from a
variety of locations (git, hg, etc).


%package relx
Summary: relx support for rebar
Group: Development/Tools/Other
Requires: %name = %version-%release

%description relx
%summary.


%prep
%setup -q -n %bname-%version
#patch0 -p1


%build
erl -noinput -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config",
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
                          lists:foldl(fun({K, _} = V, A) -> lists:keystore(K, 1, A, V) end,
                                      lists:foldl(fun(DK, DA) -> lists:keydelete(DK, 1, DA) end, L,
                                                  [edoc_opts, deps, overrides, profiles, post_hooks]),
                                      [{edoc_opts, [{preprocess, true}|proplists:get_value(edoc_opts, L, [])]},
                                       {escript_shebang, "#!%_bindir/escript\n"},
                                       {escript_emu_args, proplists:get_value(escript_emu_args, L, "")},
                                       {escript_incl_apps,
                                        [bbmustache, certifi, cf, cth_readable, eunit_formatters, erlware_commons,
                                         getopt, providers, relx, ssl_verify_fun, parse_trans, termcap]},
                                       {escript_comment, ""}])),
                [raw]),
init:stop().'

ERL_COMPILER_OPTIONS="[inline,verbose]" rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
rebar %{?_smp_mflags} -C %bname.rebar.config escriptize -v
rebar %{?_smp_mflags} -C %bname.rebar.config doc -v

cat > %bname.escript <<__EOF__
#!/usr/bin/escript
%%%%
main(A) -> rebar3:main(A).
__EOF__


%install
install -pD -m 0755 %bname %buildroot%_bindir/%bname-bundle
ln -sf %bname-bundle %buildroot%_bindir/%bname-static
for d in ebin priv/templates; do
	install -d -m 0755 %buildroot%_otplibdir/rebar-%version/$d
	install -p -m 0644 $d/* %buildroot%_otplibdir/rebar-%version/$d/
done
install -pD %bname.escript -m 0755 %buildroot%_bindir/%bname-otp
install -d -m 0755 %buildroot%_otplibdir/rebar-%version/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/rebar-%version/doc/
install -d -m 0755 %buildroot%_docdir/%name
ln -sf %_otplibdir/rebar-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 CONTRIBUTING* README* THANKS* %buildroot%_docdir/%name/

# alternatives
install -d -m 0755 %buildroot%_sysconfdir/alternatives
touch %buildroot%_sysconfdir/alternatives/%bname
ln -sf %_sysconfdir/alternatives/%bname %buildroot%_bindir/%bname

%add_erlang_req_app_skiplist relx


%post
%_sbindir/update-alternatives --quiet --install %_bindir/%bname %bname %_bindir/%bname-otp 10

%preun
[ "$1" != 0 ] || %_sbindir/update-alternatives --quiet --remove %bname %_bindir/%bname-otp


%post static
%_sbindir/update-alternatives --quiet --install %_bindir/%bname %bname %_bindir/%bname-bundle 5

%preun static
[ "$1" != 0 ] || %_sbindir/update-alternatives --quiet --remove %bname %_bindir/%bname-bundle


%if 0
%check
./rebar3 ct
%endif


%files
%defattr(-,root,root)
%doc %_docdir/%name
%_bindir/%bname-otp
%_otplibdir/*
%ghost %_bindir/%bname
%ghost %_sysconfdir/alternatives/*
%exclude %_otplibdir/rebar-*/ebin/rebar_relx*
%exclude %_otplibdir/rebar-*/ebin/rebar_prv_rel*
%exclude %_otplibdir/rebar-*/ebin/rebar_prv_tar.*


%files relx
%defattr(-,root,root)
%_otplibdir/rebar-*/ebin/rebar_relx.*
%_otplibdir/rebar-*/ebin/rebar_prv_rel*
%_otplibdir/rebar-*/ebin/rebar_prv_tar.*


%files static
%defattr(-,root,root)
%doc CONTRIBUTING* README* THANKS*
%_bindir/%bname-bundle
%_bindir/%bname-static
%ghost %_bindir/%bname
%ghost %_sysconfdir/alternatives/*


%changelog
* Thu Feb 25 2021 Led <ledest@gmail.com> 3.14.4-1
- 3.14.4

* Tue Feb 23 2021 Led <ledest@gmail.com> 3.14.3-1
- 3.14.3

* Tue Feb 23 2021 Led <ledest@gmail.com> 3.14.2-1
- 3.14.2
- remove patches:
  + 0001-Prevent-crash-when-function-deemed-undefined-has-no-.patch
  + 0002-use-aws-cp-when-copying-escript-to-s3.patch
  + 0003-Fix-lock-file-not-being-generated-when-no-deps-are-p.patch
  + 0005-Fix-output-issue-bug-when-dialyzer.warnings.unknown-.patch
  + rebar3-3.14.0-doc.patch

* Mon Sep 21 2020 Led <ledest@gmail.com> 3.14.1-2
- add patches:
  + 0003-Fix-lock-file-not-being-generated-when-no-deps-are-p.patch
  + 0005-Fix-output-issue-bug-when-dialyzer.warnings.unknown-.patch

* Thu Sep 10 2020 Led <ledest@gmail.com> 3.14.1-1
- 3.14.1
- remove patches:
  + 0001-Fix-Recursive-Behaviour-Lookup-Regression.patch
  + 0002-require-the-app-name-as-the-last-part-of-git_subdir-.patch
  + 0003-git-lock-abort-if-version-is-not-equal-to-or-greater.patch
- add patches:
  + 0001-Prevent-crash-when-function-deemed-undefined-has-no-.patch
  + 0002-use-aws-cp-when-copying-escript-to-s3.patch

* Thu Sep 03 2020 Led <ledest@gmail.com> 3.14.0-2
- add patches:
  + 0002-require-the-app-name-as-the-last-part-of-git_subdir-.patch
  + 0003-git-lock-abort-if-version-is-not-equal-to-or-greater.patch

* Wed Sep 02 2020 Led <ledest@gmail.com> 3.14.0-1
- 3.14.0
- git 992d8ba
- add patches:
  + 0001-Fix-Recursive-Behaviour-Lookup-Regression.patch
  + rebar3-3.14.0-doc.patch
- update BuildRequires

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.13.2-1
- 3.13.2
- update BuildRequires

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.12.0-1
- 3.12.0
- update BuildRequires

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.11.1-1
- 3.11.1
- update BuildRequires

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.10.0-1
- 3.10.0
- update BuildRequires

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.9.1-1
- 3.9.1
- update BuildRequires
- update escript_incl_apps

* Mon Aug 24 2020 Led <ledest@gmail.com> 3.8.0-1
- 3.8.0
- update BuildRequires

* Sun Aug 23 2020 Led <ledest@gmail.com> 3.7.4-3
- update escript_incl_apps

* Sun Aug 23 2020 Led <ledest@gmail.com> 3.7.4-2
- update escript_incl_apps

* Sun Aug 23 2020 Led <ledest@gmail.com> 3.7.4-1
- 3.7.4
- remove patches:
  + 0001-Fix-sample-config-punctuation.patch
  + 0002-Fix-misleading-config-in-app-template.patch
- update BuildRequires

* Sun Aug 23 2020 Led <ledest@gmail.com> 3.6.2-3
- update Requires of rebar3-static

* Fri Sep 28 2018 Led <ledest@gmail.com> 3.6.2-2
- add patches:
  + 0001-Fix-sample-config-punctuation.patch
  + 0002-Fix-misleading-config-in-app-template.patch

* Fri Sep 28 2018 Led <ledest@gmail.com> 3.6.2-1
- 3.6.2

* Tue Aug 14 2018 Led <ledest@gmail.com> 3.6.1-1
- 3.6.1

* Thu Dec 07 2017 Led <ledest@gmail.com> 3.4.7-1
- 3.4.7

* Wed Sep 13 2017 Led <ledest@gmail.com> 3.4.4-1
- 3.4.4

* Sun Jul 16 2017 Led <ledest@gmail.com> 3.4.2-1
- 3.4.2

* Tue Jun 06 2017 Led <ledest@gmail.com> 3.4.1-1
- 3.4.1
- remove patches:
  + 0001-Typo-seperate-separate.patch

* Sun May 21 2017 Led <ledest@gmail.com> 3.3.6-3
- revert BuildRequires

* Sat May 20 2017 Led <ledest@gmail.com> 3.3.6-2
- update BuildRequires
- update config

* Thu Mar 30 2017 Led <ledest@gmail.com> 3.3.6-1
- 3.3.6
- add patches:
  + 0001-Typo-seperate-separate.patch

* Fri Mar 10 2017 Led <ledest@gmail.com> 3.3.5-2
- update BuildRequires

* Tue Feb 07 2017 Led <ledest@gmail.com> 3.3.5-1
- 3.3.5

* Tue Dec 27 2016 Led <ledest@gmail.com> 3.3.4-1
- 3.3.4

* Mon Dec 12 2016 Led <ledest@gmail.com> 3.3.3-1
- 3.3.3
- remove patches:
  + rebar3-3.1.0-doc.patch

* Sun Oct 30 2016 Led <ledest@gmail.com> 3.3.2-1
- 3.3.2

* Mon Sep 12 2016 Led <ledest@gmail.com> 3.3.1-1
- 3.3.1

* Fri Aug 12 2016 Led <ledest@gmail.com> 3.2.0-1
- 3.2.0

* Fri Jul 15 2016 Led <ledest@gmail.com> 3.1.0-3
- fix BuildRequires

* Sun Apr 10 2016 Led <ledest@gmail.com> 3.1.0-2
- add conflicts to rebar

* Sun Apr 10 2016 Led <ledest@gmail.com> 3.1.0-1
- initial build
openSUSE Build Service is sponsored by