summaryrefslogtreecommitdiffstats
path: root/Makefile.mingw64
blob: fed71f43cc9bb32ec5abc0ef1e6863766a8fdc1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
TOP 			= $(shell readlink -f .)

ARCH			= x86-mingw64

LOCAL_BUILD_PATH 	= $(TOP)/build.$(ARCH)
LOCAL_INST_PATH 	= $(TOP)/install.$(ARCH)

VERSION_SHORT		= 5.14
VERSION_RELEASE		= 2
VERSION			= $(VERSION_SHORT).$(VERSION_RELEASE)

SSL_VERSION		= 1.0.2r
SSL_ARCHIVE		= openssl-$(SSL_VERSION).tar.gz


QT_BUILD_PATH		= c:/tmp
QT_INST_PATH		= $(QT_BUILD_PATH)/qt
QT_SRC_PATH		= $(QT_BUILD_PATH)/qt-src

GCC			= $(shell which g++)
GCC_PATH		= $(shell dirname $(GCC))
7ZIP			= $(TOP)/wintools/7za.exe

RESERVE_INSTDIR		= 0

PACKAGE_NAME 		= qt-$(VERSION)-$(ARCH)

test:
	echo $(ProgramW6432)
	echo $(7ZIP)

all: download ssl qt
 
ssl: ssl.$(ARCH)
qt: qt.$(ARCH) 

download:
	$(MAKE) -C ./SOURCE qtzip
	$(MAKE) -C ./SOURCE ssltgz

ssl.$(ARCH):
	rm -Rf $(LOCAL_BUILD_PATH)/openssl-$(SSL_VERSION)
	mkdir -p $(LOCAL_BUILD_PATH)/
	cd $(LOCAL_BUILD_PATH) && \
		tar -xzf  $(TOP)/SOURCE/$(SSL_ARCHIVE)
	cd $(LOCAL_BUILD_PATH)/openssl-$(SSL_VERSION) && \
	    export CFLAGS="-m64 -fpic" && \
	    ./Configure --prefix=$(QT_INST_PATH) -m64 -static-libgcc -static-libstdc++ shared mingw64 && \
	    make clean && \
	    make && \
	    make install

qt.$(ARCH):
	mkdir -p $(LOCAL_BUILD_PATH)
	if [ -d $(LOCAL_BUILD_PATH)/qt-everywhere-src-$(VERSION) ]; then \
	    rm -Rf $(LOCAL_BUILD_PATH)/qt-everywhere-src-$(VERSION) ; \
	fi
	cd $(LOCAL_BUILD_PATH); \
	    $(7ZIP) x $(TOP)/SOURCE/qt-everywhere-src-$(VERSION).zip
	cd $(LOCAL_BUILD_PATH)/qt-everywhere-src-$(VERSION) ;\
	    patch -p1 < $(TOP)/SOURCE/qt-5.12.3-cross-static-gcc-libs.patch 
	rm -Rf $(QT_SRC_PATH)
	mv $(LOCAL_BUILD_PATH)/qt-everywhere-src-$(VERSION) $(QT_SRC_PATH)
	# be sure, that python, msys-tools and gcc are in PATH
	cd $(QT_SRC_PATH) && \
		rm -f config.cache && \
		./configure \
			-platform win32-g++ \
			-prefix $(QT_INST_PATH) \
			-recheck-all \
			-shared \
			-release \
			-strip \
			-silent \
			-no-rpath \
			-no-pch \
			-ssl \
			-nomake examples \
			-nomake tests \
			-skip activeqt \
			-skip qtwebengine \
			-skip qtwebglplugin \
			-skip qtwebchannel \
			-skip qtwayland \
			-skip qtlocation \
			-skip qtdoc \
			-skip qtgamepad \
			-skip qtsensors \
			-skip qtmultimedia \
			-qt-zlib \
			-qt-libjpeg \
			-qt-libpng \
			-qt-pcre \
			-qt-freetype \
			-qt-doubleconversion \
			-opengl desktop \
			-openssl \
			-I$(QT_INST_PATH)/include \
			-L$(QT_INST_PATH)/lib \
			-opensource \
			-confirm-license && \
		make && \
		make install
	mv -f $(QT_INST_PATH)/bin/openssl.exe \
	    $(QT_INST_PATH)/bin/qt-openssl.exe
	cp -f $(GCC_PATH)/../x86_64-w64-mingw32/bin/libwinpthread-1.dll $(QT_INST_PATH)/bin/
	cd  $(QT_INST_PATH)/ && \
	    tar -czf $(TOP)/$(PACKAGE_NAME).tgz .
ifeq ($(RESERVE_INSTDIR),0)
	rm -Rf $(QT_INST_PATH)
endif
	rm -Rf $(QT_SRC_PATH)

clean:
	rm -Rf build.$(ARCH)
	rm -Rf install.$(ARCH)