Blob Blame History Raw
%{?scl:%scl_package mod_md}

Name:           %{?scl:%scl_prefix}mod_md
Version:        2.0.8
Release:        1%{?dist}
Summary:        Certificate provisioning using ACME for the Apache HTTP Server
License:        ASL 2.0
URL:            https://icing.github.io/mod_md/
Source0:        https://github.com/icing/mod_md/releases/download/v%{version}/mod_md-%{version}.tar.gz
# documentation
Source10:       a2md.xml
Patch1:         mod_md-2.0.8-state_dir.patch
Patch2:         mod_md-2.0.8-duptrim-seg.patch
BuildRequires:  gcc
BuildRequires:  pkgconfig, %{?scl:%scl_prefix}httpd-devel >= 0:2.4.34-16, openssl-devel >= 1.1.0
BuildRequires:  jansson-devel, %{?scl:%scl_prefix}libcurl-devel, %{?scl:%scl_prefix}libnghttp2-devel
BuildRequires:  xmlto
Requires:       %{?scl:%scl_prefix}httpd-mmn = %{_httpd24_mmn}, %{?scl:%scl_prefix}mod_ssl >= 1:2.4.34-16
Conflicts:      %{?scl:%scl_prefix}httpd < 2.4.34-16
Epoch:          1

%description
This module manages common properties of domains for one or more
virtual hosts. Specifically it can use the ACME protocol to automate
certificate provisioning.  Certificates will be configured for managed
domains and their virtual hosts automatically, including at renewal.

%prep
%if 0%{?scl:1}
export LD_LIBRARY_PATH=%{_libdir}:$LD_LIBRARY_PATH
%endif

%setup -q %{?scl:-n %{pkg_name}-%{version}}
%patch1 -p1 -b .state_dir
%patch2 -p1 -b .dup_trim

xmlto man $RPM_SOURCE_DIR/a2md.xml

%build
%if 0%{?scl:1}
export APXS=%{_httpd24_apxs}
export LIBCURL=%{_prefix}
export LD_LIBRARY_PATH=%{_libdir}:$LD_LIBRARY_PATH
%else
export APXS=%{_httpd_apxs}
export LIBCURL=%{_prefix}
%endif

./configure \
        --prefix=%{_sysconfdir}/httpd \
        --exec-prefix=%{_prefix} \
        --bindir=%{_bindir} \
        --sbindir=%{_sbindir} \
        --mandir=%{_mandir} \
        --libdir=%{_libdir} \
        --with-apxs=$APXS \
        --with-curl=$LIBCURL

# remove rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%make_build V=1

%check
%make_build check

%install
%make_install
rm -rf %{buildroot}%{_sysconfdir}/httpd/share/doc/

# remove links and rename SO files
rm -f %{buildroot}%{_httpd24_moddir}/mod_md.so
mv %{buildroot}%{_httpd24_moddir}/mod_md.so.0.0.0 %{buildroot}%{_httpd24_moddir}/mod_md.so

# create configuration
mkdir -p %{buildroot}%{_httpd24_modconfdir}
echo "LoadModule md_module modules/mod_md.so" > %{buildroot}%{_httpd24_modconfdir}/01-md.conf

# Install man pages
install -d $RPM_BUILD_ROOT%{_mandir}/man1
install -m 644 -p a2md.1 $RPM_BUILD_ROOT%{_mandir}/man1

%files
%doc README.md ChangeLog AUTHORS
%license LICENSE
%config(noreplace) %{_httpd24_modconfdir}/01-md.conf
%{_httpd24_moddir}/mod_md.so
%{_bindir}/a2md
%{_mandir}/man1/*

%changelog
* Tue Feb 04 2020 Lubos Uhliarik <luhliari@redhat.com> - 1:2.0.8-1
- Initial import
- Resolves: #1788976 - RFE: updated collection for httpd 2.4