curl/curl.spec

328 lines
9.5 KiB
RPMSpec
Raw Normal View History

2018-05-08 17:20:01 +03:00
%define major 4
%define libname %mklibname %{name} %{major}
2019-12-26 10:48:37 +03:00
%define libname_libressl %mklibname %{name}-libressl %{major}
2018-05-08 17:20:01 +03:00
%define devname %mklibname %{name} -d
2019-12-26 10:48:37 +03:00
%define devname_libressl %mklibname %{name}-libressl -d
2018-05-08 17:20:01 +03:00
%define ssh2 0
2012-02-01 15:13:20 +04:00
# Using libressl allows to support GOST TLS without pain
# test: curl https://www.cryptopro.ru:4444/test/tls-cli.asp
# Building a separate curl with libressl
%bcond_without libressl
%if %{with libressl}
%define ssl_list openssl libressl
%else
%define ssl_list openssl
%endif
%define shell_begin %{expand:for SSL in %%{ssl_list} ; \
do \
mkdir -p "$SSL" ;\
pushd "$SSL"}
%define shell_end popd; done
2012-02-01 15:13:20 +04:00
Summary: Gets a file from a FTP, GOPHER or HTTP server
Name: curl
2020-01-29 19:25:46 +00:00
Version: 7.68.0
Release: 7
2018-05-08 17:20:01 +03:00
Epoch: 1
2012-02-01 15:13:20 +04:00
License: BSD-like
Group: Networking/Other
2016-07-12 22:39:31 +03:00
Url: https://curl.haxx.se
Source0: https://curl.haxx.se/download/%{name}-%{version}.tar.xz
Source1: https://curl.haxx.se/download/%{name}-%{version}.tar.xz.asc
Patch0: %{name}-7.59.0-multilib.patch
Patch2: %{name}-7.59.0-debug.patch
Patch3: %{name}-libressl.patch
2015-02-03 01:06:31 +10:00
BuildRequires: groff
2013-09-05 15:44:01 +04:00
BuildRequires: stunnel
BuildRequires: openldap-devel
BuildRequires: pkgconfig(krb5)
2015-02-03 01:06:31 +10:00
BuildRequires: pkgconfig(libcares)
#BuildRequires: pkgconfig(libidn)
BuildRequires: pkgconfig(libidn2)
2018-05-08 17:20:01 +03:00
%if 0%{?ssh2}
2013-01-16 20:45:59 +04:00
BuildRequires: pkgconfig(libssh2)
2018-05-08 17:20:01 +03:00
%else
BuildRequires: pkgconfig(libssh)
%endif
%if %{with libressl}
BuildRequires: pkgconfig(libressl)
%endif
2015-02-03 01:06:31 +10:00
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
# TODO: Package and enable libpsl support
2017-01-26 16:35:43 +03:00
Requires: %{libname} = %{EVRD}
Provides: webfetch = %{EVRD}
2012-02-01 15:13:20 +04:00
%description
curl is a client to get documents/files from servers, using any of the
supported protocols. The command is designed to work without user interaction
or any kind of interactivity.
It offers a busload of useful tricks like proxy support, user authentication,
ftp upload, HTTP post, file transfer resume and more.
2012-02-01 15:13:20 +04:00
This version is compiled with SSL (https) support.
2015-02-03 01:06:31 +10:00
%files
%doc COPYING
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
2015-02-03 01:06:31 +10:00
#----------------------------------------------------------------------------
%if %{with libressl}
%package -n curl-libressl
Summary: Gets a file from a FTP, GOPHER or HTTP server
Group: Networking/Other
Provides: curl-gost = %{EVRD}
%description -n curl-libressl
curl is a client to get documents/files from servers, using any of the
supported protocols. The command is designed to work without user interaction
or any kind of interactivity.
It offers a busload of useful tricks like proxy support, user authentication,
ftp upload, HTTP post, file transfer resume and more.
This version is compiled with LibreSSL and is capable of GOST TLS.
%files -n curl-libressl
%{_bindir}/curl-libressl
%{_bindir}/curl-gost
%endif
2015-02-03 01:06:31 +10:00
#----------------------------------------------------------------------------
2012-02-01 15:13:20 +04:00
%package -n %{libname}
Summary: A library of functions for file transfer
Group: Networking/Other
Requires: rootcerts
2012-02-01 15:13:20 +04:00
%description -n %{libname}
libcurl is a library of functions for sending and receiving files through
various protocols, including http and ftp.
You should install this package if you plan to use any applications that
use libcurl.
2015-02-03 01:06:31 +10:00
%files -n %{libname}
%doc COPYING
2015-02-03 01:06:31 +10:00
%{_libdir}/libcurl.so.%{major}*
#----------------------------------------------------------------------------
%if %{with libressl}
%package -n %{libname_libressl}
Summary: A library of functions for file transfer
Group: Networking/Other
Requires: rootcerts
%description -n %{libname_libressl}
libcurl is a library of functions for sending and receiving files through
various protocols, including http and ftp.
You should install this package if you plan to use any applications that
use libcurl.
libcurl-libressl is linked with LibreSSL and is capable of GOST TLS.
%files -n %{libname_libressl}
%doc COPYING
%{_libdir}/libcurl-libressl.so.%{major}*
%endif
2015-02-03 01:06:31 +10:00
#----------------------------------------------------------------------------
2013-09-05 15:44:01 +04:00
%package -n %{devname}
2012-02-01 15:13:20 +04:00
Summary: Header files and static libraries for libcurl
Group: Development/C
2012-07-04 18:06:35 +04:00
Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
2012-02-01 15:13:20 +04:00
2013-09-05 15:44:01 +04:00
%description -n %{devname}
2012-02-01 15:13:20 +04:00
libcurl is a library of functions for sending and receiving files through
various protocols, including http and ftp.
You should install this package if you wish to develop applications that
use libcurl.
2015-02-03 01:06:31 +10:00
%files -n %{devname}
%docdir docs/
2016-11-03 15:29:38 +03:00
%doc docs/BUGS docs/KNOWN_BUGS docs/FAQ CHANGES
%doc docs/FEATURES docs/RESOURCES docs/TODO docs/THANKS
%{_bindir}/%{name}-config
2015-02-03 01:06:31 +10:00
%{_libdir}/libcurl.so
%{_includedir}/%{name}
%exclude %{_includedir}/curl-libressl
%{_libdir}/pkgconfig/libcurl.pc
2015-02-03 01:06:31 +10:00
%{_datadir}/aclocal/*.m4
%{_mandir}/man1/%{name}-config.1*
2015-02-03 01:06:31 +10:00
%{_mandir}/man3/*
#----------------------------------------------------------------------------
%if %{with libressl}
%package -n %{devname_libressl}
Summary: Header files and devel libraries for libcurl with LibreSSL
Group: Development/C
Requires: %{libname_libressl} = %{EVRD}
Provides: %{name}-libressl-devel = %{EVRD}
Provides: %{name}-gost-devel = %{EVRD}
%description -n %{devname_libressl}
libcurl is a library of functions for sending and receiving files through
various protocols, including http and ftp.
You should install this package if you wish to develop applications that
use libcurl linked with LibreSSL and capable of GOST.
%files -n %{devname_libressl}
%{_includedir}/curl-libressl
%{_libdir}/pkgconfig/libcurl-libressl.pc
%{_libdir}/libcurl-libressl.so
%endif
2015-02-03 01:06:31 +10:00
#----------------------------------------------------------------------------
2012-02-01 15:13:20 +04:00
%package examples
Summary: Example files for %{name} development
Group: Development/C
2015-02-03 01:06:31 +10:00
Requires: %{name}-devel = %{EVRD}
2013-01-16 20:45:59 +04:00
BuildArch: noarch
2012-02-01 15:13:20 +04:00
%description examples
Example files for %{name} development.
2015-02-03 01:06:31 +10:00
%files examples
%doc docs/examples
#----------------------------------------------------------------------------
2012-02-01 15:13:20 +04:00
%prep
%setup -q
2013-09-05 15:44:01 +04:00
%apply_patches
regexp="$(echo %{ssl_list} | sed -e 's, ,|,g')"
for i in %{ssl_list}; do
mkdir -p "$i"
cp -r $(ls -1v | grep -vE "$regexp") "$i"/
done
rm -fr $(ls -1v | grep -vE "${regexp}|docs|COPYING|CHANGES")
2012-02-01 15:13:20 +04:00
%build
2020-01-13 14:41:59 +03:00
%setup_compile_flags
%shell_begin
ADD_CONF_OPTS=""
case "$SSL" in
libressl )
new_libname=libcurl-libressl
sed -i configure.ac \
-e 's,openssl.pc,libressl.pc,g' \
-e 's,PKGCONFIG(openssl,PKGCONFIG(libressl,g' \
-e 's,$PREFIX_OPENSSL/lib$libsuff,$PREFIX_OPENSSL/lib,g'
# $LIBS apply to libcurl.so only, so there will not be overlinking
# even if to add -lxxx here
export LIBS="$(pkg-config --cflags-only-I --libs-only-L libressl)"
export CFLAGS="$LIBS"
export PREFIX_OPENSSL=/opt/libressl
# It will be /usr/include/curl-libressl/curl
# to allow '#include <curl/xxx.h> to work with -I/usr/include/curl-libressl
# TLS-SRP: https://wiki.freebsd.org/LibreSSL
ADD_CONF_OPTS="\
--includedir=%{_includedir}/curl-libressl \
--disable-tls-srp \
--with-ssl=off \
"
;;
openssl )
new_libname=libcurl
2020-01-29 19:20:07 +00:00
patch -p1 -R < %{PATCH3}
;;
esac
2012-02-01 15:13:20 +04:00
autoreconf -fiv
sed -i configure \
-e "s,\$libname,${new_libname},g" \
-e "s,\${libname},${new_libname},g"
2012-02-01 15:13:20 +04:00
2020-01-04 03:09:28 +03:00
%configure \
2013-01-16 20:45:59 +04:00
--disable-static \
2012-02-01 15:13:20 +04:00
--with-ssl \
--without-gnutls \
--with-zlib \
2013-01-16 20:45:59 +04:00
--with-lber-lib=lber \
--with-libidn2 \
2018-05-08 17:20:01 +03:00
%if 0%{?ssh2}
2012-02-01 15:13:20 +04:00
--with-ssh2 \
2018-05-08 17:20:01 +03:00
%else
--with-libssh \
%endif
2012-02-01 15:13:20 +04:00
--with-random \
--enable-hidden-symbols \
--enable-optimize \
--enable-nonblocking \
--enable-thread \
--enable-crypto-auth \
--enable-libgcc \
--enable-ldaps \
--enable-ipv6 \
2019-12-26 08:45:43 +03:00
--with-ca-bundle=%{_openssldir}/certs/ca-bundle.crt \
2012-02-01 15:13:20 +04:00
--with-gssapi=%{_prefix} \
--enable-ares \
--without-libpsl \
$ADD_CONF_OPTS --
2012-02-01 15:13:20 +04:00
2020-01-13 14:41:59 +03:00
%make
2012-02-01 15:13:20 +04:00
2013-09-05 15:44:01 +04:00
# we don't want them in curl-examples:
rm -r docs/examples/.deps ||:
%shell_end
2012-02-01 15:13:20 +04:00
%install
%shell_begin
case "$SSL" in
openssl )
2020-01-13 14:41:59 +03:00
%makeinstall_std
;;
libressl )
tmp="$(mktemp -d -p $(pwd))"
mkdir -p "$tmp"
make DESTDIR="${tmp}" install
mv -v ${tmp}%{_bindir}/curl %{buildroot}%{_bindir}/curl-libressl
mv -v ${tmp}%{_libdir}/libcurl-libressl* %{buildroot}%{_libdir}
mv -v ${tmp}%{_includedir}/curl-libressl %{buildroot}%{_includedir}/
2019-12-26 08:38:08 +03:00
cat ${tmp}%{_libdir}/pkgconfig/libcurl.pc | \
sed -r \
-e 's,^Name:.+,Name: libcurl-libressl,g' \
-e 's,-lcurl,-lcurl-libressl,g' \
-e "s,@LIBRESSL_LIBS@,$(pkg-config --libs-only-L libressl),g" \
-e "s,@LIBRESSL_LIBS_PRIVATE@,,g" \
-e "s,@LIBRESSL_CFLAGS@,$(pkg-config --cflags-only-I libressl),g" \
> %{buildroot}%{_libdir}/pkgconfig/libcurl-libressl.pc
#rm -fr "$tmp"
;;
* ) echo 'Unknown $SSL' && exit 1 ;;
esac
2012-02-01 15:13:20 +04:00
# [july 2008] HACK. to be replaced by a real fix
2013-01-16 20:45:59 +04:00
sed -i -e 's!-Wl,--as-needed!!' -e 's!-Wl,--no-undefined!!' %{buildroot}%{_bindir}/%{name}-config
sed -i -e 's!-Wl,--as-needed!!' -e 's!-Wl,--no-undefined!!' %{buildroot}%{_libdir}/pkgconfig/*.pc
2012-02-01 15:13:20 +04:00
# (tpg) use rootcerts's certificates #35917
find %{buildroot} -name ca-bundle.crt -exec rm -f '{}' \;
# we don't package mk-ca-bundle so we don't need man for it
2013-01-16 20:45:59 +04:00
rm -f %{buildroot}%{_mandir}/man1/mk-ca-bundle.1*
%shell_end
%if %{with libressl}
( cd %{buildroot}%{_bindir} ; ln -s curl-libressl curl-gost )
%endif
%check
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
%if %{with libressl}
readelf -a %{buildroot}%{_bindir}/curl-libressl | grep NEEDED | grep -q libcurl-libressl
readelf -a %{buildroot}%{_libdir}/libcurl-libressl.so | grep SONAME | grep -q libcurl-libressl
! readelf -a %{buildroot}%{_libdir}/libcurl.so | grep SONAME | grep -q libcurl-libressl
# This test will not fail if there is no connection with internet
# --insecure to ignore missing SSL certificate
if %{buildroot}%{_bindir}/curl-libressl --insecure \
"https://www.cryptopro.ru:4444/test/tls-cli.asp" 2>&1 | \
grep -q ':unsupported algorithm$' ;
then
echo "GOST is not supported"
exit 1
fi
%endif