Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Commit b36c2a9

Browse files
Tatshindutny
authored andcommitted
header: treat Wine like MinGW
PR-URL: #259 Reviewed-By: Fedor Indutny <[email protected]>
1 parent eb5e992 commit b36c2a9

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ parsertrace_g
1212
*.mk
1313
*.Makefile
1414
*.so.*
15+
*.exe.*
16+
*.exe
1517
*.a
1618

1719

Makefile

+14-6
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
# IN THE SOFTWARE.
2020

2121
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
22+
HELPER ?=
23+
BINEXT ?=
2224
ifeq (darwin,$(PLATFORM))
2325
SONAME ?= libhttp_parser.2.5.0.dylib
2426
SOEXT ?= dylib
27+
else ifeq (wine,$(PLATFORM))
28+
CC = winegcc
29+
BINEXT = .exe.so
30+
HELPER = wine
2531
else
2632
SONAME ?= libhttp_parser.so.2.5.0
2733
SOEXT ?= so
2834
endif
35+
2936
CC?=gcc
3037
AR?=ar
3138

@@ -58,8 +65,8 @@ LDFLAGS_LIB += -Wl,-soname=$(SONAME)
5865
endif
5966

6067
test: test_g test_fast
61-
./test_g
62-
./test_fast
68+
$(HELPER) ./test_g$(BINEXT)
69+
$(HELPER) ./test_fast$(BINEXT)
6370

6471
test_g: http_parser_g.o test_g.o
6572
$(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@
@@ -86,7 +93,7 @@ http_parser.o: http_parser.c http_parser.h Makefile
8693
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
8794

8895
test-run-timed: test_fast
89-
while(true) do time ./test_fast > /dev/null; done
96+
while(true) do time $(HELPER) ./test_fast$(BINEXT) > /dev/null; done
9097

9198
test-valgrind: test_g
9299
valgrind ./test_g
@@ -107,10 +114,10 @@ url_parser_g: http_parser_g.o contrib/url_parser.c
107114
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@
108115

109116
parsertrace: http_parser.o contrib/parsertrace.c
110-
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace
117+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace$(BINEXT)
111118

112119
parsertrace_g: http_parser_g.o contrib/parsertrace.c
113-
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g
120+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g$(BINEXT)
114121

115122
tags: http_parser.c http_parser.h test.c
116123
ctags $^
@@ -133,7 +140,8 @@ uninstall:
133140
clean:
134141
rm -f *.o *.a tags test test_fast test_g \
135142
http_parser.tar libhttp_parser.so.* \
136-
url_parser url_parser_g parsertrace parsertrace_g
143+
url_parser url_parser_g parsertrace parsertrace_g \
144+
*.exe *.exe.so
137145

138146
contrib/url_parser.c: http_parser.h
139147
contrib/parsertrace.c: http_parser.h

http_parser.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ extern "C" {
3030
#define HTTP_PARSER_VERSION_PATCH 0
3131

3232
#include <sys/types.h>
33-
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
33+
#if defined(_WIN32) && !defined(__MINGW32__) && \
34+
(!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__)
3435
#include <BaseTsd.h>
3536
#include <stddef.h>
3637
typedef __int8 int8_t;

0 commit comments

Comments
 (0)