# This file is part of MXE.
# See index.html for further information.
PKG := qtbase
$(PKG)_IGNORE :=
$(PKG)_VERSION := 5.3.2
$(PKG)_CHECKSUM := faf4f33aa7e8dabcdcdf5f10824263beebbccd96
$(PKG)_SUBDIR := $(PKG)-opensource-src-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-opensource-src-$($(PKG)_VERSION).tar.xz
$(PKG)_URL := http://download.qt-project.org/official_releases/qt/5.3/$($(PKG)_VERSION)/submodules/$($(PKG)_FILE)
$(PKG)_DEPS := gcc postgresql freetds openssl harfbuzz zlib libpng jpeg sqlite pcre fontconfig freetype dbus icu4c
define $(PKG)_UPDATE
$(WGET) -q -O- http://download.qt-project.org/official_releases/qt/5.1/ | \
$(SED) -n 's,.*href="\(5\.[0-9]\.[^/]*\)/".*,\1,p' | \
grep -iv -- '-rc' | \
tail -1
endef
define $(PKG)_BUILD
cd '$(1)' && \
OPENSSL_LIBS="`'$(TARGET)-pkg-config' --libs-only-l openssl`" \
PSQL_LIBS="-lpq -lsecur32 `'$(TARGET)-pkg-config' --libs-only-l openssl` -lws2_32" \
SYBASE_LIBS="-lsybdb `'$(TARGET)-pkg-config' --libs-only-l gnutls` -liconv -lws2_32" \
./configure \
-opensource \
-confirm-license \
-xplatform win32-g++ \
-device-option CROSS_COMPILE=${TARGET}- \
-device-option PKG_CONFIG='${TARGET}-pkg-config' \
-force-pkg-config \
-release \
-static \
-prefix '$(PREFIX)/$(TARGET)/qt5' \
-icu \
-opengl desktop \
-no-glib \
-accessibility \
-nomake examples \
-nomake tests \
-no-sql-mysql \
-qt-sql-sqlite \
-qt-sql-odbc \
-qt-sql-psql \
-qt-sql-tds -D Q_USE_SYBASE \
-system-zlib \
-system-libpng \
-system-libjpeg \
-system-sqlite \
-fontconfig \
-system-freetype \
-system-harfbuzz \
-system-pcre \
-openssl-linked \
-dbus-linked \
-v
# invoke qmake with removed debug options as a workaround for
# https://bugreports.qt-project.org/browse/QTBUG-30898
$(MAKE) -C '$(1)' -j '$(JOBS)' QMAKE="$(1)/bin/qmake CONFIG-='debug debug_and_release'"
rm -rf '$(PREFIX)/$(TARGET)/qt5'
$(MAKE) -C '$(1)' -j 1 install
ln -sf '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PREFIX)/bin/$(TARGET)'-qmake-qt5
mkdir '$(1)/test-qt'
cd '$(1)/test-qt' && '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PWD)/src/qt-test.pro'
$(MAKE) -C '$(1)/test-qt' -j '$(JOBS)'
$(INSTALL) -m755 '$(1)/test-qt/release/test-qt5.exe' '$(PREFIX)/$(TARGET)/bin/'
# build test the manual way
mkdir '$(1)/test-$(PKG)-pkgconfig'
'$(PREFIX)/$(TARGET)/qt5/bin/uic' -o '$(1)/test-$(PKG)-pkgconfig/ui_qt-test.h' '$(TOP_DIR)/src/qt-test.ui'
'$(TARGET)-g++' \
-W -Wall -Werror -std=c++0x -pedantic \
'$(TOP_DIR)/src/qt-test.cpp' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG)-pkgconfig.exe' \
-I'$(1)/test-$(PKG)-pkgconfig' \
`'$(TARGET)-pkg-config' Qt5Widgets --cflags --libs`
# batch file to run test programs
(printf 'set PATH=..\\lib;..\\qt5\\bin;..\\qt5\\lib;%%PATH%%\r\n'; \
printf 'set QT_QPA_PLATFORM_PLUGIN_PATH=..\\qt5\\plugins\r\n'; \
printf 'test-qt5.exe\r\n'; \
printf 'test-qtbase-pkgconfig.exe\r\n';) \
> '$(PREFIX)/$(TARGET)/bin/test-qt5.bat'
endef
$(PKG)_BUILD_i686-pc-mingw32 =
$(PKG)_BUILD_SHARED = $(subst -static ,-shared ,\
$(subst -qt-sql-,-plugin-sql-,\
$($(PKG)_BUILD)))