From 066940a9a78dd208081d15e8ec33ccf536cd0259 Mon Sep 17 00:00:00 2001 From: Greg Tucker Date: Thu, 2 Sep 2021 18:27:51 -0700 Subject: [PATCH] build: Add ms rc file to put extra metatdata on dll Change-Id: Idf687c6b2f8d1dea203f01bf57c5158d19ed519e Signed-off-by: Ranjit Menon Signed-off-by: Greg Tucker --- Makefile.nmake | 12 +++++++ isa-l.rc | 78 ++++++++++++++++++++++++++++++++++++++++++++++ tools/gen_nmake.mk | 12 +++++++ 3 files changed, 102 insertions(+) create mode 100644 isa-l.rc diff --git a/Makefile.nmake b/Makefile.nmake index 543c12a..b8a34e9 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -185,11 +185,20 @@ isa-l_static.lib: $(objs) $? << +!IF [rc] == 0 +isa-l.dll: isa-l.res +!ELSE +!MESSAGE Optionally install rc to set file version info +!ENDIF + isa-l.dll: $(objs) link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<< $? << +isa-l.res: isa-l.h + rc /fo $@ isa-l.rc + {erasure_code}.c.obj: $(CC) $(CFLAGS) /c -Fo$@ $? {erasure_code}.asm.obj: @@ -321,6 +330,7 @@ isa-l.h: @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $@ @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $@ @echo.>> $@ + @echo #ifndef RC_INVOKED>> $@ @echo #include ^>> $@ @echo #include ^>> $@ @echo #include ^>> $@ @@ -328,6 +338,7 @@ isa-l.h: @echo #include ^>> $@ @echo #include ^>> $@ @echo #include ^>> $@ + @echo #endif // RC_INVOKED>> $@ @echo #endif //_ISAL_H_>> $@ clean: @@ -339,6 +350,7 @@ clean: -if exist isa-l.lib del isa-l.lib -if exist isa-l.dll del isa-l.dll -if exist isa-l.exp del isa-l.exp + -if exist isa-l.res del isa-l.res zlib.lib: igzip_perf.exe: zlib.lib diff --git a/isa-l.rc b/isa-l.rc new file mode 100644 index 0000000..9993bcb --- /dev/null +++ b/isa-l.rc @@ -0,0 +1,78 @@ +/********************************************************************** + Copyright(c) 2021 Intel Corporation All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**********************************************************************/ + +#include +#include "isa-l.h" + +#define _MAKE_VER_STRING(major, minor, patch, buildnum) \ + #major "." \ + #minor "." \ + #patch "." \ + #buildnum +#define MAKE_VER_STRING(major, minor, patch, buildnum) _MAKE_VER_STRING(major, minor, patch, buildnum) + +#define VER_FILEVERSION ISAL_MAJOR_VERSION,ISAL_MINOR_VERSION,ISAL_PATCH_VERSION,0 +#define VER_FILEVERSION_STR MAKE_VER_STRING(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION, 0) + +#define VER_PRODUCTVERSION VER_FILEVERSION +#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR + +#define VER_COMPANYNAME_STR "Intel Corporation" +#define VER_FILEDESCRIPTION_STR "Intel(R) Intelligent Storage Acceleration Library" +#define VER_INTERNALNAME_STR "Intel(R) Intelligent Storage Acceleration Library" +#define VER_LEGALCOPYRIGHT_STR "Copyright (C) Intel Corporation 2021" +#define VER_LEGALTRADEMARKS1_STR "All Rights Reserved" +#define VER_ORIGINALFILENAME_STR "isa-l.dll" +#define VER_PRODUCTNAME_STR VER_FILEDESCRIPTION_STR + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_PRODUCTVERSION +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", VER_COMPANYNAME_STR + VALUE "FileDescription", VER_FILEDESCRIPTION_STR + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", VER_INTERNALNAME_STR + VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR + VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR + VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR + VALUE "ProductName", VER_PRODUCTNAME_STR + VALUE "ProductVersion", VER_PRODUCTVERSION_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 0x04B0 + END +END diff --git a/tools/gen_nmake.mk b/tools/gen_nmake.mk index 67dab8e..e40a237 100644 --- a/tools/gen_nmake.mk +++ b/tools/gen_nmake.mk @@ -41,11 +41,20 @@ Makefile.nmake tst.nmake: FORCE @echo '$$?' >> $@ @echo '<<' >> $@ @echo '' >> $@ + @echo '!IF [rc] == 0' >> $@ + @echo 'isa-l.dll: isa-l.res' >> $@ + @echo '!ELSE' >> $@ + @echo '!MESSAGE Optionally install rc to set file version info' >> $@ + @echo '!ENDIF' >> $@ + @echo '' >> $@ @echo 'isa-l.dll: $$(objs)' >> $@ @echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@ @echo '$$?' >> $@ @echo '<<' >> $@ @echo '' >> $@ + @echo 'isa-l.res: isa-l.h' >> $@ + @echo ' rc /fo $$@ isa-l.rc' >> $@ + @echo '' >> $@ @$(foreach b, $(units), \ printf "{%s}.c.obj:\n\t\$$(CC) \$$(CFLAGS) /c -Fo\$$@ \$$?\n{%s}.asm.obj:\n\t\$$(AS) \$$(AFLAGS) -o \$$@ \$$?\n\n" $(b) $(b) >> $@; ) @echo '' >> $@ @@ -114,7 +123,9 @@ endif @echo ' @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $$@' >> $@ @echo ' @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $$@' >> $@ @echo ' @echo.>> $$@' >> $@ + @echo ' @echo #ifndef RC_INVOKED>> $$@' >> $@ @for unit in $(sort $(extern_hdrs)); do echo " @echo #include ^>> \$$@" | sed -e 's;include/;;' >> $@; done + @echo ' @echo #endif // RC_INVOKED>> $$@' >> $@ @echo ' @echo #endif //_ISAL_H_>> $$@' >> $@ @echo '' >> $@ @echo 'clean:' >> $@ @@ -126,6 +137,7 @@ endif @echo ' -if exist isa-l.lib del isa-l.lib' >> $@ @echo ' -if exist isa-l.dll del isa-l.dll' >> $@ @echo ' -if exist isa-l.exp del isa-l.exp' >> $@ + @echo ' -if exist isa-l.res del isa-l.res' >> $@ @echo '' >> $@ $(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ ) @cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \