From c6c31a86d8cb41f0a5ca3246a2d03565b03bb91b Mon Sep 17 00:00:00 2001 From: jsteube Date: Fri, 21 Oct 2016 09:07:39 +0200 Subject: [PATCH] Add some changes to improve compiling on MSYS2 --- src/Makefile | 8 +++++--- src/folder.c | 6 +++--- src/win_file_globbing.mk | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5cd2810b4..8c9f2d698 100644 --- a/src/Makefile +++ b/src/Makefile @@ -12,10 +12,12 @@ PROG_NAME := hashcat UNAME := $(shell uname -s) # we need to strip the windows version number to be able to build hashcat on cygwin hosts -UNAME := $(patsubst CYGWIN_NT-%,CYGWIN_NT-,$(UNAME)) -UNAME := $(patsubst MINGW64_NT-%,MINGW64_NT-,$(UNAME)) +UNAME := $(patsubst CYGWIN_NT-%,CYGWIN,$(UNAME)) +UNAME := $(patsubst MSYS_NT-%,MSYS2,$(UNAME)) +UNAME := $(patsubst MINGW32_NT-%,MSYS2,$(UNAME)) +UNAME := $(patsubst MINGW64_NT-%,MSYS2,$(UNAME)) -ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT- MINGW64_NT- FreeBSD)) +ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN MSYS2 FreeBSD)) $(error "! Your Operating System ($(UNAME)) is not supported by $(PROG_NAME) Makefile") endif diff --git a/src/folder.c b/src/folder.c index a3d41a34a..4fe097936 100644 --- a/src/folder.c +++ b/src/folder.c @@ -74,7 +74,7 @@ static int get_exec_path (char *exec_path, const size_t exec_path_sz) return 0; } -static void get_install_dir (char *install_dir, const char *exec_path) +void get_install_dir (char *install_dir, const char *exec_path) { strncpy (install_dir, exec_path, HCBUFSIZ_TINY - 1); @@ -95,12 +95,12 @@ static void get_install_dir (char *install_dir, const char *exec_path) } } -static void get_profile_dir (char *profile_dir, const char *home_dir) +void get_profile_dir (char *profile_dir, const char *home_dir) { snprintf (profile_dir, HCBUFSIZ_TINY - 1, "%s/%s", home_dir, DOT_HASHCAT); } -static void get_session_dir (char *session_dir, const char *profile_dir) +void get_session_dir (char *session_dir, const char *profile_dir) { snprintf (session_dir, HCBUFSIZ_TINY - 1, "%s/%s", profile_dir, SESSIONS_FOLDER); } diff --git a/src/win_file_globbing.mk b/src/win_file_globbing.mk index b136eef4d..cd6cb97f7 100644 --- a/src/win_file_globbing.mk +++ b/src/win_file_globbing.mk @@ -18,8 +18,13 @@ ifneq (,$(IS_WIN_BUILD)) # entering this code path means: we need to check for CRT_glob.o since we try to build binaries for windows operating systems +ifeq ($(UNAME),MSYS2) +CRT_GLOB_LIB_PATH_32 ?= /mingw32/i686-w64-mingw32/lib/ +CRT_GLOB_LIB_PATH_64 ?= /mingw64/x86_64-w64-mingw32/lib/ +else CRT_GLOB_LIB_PATH_32 ?= /usr/i686-w64-mingw32/lib/ CRT_GLOB_LIB_PATH_64 ?= /usr/x86_64-w64-mingw32/lib/ +endif CRT_GLOB_LIB_SYSROOT_32 := $(shell $(CC_WIN_32) --verbose 2>&1 | $(EGREP) -m 1 -o '(with-sysroot="[^"]"|with-sysroot=[^ ]*)' | $(SED) 's/^with-sysroot="\?\([^"]*\)"\?$$/\1/') CRT_GLOB_LIB_SYSROOT_64 := $(shell $(CC_WIN_64) --verbose 2>&1 | $(EGREP) -m 1 -o '(with-sysroot="[^"]"|with-sysroot=[^ ]*)' | $(SED) 's/^with-sysroot="\?\([^"]*\)"\?$$/\1/')