From 8b5d0f7d95e6b9f04d5d1bf015d371ffd03b473b Mon Sep 17 00:00:00 2001
From: albfan <albertofanjul@gmail.com>
Date: Sun, 6 Aug 2017 18:25:11 +0200
Subject: [PATCH] Compile for Msys2

---
 INSTALL  | 5 +++++
 Makefile | 5 +++++
 regex.h  | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/INSTALL b/INSTALL
index e070fef..e40a0fa 100644
--- a/INSTALL
+++ b/INSTALL
@@ -70,3 +70,8 @@ Windows (mingw32):
 
 	You can also link statically against libiconv if you add
 	STATIC=1 ICONV_DIR=<your_iconv_dir> to the make command line.
+
+Windows (msys):
+	You need to specify the arch type.
+        -run make ARCH=32
+        -run make ARCH=64
diff --git a/Makefile b/Makefile
index 3f8730a..85cd657 100644
--- a/Makefile
+++ b/Makefile
@@ -73,6 +73,11 @@ ifeq ($(UNAME_O),Cygwin)
 	LIBS += -liconv
 	EXT = .exe
 endif
+ifneq (,$(findstring MINGW,$(UNAME_S)))
+	CFLAGS += -I/mingw$(ARCH)/lib/libzip/include
+	LIBS += -liconv -lpcreposix -lpcre -llibzip -lzip -lz
+	EXT = .exe
+endif
 ifneq ($(MINGW32),)
 	CFLAGS += -DICONV_CHAR="const char" -I$(REGEX_DIR) -I$(ZLIB_DIR)
 	LIBS = $(REGEX_DIR)/regex.o
diff --git a/regex.h b/regex.h
index 4940aa3..96c6d5b 100644
--- a/regex.h
+++ b/regex.h
@@ -11,7 +11,7 @@
 #ifndef REGEX_H
 #define REGEX_H
 
-#include <regex.h>
+#include <pcreposix.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
-- 
2.13.3.windows.1

