Skip to content

Commit

Permalink
reduce patch size
Browse files Browse the repository at this point in the history
Signed-off-by: giantcroc <[email protected]>
  • Loading branch information
giantcroc committed Mar 12, 2024
1 parent dba5d95 commit 50ca04e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 84 deletions.
88 changes: 8 additions & 80 deletions bazel/foreign_cc/qatzstd.patch
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion contrib/qat/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions contrib/qat/compression/qatzstd/compressor/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,7 +30,7 @@ make(
"@platforms//cpu:x86_64",
],
targets = [
"",
"ENABLE_USDM_DRV=1",
"install",
],
deps = [
Expand Down

0 comments on commit 50ca04e

Please sign in to comment.