mirror of
https://abf.rosa.ru/djam/libressl.git
synced 2025-02-23 16:12:53 +00:00
RPATH is not needed, remove it, simplify dependency generation
This commit is contained in:
parent
445ac1df85
commit
179f31e464
1 changed files with 28 additions and 72 deletions
100
libressl.spec
100
libressl.spec
|
@ -23,37 +23,24 @@
|
||||||
%{?!_compress:%define _compress /bin/true}
|
%{?!_compress:%define _compress /bin/true}
|
||||||
%{?!_extension:%define _extension .xz}
|
%{?!_extension:%define _extension .xz}
|
||||||
|
|
||||||
# Fallback to the old external dependency generator
|
|
||||||
# http://lists.rosalab.ru/pipermail/rosa-devel/2013-April/004702.html
|
|
||||||
# http://lists.rosalab.ru/pipermail/rosa-devel/2013-April/004703.html
|
|
||||||
# because there is no way to filter by filepath in the internal one
|
|
||||||
# TODO: avoid using external dep. gen.
|
|
||||||
%define _use_internal_dependency_generator 0
|
|
||||||
# Those libraries in /opt are not available without RPATH or ld.so.conf
|
|
||||||
%define _exclude_files_from_autoprov %{_libdir}
|
|
||||||
# We rename e.g. libtls.pc to libressl-tls.pc, make sure that we do not
|
# We rename e.g. libtls.pc to libressl-tls.pc, make sure that we do not
|
||||||
# get odd provides and break the repository if forgot to rename something
|
# get odd provides and break the repository if forgot to rename something
|
||||||
#define __noautoprov '.*openssl.*|pkgconfig\\(lib.*'
|
%define __noautoprov '.*openssl.*|pkgconfig\((libtls|libcrypro|libssl)\)'
|
||||||
%define _provides_exceptions '.*openssl.*|pkgconfig(lib.*'
|
# Ideas behind this package are the following:
|
||||||
# libressl-devel must not require devel(libxxx)
|
|
||||||
# because it has those devels inside himself
|
|
||||||
%define _requires_exceptions 'devel(lib.*'
|
|
||||||
# Ideas behind this dependency generation crap are the following:
|
|
||||||
# - libressl-devel must provide pkgconfig(libressl*)
|
# - libressl-devel must provide pkgconfig(libressl*)
|
||||||
# - libressl-devel must not provide pkgconfig(openssl),
|
# - libressl-devel must not provide pkgconfig(openssl),
|
||||||
# pkgconfig(libtls), pkgconfig(libcrypto), pkgconfig(libssl)
|
# pkgconfig(libtls), pkgconfig(libcrypto), pkgconfig(libssl)
|
||||||
# to prevent conflicts with OpenSSL
|
# to prevent conflicts with OpenSSL
|
||||||
# - libressl must not depend from separate library packages with
|
# - packages netcat-openbsd, ocspcheck, libressl are intended to
|
||||||
# libtls.so.*, libcrypto.so.*, libssl.so.*, instead it has
|
# comply with FHS, so libtls.so.*, libcrypto.so.* and libssl.so.*
|
||||||
# copies of those libraries in /opt/libressl/lib/ and has RPATH
|
# are packaged into separate packages, RPATHs are removed and
|
||||||
# - packages netcat-openbsd and ocspcheck are intended to be
|
# /usr/bin/* must depend from separate libs packages and will
|
||||||
# installable without installing libressl package with a lot of
|
# use /usr/lib(64)/lib*.so.*
|
||||||
# odd stuff; so libtls.so.*, libcrypto.so.* and libssl.so.* are
|
# - there are no per-library devel packages, only one libressl-devel
|
||||||
# packaged into separate packages, RPATHs are removed and nc
|
# with symlinks /opt/libressl/lib/*.so -> /usr/lib(64)/*.so.*
|
||||||
# and ocspcheck must depend from separate libs packages and will
|
# - not FHS-compilant /opt is used only for devel package to allow
|
||||||
# use /usr/lib(64)/lib*.so.* instead of /opt/libressl/lib/*.so.*
|
# coinstallability with OpenSSL devel packages
|
||||||
# - there are no per-library devel packages, only one libressl-devel.
|
# // mikhailnov, 03.12.2019
|
||||||
# // mikhailnov, 30.11.2019
|
|
||||||
|
|
||||||
%define libcrypto_sover 45
|
%define libcrypto_sover 45
|
||||||
%define libssl_sover 47
|
%define libssl_sover 47
|
||||||
|
@ -92,11 +79,7 @@ BuildRequires: chrpath
|
||||||
# This LibreSSL uses /etc/pki/tls from system OpenSSL
|
# This LibreSSL uses /etc/pki/tls from system OpenSSL
|
||||||
# but most functions will work without its files
|
# but most functions will work without its files
|
||||||
Suggests: openssl
|
Suggests: openssl
|
||||||
# Prevent dependencies from lib*_libressl* subpackages for the main package
|
Autoreq: 1
|
||||||
# because it may freely use /opt/libressl/lib/*.so.*
|
|
||||||
# but put "Autoreq: 1" in other subpackages which may be installed without
|
|
||||||
# libressl main package being installed and will use /usr/lib(64)/.*so.*
|
|
||||||
Autoreq: 0
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
LibreSSL utils and libs coexisting with OpenSSL.
|
LibreSSL utils and libs coexisting with OpenSSL.
|
||||||
|
@ -162,13 +145,8 @@ Autoreq: 1
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
LibreSSL devel package. Devel libraries are in %{_libdir},
|
LibreSSL devel package. Devel libraries are in %{_libdir},
|
||||||
but the same runtime libraries exist in
|
runtime librararies are in %{_olibdir},
|
||||||
%{_libdir}
|
pkg-config sets -I%{_libdir} in CFLAGS.
|
||||||
and
|
|
||||||
%{_olibdir}.
|
|
||||||
After linking, binaries will load libs from %{_olibdir}.
|
|
||||||
When using pkg-config, RPATH is set to %{_libdir},
|
|
||||||
remove RPATH/RUNPATH manually if needed.
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%doc ChangeLog COPYING
|
%doc ChangeLog COPYING
|
||||||
|
@ -245,9 +223,6 @@ patch -p1 < 1.patch
|
||||||
# Use the same %%_openssl dir with OpenSSL, but separate the config
|
# Use the same %%_openssl dir with OpenSSL, but separate the config
|
||||||
# (note that we patch libressl, X509_CONF_FILE is not upstream)
|
# (note that we patch libressl, X509_CONF_FILE is not upstream)
|
||||||
export CFLAGS="$CFLAGS -DX509_CONF_FILE='\"%{_openssldir}/libressl.cnf\"'"
|
export CFLAGS="$CFLAGS -DX509_CONF_FILE='\"%{_openssldir}/libressl.cnf\"'"
|
||||||
# TODO: why by default without this runpath is not set on libcrypto.so*,
|
|
||||||
# but is set on libtls.so* and libssl.so*?
|
|
||||||
export LDFLAGS="$LDFLAGS -Wl,-rpath=%{_libdir}"
|
|
||||||
autoreconf -if #patch2
|
autoreconf -if #patch2
|
||||||
# static libs are required for tests target in Makefile
|
# static libs are required for tests target in Makefile
|
||||||
%configure2_5x \
|
%configure2_5x \
|
||||||
|
@ -318,16 +293,6 @@ mv -v %{buildroot}%{_obindir}/openssl %{buildroot}%{_obindir}/libressl
|
||||||
# Remove static libs
|
# Remove static libs
|
||||||
( cd %{buildroot}%{_libdir} ; rm -fv *.la *.a )
|
( cd %{buildroot}%{_libdir} ; rm -fv *.la *.a )
|
||||||
|
|
||||||
# Build scripts set RUNPATH, it is needed because /usr/bin/* are linked with
|
|
||||||
# /opt/libressl/lib/*.so.*, make sure that RUNPATH exists
|
|
||||||
for i in $(find %{buildroot}%{_bindir} %{buildroot}%{_libdir} -type f -executable) ; do
|
|
||||||
rpath="$(readelf -a "$i" | grep '(RUNPATH)' | head -n 1 | awk '{print $NF}' | tr -d '[]')"
|
|
||||||
if [ "$rpath" != '%{_libdir}' ]; then
|
|
||||||
echo "Empty or incorrect RPATH on ${i}!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir -p %{buildroot}/%{_olibdir}/pkgconfig
|
mkdir -p %{buildroot}/%{_olibdir}/pkgconfig
|
||||||
mv -v %{buildroot}/%{_libdir}/pkgconfig/*.pc %{buildroot}/%{_olibdir}/pkgconfig
|
mv -v %{buildroot}/%{_libdir}/pkgconfig/*.pc %{buildroot}/%{_olibdir}/pkgconfig
|
||||||
for i in share %{_lib}
|
for i in share %{_lib}
|
||||||
|
@ -348,15 +313,6 @@ do
|
||||||
-e 's,^libdir=.+,libdir=${exec_prefix}/lib,' \
|
-e 's,^libdir=.+,libdir=${exec_prefix}/lib,' \
|
||||||
-e 's,^includedir=.+,includedir=${prefix}/include,' \
|
-e 's,^includedir=.+,includedir=${prefix}/include,' \
|
||||||
"$f"
|
"$f"
|
||||||
# TODO: is rpath in *.pc really needed?
|
|
||||||
if ! grep '^Libs:' "$f"
|
|
||||||
then
|
|
||||||
echo 'Libs: -Wl,-rpath=${libdir}' >> "$f"
|
|
||||||
else
|
|
||||||
# https://unix.stackexchange.com/a/328656
|
|
||||||
sed -i -e '/^Libs:/s/$/ -Wl,-rpath=${libdir}/' "$f"
|
|
||||||
grep '^Libs:' "$f" | grep -q rpath || exit 1
|
|
||||||
fi
|
|
||||||
mv -v "$f" "libressl-${f}"
|
mv -v "$f" "libressl-${f}"
|
||||||
# Requires: libxx -> Requires: libressl-libxx
|
# Requires: libxx -> Requires: libressl-libxx
|
||||||
sed -i \
|
sed -i \
|
||||||
|
@ -377,7 +333,10 @@ mv -v %{buildroot}/%{_libdir}/{libcrypto,libtls,libssl}.so.* %{buildroot}/%{_oli
|
||||||
for i in %{buildroot}/%{_olibdir}/{libcrypto,libtls,libssl}.so.*
|
for i in %{buildroot}/%{_olibdir}/{libcrypto,libtls,libssl}.so.*
|
||||||
do
|
do
|
||||||
filename="$(basename "$i")"
|
filename="$(basename "$i")"
|
||||||
ln -s "%{_olibdir}/${filename}" "$filename"
|
# /opt/libressl/lib
|
||||||
|
# /usr/lib64/
|
||||||
|
# Relative symlink is required to use *.so in tests...
|
||||||
|
ln -s ../../../"%{_olibdir}/${filename}" "$filename"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
if [ "$(find %{buildroot}/%{_libdir}/ -iname '*.so.*' -type f | wc -l)" -gt 0 ]; then
|
if [ "$(find %{buildroot}/%{_libdir}/ -iname '*.so.*' -type f | wc -l)" -gt 0 ]; then
|
||||||
|
@ -398,7 +357,6 @@ _pcf(){
|
||||||
nflags="$(echo "$oflags" | sed -e 's,%{_prefix},%{buildroot}%{_prefix},g')"
|
nflags="$(echo "$oflags" | sed -e 's,%{_prefix},%{buildroot}%{_prefix},g')"
|
||||||
}
|
}
|
||||||
libressl="%{buildroot}/%{_obindir}/libressl"
|
libressl="%{buildroot}/%{_obindir}/libressl"
|
||||||
rflags="-Wl,-rpath=%{buildroot}%{_libdir},-rpath=%{buildroot}%{_olibdir}"
|
|
||||||
# These tests caught a lot of mistakes during first builds
|
# These tests caught a lot of mistakes during first builds
|
||||||
export PKG_CONFIG_PATH=%{buildroot}/%{_olibdir}/pkgconfig
|
export PKG_CONFIG_PATH=%{buildroot}/%{_olibdir}/pkgconfig
|
||||||
export LD_LIBRARY_PATH=%{buildroot}/%{_olibdir}
|
export LD_LIBRARY_PATH=%{buildroot}/%{_olibdir}
|
||||||
|
@ -407,33 +365,31 @@ $libressl version -d | awk '{print $NF}' | tr -d '""' | grep -q '^%{_openssldir}
|
||||||
# (test 2) Check that path to config file is correct
|
# (test 2) Check that path to config file is correct
|
||||||
# and also check that pkg-config libressl points to libressl, not openssl
|
# and also check that pkg-config libressl points to libressl, not openssl
|
||||||
_pcf pkg-config --libs --cflags libressl
|
_pcf pkg-config --libs --cflags libressl
|
||||||
%__cc -o test2 %{SOURCE22} $nflags $rflags
|
%__cc -o test2 %{SOURCE22} $nflags
|
||||||
ldd ./test2
|
ldd ./test2
|
||||||
[ "$(./test2)" = "%{_openssldir}/libressl.cnf" ] || exit 1
|
[ "$(./test2)" = "%{_openssldir}/libressl.cnf" ] || exit 1
|
||||||
# Check that our pkgconfig hacks somehow work
|
# Check that our pkgconfig hacks somehow work
|
||||||
# (test 3) There is no /opt/libressl/ at build time
|
# (test 3) There is no /opt/libressl/ at build time
|
||||||
_pcf pkg-config --libs --cflags libressl-libcrypto
|
_pcf pkg-config --libs --cflags libressl-libcrypto
|
||||||
%__cc -o test3 %{SOURCE20} $nflags $rflags
|
%__cc -o test3 %{SOURCE20} $nflags
|
||||||
ldd ./test3
|
ldd ./test3
|
||||||
ldd ./test3 | grep -E '%{_prefix}.*/libcrypto\.so\.%{libcrypto_sover}'
|
ldd ./test3 | grep 'libcrypto\.so\.%{libcrypto_sover}'
|
||||||
./test3 | grep Hello
|
./test3 | grep Hello
|
||||||
# (test 4) Check that OpenSSL and LibreSSL devel parts coexist correctly
|
# (test 4) Check that OpenSSL and LibreSSL devel parts coexist correctly
|
||||||
# (build with libcrypto from OpenSSL)
|
# (build with libcrypto from OpenSSL)
|
||||||
_pcf pkg-config --libs --cflags libcrypto
|
_pcf pkg-config --libs --cflags libcrypto
|
||||||
%__cc -o test4 %{SOURCE20} $nflags $rflags
|
%__cc -o test4 %{SOURCE20} $nflags
|
||||||
ldd ./test4
|
ldd ./test4
|
||||||
ldd ./test4 | grep -v 'libcrypto\.so\.%{libcrypto_sover}'
|
ldd ./test4 | grep -v '/libcrypto\.so\.%{libcrypto_sover}'
|
||||||
ldd ./test4 | grep -v '%{_prefix}'
|
|
||||||
./test4 | grep Hello
|
./test4 | grep Hello
|
||||||
# (test 5) Check that flags from all *.pc are valid
|
# (test 5) Check that flags from all *.pc are valid
|
||||||
# libtls is overlinking here, but check linking
|
# libtls is overlinking here, but check linking
|
||||||
_pcf pkg-config --libs --cflags libressl libressl-libssl libressl-libtls libressl-libcrypto
|
_pcf pkg-config --libs --cflags libressl libressl-libssl libressl-libtls libressl-libcrypto
|
||||||
echo "$nflags" | grep -q rpath
|
%__сс -o test5 %{SOURCE25} $nflags -lpthread -lz -ldl
|
||||||
%__сс -o test5 %{SOURCE25} $nflags $rflags -lpthread -lz -ldl
|
|
||||||
ldd ./test5
|
ldd ./test5
|
||||||
ldd ./test3 | grep -E '%{_prefix}.*/libcrypto\.so\.%{libcrypto_sover}'
|
ldd ./test3 | grep '/libcrypto\.so\.%{libcrypto_sover}'
|
||||||
ldd ./test3 | grep -E '%{_prefix}.*/libssl\.so\.%{libssl_sover}'
|
ldd ./test3 | grep '/libssl\.so\.%{libssl_sover}'
|
||||||
ldd ./test3 | grep -E '%{_prefix}.*/libtls\.so\.%{libtls_sover}'
|
ldd ./test3 | grep '/libtls\.so\.%{libtls_sover}'
|
||||||
./test5 --threads 2
|
./test5 --threads 2
|
||||||
# (test 6) Check that gost12sum (from OpenSSL gost-engine) and LibreSSL give the same result
|
# (test 6) Check that gost12sum (from OpenSSL gost-engine) and LibreSSL give the same result
|
||||||
# This also simply checks that checksums by GOST do work
|
# This also simply checks that checksums by GOST do work
|
||||||
|
|
Loading…
Add table
Reference in a new issue