Mercurial > mxe-octave
comparison src/qt.mk @ 3129:d24828818d36
[MSVC] enable Qt compilation
- patch qmake to support DLL prefix/suffix
- patch qmake for proper .pc files generation
- enable .pc files generation for MSVC in .pro files
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Thu, 11 Jul 2013 23:48:28 -0400 |
parents | 23e3e2955cf5 |
children | fae248a5b181 |
comparison
equal
deleted
inserted
replaced
3128:9e26e3930422 | 3129:d24828818d36 |
---|---|
5 $(PKG)_IGNORE := | 5 $(PKG)_IGNORE := |
6 $(PKG)_CHECKSUM := bc352a283610e0cd2fe0dbedbc45613844090fcb | 6 $(PKG)_CHECKSUM := bc352a283610e0cd2fe0dbedbc45613844090fcb |
7 $(PKG)_SUBDIR := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION) | 7 $(PKG)_SUBDIR := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION) |
8 $(PKG)_FILE := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION).tar.gz | 8 $(PKG)_FILE := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION).tar.gz |
9 $(PKG)_URL := http://releases.qt-project.org/qt4/source/$($(PKG)_FILE) | 9 $(PKG)_URL := http://releases.qt-project.org/qt4/source/$($(PKG)_FILE) |
10 | 10 $(PKG)_DEPS := openssl zlib libpng jpeg libmng tiff dbus |
11 ifeq ($(MXE_SYSTEM),mingw) | 11 |
12 $(PKG)_CONFIGURE_CMD := | |
13 $(PKG)_CONFIGURE_CROSS_COMPILE_OPTION := | |
14 $(PKG)_CONFIGURE_DATABASE_OPTION := | |
15 $(PKG)_CONFIGURE_ENV := | |
16 $(PKG)_CONFIGURE_EXTRA_OPTION := | |
17 $(PKG)_CONFIGURE_INCLUDE_OPTION := | |
18 $(PKG)_CONFIGURE_LIBPATH_OPTION := | |
19 $(PKG)_CONFIGURE_PLATFORM_OPTION := | |
20 $(PKG)_PREFIX := '$(HOST_PREFIX)' | |
21 $(PKG)_MKSPECS := '$($(PKG)_PREFIX)' | |
22 | |
23 ifneq ($(filter mingw msvc,$(MXE_SYSTEM)),) | |
12 ifeq ($(MXE_NATIVE_BUILD),yes) | 24 ifeq ($(MXE_NATIVE_BUILD),yes) |
13 $(PKG)_DEPS := openssl zlib libpng jpeg libmng tiff dbus | |
14 | |
15 $(PKG)_CONFIGURE_ENV := \ | 25 $(PKG)_CONFIGURE_ENV := \ |
16 OPENSSL_LIBS="`'$(MXE_PKG_CONFIG)' --libs-only-l openssl`" \ | 26 PKG_CONFIG_PATH='$(HOST_PREFIX)/lib/pkgconfig' |
17 QTDIR='$(HOST_PREFIX)' | 27 |
18 | 28 ifeq ($(MXE_SYSTEM),msvc) |
29 # NMAKE is perturbed by the values of MAKE and MAKEFLAGS defined by GNU | |
30 # make. These need to be unset even when running configure script, as | |
31 # this will run NMAKE to compile QMAKE. | |
32 $(PKG)_CONFIGURE_ENV += MAKE= MAKEFLAGS= | |
33 endif | |
19 else | 34 else |
20 $(PKG)_DEPS := openssl zlib libpng jpeg libmng tiff dbus | |
21 | |
22 $(PKG)_CONFIGURE_ENV := \ | 35 $(PKG)_CONFIGURE_ENV := \ |
23 OPENSSL_LIBS="`'$(MXE_PKG_CONFIG)' --libs-only-l openssl`" \ | 36 OPENSSL_LIBS="`'$(MXE_PKG_CONFIG)' --libs-only-l openssl`" \ |
24 PSQL_LIBS="-lpq -lsecur32 `'$(MXE_PKG_CONFIG)' --libs-only-l openssl` -lws2_32" \ | 37 PSQL_LIBS="-lpq -lsecur32 `'$(MXE_PKG_CONFIG)' --libs-only-l openssl` -lws2_32" \ |
25 SYBASE_LIBS="-lsybdb `'$(MXE_PKG_CONFIG)' --libs-only-l gnutls` -liconv -lws2_32" | 38 SYBASE_LIBS="-lsybdb `'$(MXE_PKG_CONFIG)' --libs-only-l gnutls` -liconv -lws2_32" |
26 | |
27 endif | 39 endif |
28 | 40 # compile-in generic ODBC driver under Windows |
41 $(PKG)_CONFIGURE_DATABASE_OPTION += -plugin-sql-odbc | |
29 else | 42 else |
30 $(PKG)_DEPS := openssl zlib libpng jpeg libmng tiff dbus | |
31 | |
32 $(PKG)_CONFIGURE_ENV := \ | 43 $(PKG)_CONFIGURE_ENV := \ |
33 CPPFLAGS='$(HOST_INCDIR)/dbus-1.0' \ | 44 CPPFLAGS='$(HOST_INCDIR)/dbus-1.0' \ |
34 LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)' | 45 LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)' |
35 endif | 46 endif |
36 | 47 |
37 ifeq ($(MXE_NATIVE_BUILD),yes) | 48 ifeq ($(MXE_NATIVE_BUILD),yes) |
38 $(PKG)_CONFIGURE_INCLUDE_OPTION := -I '$(HOST_INCDIR)' | 49 $(PKG)_CONFIGURE_INCLUDE_OPTION += -I '$(HOST_INCDIR)' |
39 $(PKG)_CONFIGURE_LIBPATH_OPTION := -L '$(HOST_LIBDIR)' | 50 $(PKG)_CONFIGURE_LIBPATH_OPTION += -L '$(HOST_LIBDIR)' |
40 endif | 51 endif |
41 | 52 |
42 ifeq ($(MXE_NATIVE_MINGW_BUILD),yes) | 53 ifeq ($(MXE_NATIVE_MINGW_BUILD),yes) |
43 $(PKG)_CONFIGURE_CMD := configure.exe | 54 $(PKG)_CONFIGURE_CMD := configure.exe |
44 $(PKG)_CONFIGURE_DATABASE_OPTION := | 55 ifeq ($(MXE_SYSTEM),msvc) |
45 $(PKG)_CONFIGURE_PLATFORM_OPTION := -platform win32-g++ | 56 # FIXME: the "2010" suffix should be computed dynamically |
46 $(PKG)_CONFIGURE_EXTRA_OPTION := | 57 $(PKG)_CONFIGURE_PLATFORM_OPTION := -platform win32-msvc2010 |
58 # mimic typical Linux installation | |
59 $(PKG)_CONFIGURE_EXTRA_OPTION += \ | |
60 -docdir '$(HOST_LIBDIR)/qt4/doc' \ | |
61 -plugindir '$(HOST_LIBDIR)/qt4/plugins' \ | |
62 -importdir '$(HOST_LIBDIR)/qt4/imports' \ | |
63 -datadir '$(HOST_LIBDIR)/qt4' \ | |
64 -translationdir '$(HOST_LIBDIR)/qt4/translations' \ | |
65 -examplesdir '$(HOST_LIBDIR)/qt4/examples' \ | |
66 -demosdir '$(HOST_LIBDIR)/qt4/demos' | |
67 $(PKG)_MKSPECS := '$(HOST_LIBDIR)/qt4' | |
68 else | |
69 $(PKG)_CONFIGURE_PLATFORM_OPTION := -platform win32-g++ | |
70 endif | |
71 # OPENSSL_LIBS needs to be specified here, specifying it as environment | |
72 # variables *before* "configure.exe" doesn't work. Also compile-in D-BUS | |
73 # support, for what it's worth... | |
74 $(PKG)_CONFIGURE_EXTRA_OPTION += \ | |
75 -openssl-linked \ | |
76 OPENSSL_LIBS="`PKG_CONFIG_PATH='$(HOST_PREFIX)/lib/pkgconfig' '$(MXE_PKG_CONFIG)' --libs-only-l openssl`" \ | |
77 -dbus-linked | |
47 else | 78 else |
48 $(PKG)_CONFIGURE_CMD := configure | 79 $(PKG)_CONFIGURE_CMD := configure |
49 $(PKG)_CONFIGURE_EXTRA_OPTION := \ | 80 $(PKG)_CONFIGURE_EXTRA_OPTION := \ |
50 -prefix-install \ | 81 -prefix-install \ |
51 -make libs \ | 82 -make libs \ |
75 endef | 106 endef |
76 | 107 |
77 define $(PKG)_BUILD | 108 define $(PKG)_BUILD |
78 ## syncqt needs QTDIR set to find the sources | 109 ## syncqt needs QTDIR set to find the sources |
79 cd '$(1)' && QTDIR='$(1)' ./bin/syncqt | 110 cd '$(1)' && QTDIR='$(1)' ./bin/syncqt |
80 cd '$(1)' && \ | 111 cd '$(1)' && QTDIR='$(1)' \ |
81 $($(PKG)_CONFIGURE_ENV) \ | 112 $($(PKG)_CONFIGURE_ENV) \ |
82 ./$($(PKG)_CONFIGURE_CMD) \ | 113 ./$($(PKG)_CONFIGURE_CMD) \ |
83 $($(PKG)_CONFIGURE_INCLUDE_OPTION) \ | 114 $($(PKG)_CONFIGURE_INCLUDE_OPTION) \ |
84 $($(PKG)_CONFIGURE_LIBPATH_OPTION) \ | 115 $($(PKG)_CONFIGURE_LIBPATH_OPTION) \ |
85 -opensource \ | 116 -opensource \ |
89 $($(PKG)_CONFIGURE_CROSS_COMPILE_OPTION) \ | 120 $($(PKG)_CONFIGURE_CROSS_COMPILE_OPTION) \ |
90 $($(PKG)_CONFIGURE_EXTRA_OPTION) \ | 121 $($(PKG)_CONFIGURE_EXTRA_OPTION) \ |
91 -release \ | 122 -release \ |
92 -exceptions \ | 123 -exceptions \ |
93 -shared \ | 124 -shared \ |
94 -prefix '$(HOST_PREFIX)' \ | 125 -prefix $($(PKG)_PREFIX) \ |
95 -script \ | 126 -script \ |
96 -no-iconv \ | 127 -no-iconv \ |
97 -opengl desktop \ | 128 -opengl desktop \ |
98 -no-webkit \ | 129 -no-webkit \ |
99 -no-phonon \ | 130 -no-phonon \ |
108 -system-libjpeg \ | 139 -system-libjpeg \ |
109 -system-libtiff \ | 140 -system-libtiff \ |
110 -system-libmng \ | 141 -system-libmng \ |
111 -no-sse2 | 142 -no-sse2 |
112 | 143 |
144 if test x$(MXE_SYSTEM) = xmsvc; then \ | |
145 for f in $(1)/mkspecs/win32-msvc*/qmake.conf; do \ | |
146 sed -i -e 's/@@LIBRARY_PREFIX@@/$(LIBRARY_PREFIX)/g' \ | |
147 -e 's/@@LIBRARY_SUFFIX@@/$(LIBRARY_SUFFIX)/g' $$f; \ | |
148 done; \ | |
149 fi | |
150 | |
113 # need to 'install' mkspecs for the native mingw to build during its build | 151 # need to 'install' mkspecs for the native mingw to build during its build |
114 if [ "$(MXE_NATIVE_MINGW_BUILD)" = yes ]; then \ | 152 if [ "$(MXE_NATIVE_MINGW_BUILD)" = yes ]; then \ |
115 cp -r '$(1)/mkspecs' '$(HOST_PREFIX)/'; \ | 153 mkdir -p '$($(PKG)_MKSPECS)'; \ |
116 fi | 154 cp -r '$(1)/mkspecs' '$($(PKG)_MKSPECS)'; \ |
117 | 155 fi |
118 $(MAKE) -C '$(1)' -j '$(JOBS)' | 156 |
119 $(MAKE) -C '$(1)' -j 1 install | 157 # compilation under MSVC requires the use of NMAKE, which does not |
158 # support the -j option flag and is perturbed by GNU make values for | |
159 # MAKE and MAKEFLAGS; also remove unnecessary DLL installed in lib/ | |
160 if test x$(MXE_SYSTEM) = xmsvc; then \ | |
161 cd '$(1)' && \ | |
162 env -u MAKE -u MAKEFLAGS PKG_CONFIG_PATH='$(HOST_PREFIX)/lib/pkgconfig' nmake && \ | |
163 env -u MAKE -u MAKEFLAGS PKG_CONFIG_PATH='$(HOST_PREFIX)/lib/pkgconfig' nmake install && \ | |
164 rm -f $(HOST_PREFIX)/lib/$(LIBRARY_PREFIX)Qt*.dll; \ | |
165 else \ | |
166 make -C '$(1)' -j '$(JOBS)' && \ | |
167 make -C '$(1)' -j 1 install; \ | |
168 fi | |
120 | 169 |
121 # native build doesnt seem to succeed with installing pkgconfig files to prefix | 170 # native build doesnt seem to succeed with installing pkgconfig files to prefix |
122 # in addition, .pc files have the wrong paths, mangled lib names | 171 # in addition, .pc files have the wrong paths, mangled lib names |
123 if [ "$(MXE_NATIVE_MINGW_BUILD)" = yes ]; then \ | 172 if [ "$(MXE_NATIVE_MINGW_BUILD)" = yes -a "$(MXE_SYSTEM)" != msvc ]; then \ |
124 find $(1)/lib/pkgconfig/*.pc -exec $(SED) -i \ | 173 find $(1)/lib/pkgconfig/*.pc -exec $(SED) -i \ |
125 -e 's,\(.*\)_location=.*,\1_location=$(HOST_BINDIR)/\1,g' \ | 174 -e 's,\(.*\)_location=.*,\1_location=$${prefix}/bin/\1,g' \ |
126 -e 's,\(Libs:.* -l\).*[\\/]\([A-Za-z0-9]*\),\1\2,g' \ | 175 -e 's,\(Libs:.* -l\).*[\\/]\([A-Za-z0-9]*\),\1\2,g' \ |
127 '{}' ';' ; \ | 176 '{}' ';' ; \ |
128 cp -f '$(1)/lib/pkgconfig/'*.pc '$(HOST_LIBDIR)/pkgconfig/'; \ | 177 cp -f '$(1)/lib/pkgconfig/'*.pc '$(HOST_LIBDIR)/pkgconfig/'; \ |
129 fi | 178 fi |
130 | 179 |
131 $(LN_SF) '$(HOST_BINDIR)/moc' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)moc' | 180 # using if-function, this allows to keep the code structure untouched, |
132 $(LN_SF) '$(HOST_BINDIR)/rcc' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)rcc' | 181 # including the comments, however one must make sure there is no comma |
133 $(LN_SF) '$(HOST_BINDIR)/uic' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)uic' | 182 $(if $(filter-out msvc,$(MXE_SYSTEM)), |
134 $(LN_SF) '$(HOST_BINDIR)/qmake' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)qmake' | 183 $(LN_SF) '$($(PKG)_PREFIX)/bin/moc' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)moc' |
135 | 184 $(LN_SF) '$($(PKG)_PREFIX)/bin/rcc' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)rcc' |
136 # cd '$(1)/tools/assistant' && '$(1)/bin/qmake' assistant.pro | 185 $(LN_SF) '$($(PKG)_PREFIX)/bin/uic' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)uic' |
137 # $(MAKE) -C '$(1)/tools/assistant' -j '$(JOBS)' install | 186 $(LN_SF) '$($(PKG)_PREFIX)/bin/qmake' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)qmake' |
138 | 187 |
139 # cd '$(1)/tools/designer' && '$(1)/bin/qmake' designer.pro | 188 # cd '$(1)/tools/assistant' && '$(1)/bin/qmake' assistant.pro |
140 # $(MAKE) -C '$(1)/tools/designer' -j '$(JOBS)' install | 189 # $(MAKE) -C '$(1)/tools/assistant' -j '$(JOBS)' install |
141 | 190 |
142 # # at least some of the qdbus tools are useful on target | 191 # cd '$(1)/tools/designer' && '$(1)/bin/qmake' designer.pro |
143 # cd '$(1)/tools/qdbus' && '$(1)/bin/qmake' qdbus.pro | 192 # $(MAKE) -C '$(1)/tools/designer' -j '$(JOBS)' install |
144 # $(MAKE) -C '$(1)/tools/qdbus' -j '$(JOBS)' install | 193 |
145 | 194 # # at least some of the qdbus tools are useful on target |
146 # lrelease (from linguist) needed by octave for GUI build | 195 # cd '$(1)/tools/qdbus' && '$(1)/bin/qmake' qdbus.pro |
147 $(MAKE) -C '$(1)/tools/linguist/lrelease' -j '$(JOBS)' install | 196 # $(MAKE) -C '$(1)/tools/qdbus' -j '$(JOBS)' install |
148 $(LN_SF) '$(HOST_BINDIR)/lrelease' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)lrelease' | 197 |
149 | 198 # lrelease (from linguist) needed by octave for GUI build |
150 # mkdir '$(1)/test-qt' | 199 $(MAKE) -C '$(1)/tools/linguist/lrelease' -j '$(JOBS)' install |
151 # cd '$(1)/test-qt' && '$(MXE_QMAKE)' '$(PWD)/$(2).pro' | 200 $(LN_SF) '$($(PKG)_PREFIX)/bin/lrelease' '$(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)lrelease' |
152 # $(MAKE) -C '$(1)/test-qt' -j '$(JOBS)' | 201 |
153 # $(INSTALL) -m755 '$(1)/test-qt/release/test-qt.exe' '$(HOST_BINDIR)' | 202 # mkdir '$(1)/test-qt' |
203 # cd '$(1)/test-qt' && '$(MXE_QMAKE)' '$(PWD)/$(2).pro' | |
204 # $(MAKE) -C '$(1)/test-qt' -j '$(JOBS)' | |
205 # $(INSTALL) -m755 '$(1)/test-qt/release/test-qt.exe' '$(HOST_BINDIR)') | |
154 endef | 206 endef |