From 50ca04e378227c76c158ea968d7e08146044c8d8 Mon Sep 17 00:00:00 2001 From: giantcroc Date: Mon, 11 Mar 2024 23:46:22 -0700 Subject: [PATCH] reduce patch size Signed-off-by: giantcroc --- bazel/foreign_cc/qatzstd.patch | 88 ++----------------- contrib/qat/BUILD | 6 +- .../qatzstd/compressor/source/BUILD | 8 +- 3 files changed, 18 insertions(+), 84 deletions(-) diff --git a/bazel/foreign_cc/qatzstd.patch b/bazel/foreign_cc/qatzstd.patch index 6cb5201b7a2b..84bd231db5e9 100644 --- a/bazel/foreign_cc/qatzstd.patch +++ b/bazel/foreign_cc/qatzstd.patch @@ -1,85 +1,13 @@ diff --git a/src/Makefile b/src/Makefile -index 1abf10d..a0c7e9a 100644 +index 1abf10d..c5fa3a6 100644 --- a/src/Makefile +++ b/src/Makefile -@@ -41,6 +41,7 @@ LIBDIR ?= $(INSTALLDIR)/lib - INCLUDEDIR ?= $(INSTALLDIR)/include - - CP ?= cp -+MKDIR ?= mkdir - - ENABLE_USDM_DRV ?= 0 - ifneq ($(ICP_ROOT), ) -@@ -55,10 +56,8 @@ ifneq ($(ICP_ROOT), ) +@@ -54,7 +54,7 @@ ifneq ($(ICP_ROOT), ) + endif else QATFLAGS = -DINTREE - LDFLAGS = -lqat -- ifneq ($(ENABLE_USDM_DRV), 0) -- QATFLAGS += -DENABLE_USDM_DRV -- LDFLAGS += -lusdm -- endif -+ QATFLAGS += -DENABLE_USDM_DRV -+ LDFLAGS += -lusdm - endif - - ifdef ZSTDLIB -@@ -69,8 +68,8 @@ CFLAGS += -Wall -Werror -Wextra -Wcast-align -Wshadow -Wstrict-aliasing=1 \ - -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \ - -Wundef -Wpointer-arith -Wvla -Wformat=2 -Winit-self \ - -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wc++-compat \ -- -pedantic -fstack-protector-strong -fPIE -fPIC \ -- -fno-delete-null-pointer-checks -fwrapv -fno-strict-overflow -+ -pedantic -fstack-protector-strong \ -+ -fno-delete-null-pointer-checks -fwrapv - - DEBUGLEVEL ?=0 - -@@ -81,27 +80,30 @@ else - QATFLAGS += -O3 - endif - -+$(info INSTALLDIR="$(INSTALLDIR)") -+$(info CPPFLAGS="$(CPPFLAGS)") -+ - qatseqprod.o: qatseqprod.c -- $(CC) -c $(CFLAGS) $(QATFLAGS) $(DEBUGFLAGS) $^ -o $@ -+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(QATFLAGS) $(DEBUGFLAGS) $^ -o $@ - - lib: qatseqprod.o - $(AR) rc libqatseqprod.a $^ -- $(CC) -shared $^ $(LDFLAGS) -o libqatseqprod.so -+ @echo qatseqprod library successfully build - - .PHONY: install - install: lib -+ $(MKDIR) -p $(LIBDIR) -+ $(MKDIR) -p $(INCLUDEDIR) - $(CP) libqatseqprod.a $(LIBDIR) -- $(CP) libqatseqprod.so $(LIBDIR) - $(CP) qatseqprod.h $(INCLUDEDIR) - @echo qatseqprod library successfully installed - - .PHONY: uninstall - uninstall: - $(RM) $(LIBDIR)/libqatseqprod.a -- $(RM) $(LIBDIR)/libqatseqprod.so - $(RM) $(INCLUDEDIR)/qatseqprod.h - @echo qatseqprod library successfully uninstalled - - clean: - $(RM) *.o -- $(RM) libqatseqprod.a libqatseqprod.so -+ $(RM) libqatseqprod.a -diff --git a/test/Makefile b/test/Makefile -index dff0c8e..4ba01b2 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -34,7 +34,7 @@ - # ####################################################################### - LIB = ../src - --LDFLAGS = $(LIB)/libqatseqprod.a -I$(LIB) -+LDFLAGS = $(LIB)/libqatseqprod.a -I$(LIB) -L$(LIB) -l:libqatseqprod.a -l:libqat.a -l:libusdm.a -l:libzstd.a -lpthread -lcrypto - - ifneq ($(ICP_ROOT), ) - LDFLAGS += -lqat_s -lusdm_drv_s -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build +- LDFLAGS = -lqat ++ LDFLAGS += -lqat + ifneq ($(ENABLE_USDM_DRV), 0) + QATFLAGS += -DENABLE_USDM_DRV + LDFLAGS += -lusdm diff --git a/contrib/qat/BUILD b/contrib/qat/BUILD index d435976e4953..08ddf04136c3 100644 --- a/contrib/qat/BUILD +++ b/contrib/qat/BUILD @@ -20,12 +20,16 @@ configure_make( configure_options = [ "--disable-fast-crc-in-assembler", "--disable-systemd", - "--disable-shared", "--with-pic", + "--enable-shared", "--enable-static", "--enable-samples=no", ], lib_source = "@com_github_intel_qatlib//:all", + out_shared_libs = [ + "libqat.so", + "libusdm.so", + ], out_static_libs = [ "libqat.a", "libusdm.a", diff --git a/contrib/qat/compression/qatzstd/compressor/source/BUILD b/contrib/qat/compression/qatzstd/compressor/source/BUILD index 359978bc3b19..960fa2b9b55e 100644 --- a/contrib/qat/compression/qatzstd/compressor/source/BUILD +++ b/contrib/qat/compression/qatzstd/compressor/source/BUILD @@ -15,9 +15,11 @@ make( build_data = ["@com_github_qat_zstd//:all"], env = select({ "//bazel:clang_build": { - "CFLAGS": "-Wno-error=unused-parameter", + "CFLAGS": "-Wno-error=unused-parameter -Wno-error=unused-command-line-argument -I$$EXT_BUILD_DEPS/qatlib/include -I$$EXT_BUILD_DEPS/zstd/include", + }, + "//conditions:default": { + "CFLAGS": "-I$$EXT_BUILD_DEPS/qatlib/include -I$$EXT_BUILD_DEPS/zstd/include", }, - "//conditions:default": {}, }), includes = [], lib_source = "@com_github_qat_zstd//:all", @@ -28,7 +30,7 @@ make( "@platforms//cpu:x86_64", ], targets = [ - "", + "ENABLE_USDM_DRV=1", "install", ], deps = [