Adapt building sign-file with LibreSSL to recent changes

[user@rosa2019 tmp]$ diff -ur linux-5.10.11/scripts/Makefile linux-5.10.17/scripts/Makefile
--- linux-5.10.11/scripts/Makefile      2021-01-27 13:55:30.000000000 +0300
+++ linux-5.10.17/scripts/Makefile      2021-02-17 13:02:30.000000000 +0300
@@ -3,6 +3,9 @@
 # scripts contains sources for various helper programs used throughout
 # the kernel for the build process.

+CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
+CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
+
 hostprogs-always-$(CONFIG_BUILD_BIN2C)                 += bin2c
 hostprogs-always-$(CONFIG_KALLSYMS)                    += kallsyms
 hostprogs-always-$(BUILD_C_RECORDMCOUNT)               += recordmcount
@@ -14,8 +17,10 @@

 HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
-HOSTLDLIBS_sign-file = -lcrypto
-HOSTLDLIBS_extract-cert = -lcrypto
+HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
+HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
+HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
+HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)

 ifdef CONFIG_UNWINDER_ORC
 ifeq ($(ARCH),x86_64)
This commit is contained in:
Mikhail Novosyolov 2021-02-22 13:17:43 +03:00
parent 8afcac7265
commit b75353851c

View file

@ -1214,13 +1214,12 @@ sed -n \
> "%{certs_public_keys}"
# link sign-file and extract-cert with LibreSSL instead of OpenSSL
libressl_cflags="$(pkg-config --cflags --libs libressl-libcrypto)"
if [ $? != 0 ] ; then exit $? ; fi
sed -i %{src_dir}/scripts/Makefile \
%if %{with uml}
%{src_dir}.uml/scripts/Makefile \
%endif
-e "s,-lcrypto,${libressl_cflags},g"
-e "s, libcrypto , libressl-libcrypto ,g"
%if %{with additional_keys}
# Add additional public RSA keys to the list of trusted keys for kernel modules