File gun.spec of Package gun

%def_enable check

%define bname gun
Name: %bname
Version: 2.1.0
%define prerel %nil
Release: 1
Summary: Erlang HTTP client with support for HTTP/1.1, HTTP/2 and Websocket
License: ISC
Group: Development/Tools/Other
URL: https://github.com/ninenines/%bname
Source: %bname-%version%prerel.tar.xz
#Patch0: %bname-%version%prerel-git.patch
Patch1: 0001-gun_cookie-update-cookies-inplace-in-headers-if-poss.patch
Patch2: 0002-gun_http-put-transfer-encoding-and-content-length-in.patch
Patch3: 0003-gun_http-don-t-add-zero-content-length-to-headers-fo.patch
Patch4: 0004-rebar.config-fix-deps.patch
Patch5: 0005-.gitignore-add-rebar3-dirs.patch
Patch6: 0006-gun_pool-ignore-info-gun_tunnel_up-_-_-_-in-handle_c.patch
Patch11: %bname-2.1.0-map_get.patch
Patch12: %bname-2.1.0-stacktrace.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release
Requires: erlang >= 1:21

BuildRequires: erlang >= 1:21
BuildRequires: rpm-macros-erlang rpm-build-erlang
# docs
BuildRequires: asciidoc source-highlight
%if_enabled check
# check
BuildRequires: erlang-eunit >= 1:21
BuildRequires: epmd
BuildRequires: ct_run
BuildRequires: erlang-ct_helper
BuildRequires: erlang-ranch
BuildRequires: erlang-cowboy >= 2.9.0
%endif

%description
Gun aims to provide an easy to use client compatible with HTTP/1.1, HTTP/2 and
Websocket. Gun is always connected. It will maintain a permanent connection to
the server, reopening it as soon as the server closes it, saving time for the
requests that come in.
All connections are supervised automatically, allowing developers to focus on
writing their code without worrying.


%package doc
Summary: Documentation of %bname
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release
Conflicts: %name < 1.0.0-0.7

%description doc
Gun aims to provide an easy to use client compatible with HTTP/1.1, HTTP/2 and
Websocket. Gun is always connected. It will maintain a permanent connection to
the server, reopening it as soon as the server closes it, saving time for the
requests that come in.
All connections are supervised automatically, allowing developers to focus on
writing their code without worrying.
This package contains documentation of %bname.


%prep
%setup -q -n %bname-%version%prerel
#patch -p1 -P0
%patch -p1 -P1 -P2 -P3 -P4 -P5 -P6
%patch -p1 -P11 -P12
sed -i '/^test-build:/s/^/#/' Makefile


%build
make %{?_smp_mflags} DEPS= SKIP_DEPS=1 ERL_COMPILER_OPTIONS="[inline]" V=1 clean all
make %{?_smp_mflags} -f - <<"__EOF__"
MANUAL_HTML := $(patsubst %.asciidoc,%.html,$(wildcard doc/src/manual/*.asciidoc))

all: guide manual

manual: $(MANUAL_HTML)

guide: doc/src/guide/book.html

doc/src/guide/book.html:  $(wildcard doc/src/guide/*.asciidoc)
	asciidoc -d book -s doc/src/guide/book.asciidoc

$(MANUAL_HTML): %.html: %.asciidoc
	asciidoc -s $<
__EOF__


%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_docdir/%name/manual
install -p -m 0644 README.* %buildroot%_docdir/%name/README.md
install -p -m 0644 doc/src/manual/*.html %buildroot%_docdir/%name/manual/
install -p -m 0644 doc/src/guide/*.html %buildroot%_docdir/%name/


%if_enabled check
%check
make \
	DEPS= SKIP_DEPS=1 ERL_COMPILER_OPTIONS="[inline]" TEST_DEPS= \
	CT_SUITES="flow shutdown ws" \
	tests
%endif


%files
%defattr(-,root,root)
%_otplibdir/*


%files doc
%defattr(-,root,root)
%doc %_docdir/%name


%changelog
* Tue Nov 26 2024 Led <ledest@gmail.com> 2.1.0-1
- 2.1.0
- add patches:
  + 0001-gun_cookie-update-cookies-inplace-in-headers-if-poss.patch
  + 0002-gun_http-put-transfer-encoding-and-content-length-in.patch
  + 0003-gun_http-don-t-add-zero-content-length-to-headers-fo.patch
  + 0004-rebar.config-fix-deps.patch
  + 0005-.gitignore-add-rebar3-dirs.patch
  + 0006-gun_pool-ignore-info-gun_tunnel_up-_-_-_-in-handle_c.patch
  + gun-2.1.0-map_get.patch
  + gun-2.1.0-stacktrace.patch
- fix License
- update BuildRequires

* Sun Feb 04 2024 Led <ledest@gmail.com> 2.0.1-1
- 2.0.1
- git 48eefeb
- disable %%check

* Wed Jul 27 2022 Led <ledest@gmail.com> 1.3.3-3
- remove patches:
  + gun-1.1.0-otp_release.patch
- add patches:
  + gun-1.3.3-stacktrace.patch

* Fri Sep 18 2020 Led <ledest@gmail.com> 1.3.3-2
- fix build on Erlang/OTP 18

* Fri Sep 18 2020 Led <ledest@gmail.com> 1.3.3-1
- 1.3.3
- update BuildRequires

* Fri Sep 18 2020 Led <ledest@gmail.com> 1.2.0-2
- fix build on Erlang/OTP 18

* Fri Sep 18 2020 Led <ledest@gmail.com> 1.2.0-1
- 1.2.0
- update BuildRequires

* Fri Sep 27 2019 Led <ledest@gmail.com> 1.1.0-2
- add patches:
  + gun-1.1.0-otp_release.patch

* Fri Sep 27 2019 Led <ledest@gmail.com> 1.1.0-1
- 1.1.0

* Fri Sep 27 2019 Led <ledest@gmail.com> 1.0.0-3
- fix BuildRequires

* Fri Sep 27 2019 Led <ledest@gmail.com> 1.0.0-2
- fix build docs

* Fri Sep 27 2019 Led <ledest@gmail.com> 1.0.0-1
- 1.0.0

* Fri Jul 06 2019 Led <ledest@gmail.com> 1.0.0-0.7
- fix build on Erlang/OTP >= 21
- remove ignoring requires cow_http2, cow_sse, cow_ws
- move docs to separate subpackage

* Tue Jul 25 2017 Led <ledest@gmail.com> 1.0.0-0.6
- ignore requires cow_http2, cow_sse, cow_ws

* Mon Jul 24 2017 Led <ledest@gmail.com> 1.0.0-0.5
- fix build
- build docs

* Mon Jul 24 2017 Led <ledest@gmail.com> 1.0.0-0.4
- 1.0.0-pre.3
- git 02fa5f3

* Sun Jan 31 2016 Led <ledest@gmail.com> 1.0.0-0.3
- add epmd to BuildRequires

* Sun Jul 26 2015 Led <ledest@gmail.com> 1.0.0-0.2
- add patches:
  + gun-1.0.0-pre.1-git.patch
- replcae deprecated functions
- build with erlang.mk
- add %%check
- disable build docs
- update BuildRequires

* Sun Jul 26 2015 Led <ledest@gmail.com> 1.0.0-0.1
- initial build
openSUSE Build Service is sponsored by