* mingw-w64-argon - 20171227 - various reworks 001-mingw-fix-install.patch - integrate my work so that argon2 patch can work on CygWin and MSYS2 if necessary 002-mingw-fix-src.patch - fix various issues in source-code related to prinf formatting, stdcall conventions, * build an optimized version of argon2 with msse2 if applicable (for i686) as well as x86_64 (no -msse2 needed there).
99 lines
3.0 KiB
Diff
99 lines
3.0 KiB
Diff
--- phc-winner-argon2-20171227/Makefile.orig 2017-12-27 14:56:31.000000000 -0500
|
|
+++ phc-winner-argon2-20171227/Makefile 2019-01-03 10:08:33.315228200 -0500
|
|
@@ -44,6 +44,16 @@ CI_CFLAGS := $(CFLAGS) -Werror=declarati
|
|
OPTTARGET ?= native
|
|
OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \
|
|
-o /dev/null 2>/dev/null; echo $$?)
|
|
+# Try with -msse2 flag
|
|
+ifneq ($(OPTTEST), 0)
|
|
+OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) -msse2 src/opt.c -c \
|
|
+ -o /dev/null 2>/dev/null; echo $$?)
|
|
+#if we have -msse2 flag, use it
|
|
+ifeq ($(OPTTEST), 0)
|
|
+ CFLAGS += -msse2
|
|
+ CI_CFLAGS += -msse2
|
|
+endif
|
|
+endif
|
|
# Detect compatible platform
|
|
ifneq ($(OPTTEST), 0)
|
|
$(info Building without optimizations)
|
|
@@ -58,6 +68,7 @@ BUILD_PATH := $(shell pwd)
|
|
KERNEL_NAME := $(shell uname -s)
|
|
|
|
LIB_NAME=argon2
|
|
+LIB_SH_RT=
|
|
ifeq ($(KERNEL_NAME), Linux)
|
|
LIB_EXT := so.$(ABI_VERSION)
|
|
LIB_CFLAGS := -shared -fPIC -fvisibility=hidden -DA2_VISCTL=1
|
|
@@ -75,14 +86,17 @@ ifeq ($(KERNEL_NAME), Darwin)
|
|
endif
|
|
ifeq ($(findstring CYGWIN, $(KERNEL_NAME)), CYGWIN)
|
|
LIB_EXT := dll
|
|
+ LIB_SH_RT := cyg$(LIB_NAME).$(LIB_EXT)
|
|
LIB_CFLAGS := -shared -Wl,--out-implib,lib$(LIB_NAME).$(LIB_EXT).a
|
|
endif
|
|
ifeq ($(findstring MINGW, $(KERNEL_NAME)), MINGW)
|
|
LIB_EXT := dll
|
|
+ LIB_SH_RT := lib$(LIB_NAME).$(LIB_EXT)
|
|
LIB_CFLAGS := -shared -Wl,--out-implib,lib$(LIB_NAME).$(LIB_EXT).a
|
|
endif
|
|
ifeq ($(findstring MSYS, $(KERNEL_NAME)), MSYS)
|
|
LIB_EXT := dll
|
|
+ LIB_SH_RT := msys-$(LIB_NAME).$(LIB_EXT)
|
|
LIB_CFLAGS := -shared -Wl,--out-implib,lib$(LIB_NAME).$(LIB_EXT).a
|
|
endif
|
|
ifeq ($(KERNEL_NAME), SunOS)
|
|
@@ -98,7 +112,11 @@ ifeq ($(CC), clang)
|
|
endif
|
|
endif
|
|
|
|
+ifeq ($(LIB_SH_RT),)
|
|
LIB_SH := lib$(LIB_NAME).$(LIB_EXT)
|
|
+else
|
|
+LIB_SH := lib$(LIB_NAME).$(LIB_EXT).a
|
|
+endif
|
|
LIB_ST := lib$(LIB_NAME).a
|
|
|
|
ifdef LINKED_LIB_EXT
|
|
@@ -135,8 +153,15 @@ $(BENCH): $(SRC) $(SRC_BENCH)
|
|
$(GENKAT): $(SRC) $(SRC_GENKAT)
|
|
$(CC) $(CFLAGS) $^ -o $@ -DGENKAT
|
|
|
|
+ifeq ($(LIB_SH_RT),)
|
|
$(LIB_SH): $(SRC)
|
|
$(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
|
|
+else
|
|
+$(LIB_SH_RT): $(SRC)
|
|
+ $(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
|
|
+
|
|
+$(LIB_SH): $(LIB_SH_RT)
|
|
+endif
|
|
|
|
$(LIB_ST): $(OBJ)
|
|
ar rcs $@ $^
|
|
@@ -174,14 +199,23 @@ install: $(RUN) libs
|
|
$(INSTALL) -d $(INST_INCLUDE)
|
|
$(INSTALL) -m 0644 $(HEADERS) $(INST_INCLUDE)
|
|
$(INSTALL) -d $(INST_LIBRARY)
|
|
+ $(INSTALL) -d $(INST_BINARY)
|
|
+ifneq ($(LIB_SH_RT),)
|
|
+ $(INSTALL) $(LIB_SH_RT) $(INST_BINARY)
|
|
+ $(INSTALL) $(LIB_SH) $(INST_LIBRARY)
|
|
+ $(INSTALL) $(LIB_ST) $(INST_LIBRARY)
|
|
+else
|
|
$(INSTALL) $(LIBRARIES) $(INST_LIBRARY)
|
|
+endif
|
|
ifdef LINKED_LIB_SH
|
|
cd $(INST_LIBRARY) && ln -s $(notdir $(LIB_SH) $(LINKED_LIB_SH))
|
|
endif
|
|
- $(INSTALL) -d $(INST_BINARY)
|
|
$(INSTALL) $(RUN) $(INST_BINARY)
|
|
|
|
uninstall:
|
|
cd $(INST_INCLUDE) && rm -f $(notdir $(HEADERS))
|
|
cd $(INST_LIBRARY) && rm -f $(notdir $(LIBRARIES) $(LINKED_LIB_SH))
|
|
+ifneq ($(LIB_SH_RT),)
|
|
+ cd $(INST_BINARY) && rm -f $(notdir $(LIB_SH_RT))
|
|
+endif
|
|
cd $(INST_BINARY) && rm -f $(notdir $(RUN))
|