Adjust and install openssl-config

This commit is contained in:
Mikhail Novosyolov 2018-12-23 10:28:27 +03:00
parent 814e9aac6f
commit 78b41e4951
2 changed files with 45 additions and 30 deletions

View file

@ -3,11 +3,11 @@
# openssl-config # openssl-config
# provides configuration info for openssl. # provides configuration info for openssl.
version=%version version="@VERSION@"
openssldir=%openssldir openssldir="@OPENSSLDIR@"
cppflags= cppflags="@CPPFLAGS@"
cflags= cflags="@CFLAGS@"
ldflags= ldflags="@LDFLAGS@"
libs="-lcrypto -lssl" libs="-lcrypto -lssl"
usage() usage()
@ -36,22 +36,22 @@ fi
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
--openssldir) --openssldir)
echo ${openssldir} echo "${openssldir}"
;; ;;
--cflags) --cflags)
echo ${cflags} echo "${cflags}"
;; ;;
--cppflags) --cppflags)
echo ${cppflags} echo "${cppflags}"
;; ;;
--libs) --libs)
echo ${libs} echo "${libs}"
;; ;;
--ldflags) --ldflags)
echo ${ldflags} echo "${ldflags}"
;; ;;
--version) --version)
echo ${version} echo "${version}"
exit 0 exit 0
;; ;;
--help) --help)

View file

@ -18,10 +18,12 @@
%define with_krb5 %{?_with_krb5:1}%{!?_with_krb5:0} %define with_krb5 %{?_with_krb5:1}%{!?_with_krb5:0}
%define openssldir %{_sysconfdir}/pki/tls
Summary: Secure Sockets Layer communications libs & utils Summary: Secure Sockets Layer communications libs & utils
Name: openssl Name: openssl
Version: 1.0.2q Version: 1.0.2q
Release: 1 Release: 2
License: BSD-like License: BSD-like
Group: System/Libraries Group: System/Libraries
Url: https://www.openssl.org Url: https://www.openssl.org
@ -30,6 +32,7 @@ Source1: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz.asc
Source2: Makefile.certificate Source2: Makefile.certificate
Source3: make-dummy-cert Source3: make-dummy-cert
Source4: openssl-thread-test.c Source4: openssl-thread-test.c
Source5: openssl-config
# Based on https://github.com/gost-engine/engine # Based on https://github.com/gost-engine/engine
# Never remove gost-engine patches # Never remove gost-engine patches
Patch0: openssl-1.0.2l-gost-engine.patch Patch0: openssl-1.0.2l-gost-engine.patch
@ -73,15 +76,15 @@ RSA and SSL.
%dir %{_sysconfdir}/pki %dir %{_sysconfdir}/pki
%dir %{_sysconfdir}/pki/CA %dir %{_sysconfdir}/pki/CA
%dir %{_sysconfdir}/pki/CA/private %dir %{_sysconfdir}/pki/CA/private
%dir %{_sysconfdir}/pki/tls %dir %{openssldir}
%dir %{_sysconfdir}/pki/tls/certs %dir %{openssldir}/certs
%dir %{_sysconfdir}/pki/tls/misc %dir %{openssldir}/misc
%dir %{_sysconfdir}/pki/tls/private %dir %{openssldir}/private
%dir %{_sysconfdir}/pki/tls/rootcerts %dir %{openssldir}/rootcerts
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pki/tls/openssl.cnf %attr(0644,root,root) %config(noreplace) %{openssldir}/openssl.cnf
%attr(0755,root,root) %{_sysconfdir}/pki/tls/certs/make-dummy-cert %attr(0755,root,root) %{openssldir}/certs/make-dummy-cert
%attr(0644,root,root) %{_sysconfdir}/pki/tls/certs/Makefile %attr(0644,root,root) %{openssldir}/certs/Makefile
%attr(0755,root,root) %{_sysconfdir}/pki/tls/misc/* %attr(0755,root,root) %{openssldir}/misc/*
%attr(0755,root,root) %{_bindir}/* %attr(0755,root,root) %{_bindir}/*
%attr(0644,root,root) %{_mandir}/man[157]/* %attr(0644,root,root) %{_mandir}/man[157]/*
@ -259,7 +262,7 @@ sslarch=linux-generic32
# usable on all platforms. The Configure script already knows to use -fPIC and # usable on all platforms. The Configure script already knows to use -fPIC and
# RPM_OPT_FLAGS, so we can skip specifiying them here. # RPM_OPT_FLAGS, so we can skip specifiying them here.
./Configure \ ./Configure \
--openssldir=%{_sysconfdir}/pki/tls ${sslflags} \ --openssldir=%{openssldir} ${sslflags} \
--enginesdir=%{_libdir}/openssl-%{major}/engines \ --enginesdir=%{_libdir}/openssl-%{major}/engines \
--prefix=%{_prefix} --libdir=%{_lib}/ %{?_with_krb5:--with-krb5-flavor=MIT -I%{_prefix}/kerberos/include -L%{_prefix}/kerberos/%{_lib}} \ --prefix=%{_prefix} --libdir=%{_lib}/ %{?_with_krb5:--with-krb5-flavor=MIT -I%{_prefix}/kerberos/include -L%{_prefix}/kerberos/%{_lib}} \
zlib no-idea no-rc5 enable-camellia enable-seed enable-tlsext enable-rfc3779 enable-cms sctp shared ${sslarch} zlib no-idea no-rc5 enable-camellia enable-seed enable-tlsext enable-rfc3779 enable-cms sctp shared ${sslarch}
@ -303,16 +306,16 @@ install -d %{buildroot}%{_libdir}/openssl-%{major}
mv %{buildroot}%{_libdir}/engines %{buildroot}%{_libdir}/openssl-%{major}/engines mv %{buildroot}%{_libdir}/engines %{buildroot}%{_libdir}/openssl-%{major}/engines
# make the rootcerts dir # make the rootcerts dir
install -d %{buildroot}%{_sysconfdir}/pki/tls/rootcerts install -d %{buildroot}%{openssldir}/rootcerts
# Install a makefile for generating keys and self-signed certs, and a script # Install a makefile for generating keys and self-signed certs, and a script
# for generating them on the fly. # for generating them on the fly.
install -d %{buildroot}%{_sysconfdir}/pki/tls/certs install -d %{buildroot}%{openssldir}/certs
install -m0644 Makefile.certificate %{buildroot}%{_sysconfdir}/pki/tls/certs/Makefile install -m0644 Makefile.certificate %{buildroot}%{openssldir}/certs/Makefile
install -m0755 make-dummy-cert %{buildroot}%{_sysconfdir}/pki/tls/certs/make-dummy-cert install -m0755 make-dummy-cert %{buildroot}%{openssldir}/certs/make-dummy-cert
# Pick a CA script. # Pick a CA script.
mv %{buildroot}%{_sysconfdir}/pki/tls/misc/CA.sh %{buildroot}%{_sysconfdir}/pki/tls/misc/CA mv %{buildroot}%{openssldir}/misc/CA.sh %{buildroot}%{openssldir}/misc/CA
install -d %{buildroot}%{_sysconfdir}/pki/CA install -d %{buildroot}%{_sysconfdir}/pki/CA
install -d %{buildroot}%{_sysconfdir}/pki/CA/private install -d %{buildroot}%{_sysconfdir}/pki/CA/private
@ -377,6 +380,18 @@ pushd %{buildroot}%{_libdir}/pkgconfig
popd popd
# adjust ssldir # adjust ssldir
perl -pi -e "s|^CATOP=.*|CATOP=%{_sysconfdir}/pki/tls|g" %{buildroot}%{_sysconfdir}/pki/tls/misc/CA perl -pi -e "s|^CATOP=.*|CATOP=%{openssldir}|g" %{buildroot}%{openssldir}/misc/CA
perl -pi -e "s|^\\\$CATOP\=\".*|\\\$CATOP\=\"%{_sysconfdir}/pki/tls\";|g" %{buildroot}%{_sysconfdir}/pki/tls/misc/CA.pl perl -pi -e "s|^\\\$CATOP\=\".*|\\\$CATOP\=\"%{openssldir}\";|g" %{buildroot}%{openssldir}/misc/CA.pl
perl -pi -e "s|\./demoCA|%{_sysconfdir}/pki/tls|g" %{buildroot}%{_sysconfdir}/pki/tls/openssl.cnf perl -pi -e "s|\./demoCA|%{openssldir}|g" %{buildroot}%{openssldir}/openssl.cnf
# install openssl-config
install -m0755 %{SOURCE5} %{buildroot}/%{_bindir}/
# define values in openssl-config
sed -i %{buildroot}/%{_bindir}/openssl-config \
-e "s#@VERSION@#%{version}#g" \
-e "s#@OPENSSLDIR@#%{openssldir}#g" \
-e "s#@CPPFLAGS@#${CPPFLAGS}#g" \
-e "s#@CFLAGS@#${RPM_OPT_FLAGS}#g" \
-e "s#@LDFLAGS@#%{ldflags}#g"
# test openssl-config
[ "$(%{buildroot}/%{_bindir}/openssl-config --openssldir)" = '%{openssldir}' ]