From 884922d11c7640edba9e9f7a6eee72261c39331d Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Thu, 14 Jul 2016 01:16:07 +1000 Subject: host-toolchain plugin: build qt5 test and cmake, add `make` binary download --- plugins/examples/host-toolchain/README.md | 11 ++++- plugins/examples/host-toolchain/binutils-host.mk | 3 +- plugins/examples/host-toolchain/cmake-host.mk | 23 +++++++++++ plugins/examples/host-toolchain/gcc-host.mk | 3 +- plugins/examples/host-toolchain/make-w32-bin.mk | 22 ++++++++++ plugins/examples/host-toolchain/qt5-host-tools.mk | 49 +++++++++++++++++------ 6 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 plugins/examples/host-toolchain/cmake-host.mk create mode 100644 plugins/examples/host-toolchain/make-w32-bin.mk diff --git a/plugins/examples/host-toolchain/README.md b/plugins/examples/host-toolchain/README.md index a22215e..0946909 100644 --- a/plugins/examples/host-toolchain/README.md +++ b/plugins/examples/host-toolchain/README.md @@ -23,8 +23,15 @@ builds and runs the `libgomp` test as a sanity check. make qt5-host-tools MXE_PLUGIN_DIRS=plugins/examples/host-toolchain/ ``` -This will build `qtbase` then run a second pass to cross-compile the qt tools -and install them to `usr/{target}/qt5-host-tools/bin`. +This will build `qtbase`, cross-compile the toolchain and qt tools, and +download `make` binaries from the source recommended by the GNU Make project. + +On a windows machine, execute +`usr\{target}\qt5\test-qt5-host-tools\test-qt5-host-tools.bat` to build and +confirm the normal `qt` test with the cross-compiled `qtbase` libraries. + +**N.B.** shared `gcc` doesn't work with the test program. To build a shared +test, use the additional option `gcc-host_CONFIGURE_OPTS=--disable-shared`. Why? ---- diff --git a/plugins/examples/host-toolchain/binutils-host.mk b/plugins/examples/host-toolchain/binutils-host.mk index 678fed8..bed45ea 100644 --- a/plugins/examples/host-toolchain/binutils-host.mk +++ b/plugins/examples/host-toolchain/binutils-host.mk @@ -22,5 +22,6 @@ define $(PKG)_BUILD --host='$(TARGET)',\ $(binutils_BUILD)) - #rm -rf '$(PREFIX)/$(TARGET)/$(TARGET)' + # tools seem to be duplicates of '$(PREFIX)/$(TARGET)' + rm -rf '$(PREFIX)/$(TARGET)/$(TARGET)' endef diff --git a/plugins/examples/host-toolchain/cmake-host.mk b/plugins/examples/host-toolchain/cmake-host.mk new file mode 100644 index 0000000..80a6521 --- /dev/null +++ b/plugins/examples/host-toolchain/cmake-host.mk @@ -0,0 +1,23 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := cmake-host +$(PKG)_IGNORE = $(cmake_IGNORE) +$(PKG)_VERSION = $(cmake_VERSION) +$(PKG)_CHECKSUM = $(cmake_CHECKSUM) +$(PKG)_SUBDIR = $(cmake_SUBDIR) +$(PKG)_FILE = $(cmake_FILE) +$(PKG)_URL = $(cmake_URL) +$(PKG)_URL_2 = $(cmake_URL_2) +$(PKG)_DEPS := gcc + +define $(PKG)_UPDATE + echo $(cmake_VERSION) +endef + +define $(PKG)_BUILD + mkdir '$(1).build' + cd '$(1).build' && '$(TARGET)-cmake' '$(1)' + $(MAKE) -C '$(1).build' -j '$(JOBS)' + $(MAKE) -C '$(1).build' -j 1 install +endef diff --git a/plugins/examples/host-toolchain/gcc-host.mk b/plugins/examples/host-toolchain/gcc-host.mk index d0e9076..2e6b3c8 100644 --- a/plugins/examples/host-toolchain/gcc-host.mk +++ b/plugins/examples/host-toolchain/gcc-host.mk @@ -36,7 +36,8 @@ define $(PKG)_BUILD --disable-win32-registry \ --enable-threads=$(MXE_GCC_THREADS) \ --enable-libgomp \ - --with-{cloog,gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' + --with-{cloog,gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)' \ + $($(PKG)_CONFIGURE_OPTS) $(MAKE) -C '$(1).build' -j '$(JOBS)' $(MAKE) -C '$(1).build' -j 1 install diff --git a/plugins/examples/host-toolchain/make-w32-bin.mk b/plugins/examples/host-toolchain/make-w32-bin.mk new file mode 100644 index 0000000..040916b --- /dev/null +++ b/plugins/examples/host-toolchain/make-w32-bin.mk @@ -0,0 +1,22 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := make-w32-bin +$(PKG)_IGNORE := +$(PKG)_VERSION := 4.2 +$(PKG)_CHECKSUM := 6cab11301e601996ab0cb7b3b903e5a55d5bd795614946cf6bd025cd61c710c6 +$(PKG)_SUBDIR := . +$(PKG)_FILE := make-$($(PKG)_VERSION)-without-guile-w32-bin.zip +$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/ezwinports/$($(PKG)_FILE) +$(PKG)_DEPS := + +define $(PKG)_UPDATE + $(WGET) -q -O- 'http://sourceforge.net/projects/ezwinports/files/' | \ + $(SED) -n 's,.*/make-\([0-9.]*\)-without-guile.*,\1,p' | \ + head -1 +endef + +define $(PKG)_BUILD + cp '$(1)/bin/'* '$(PREFIX)/$(TARGET)/bin/' + cp '$(1)/lib/'* '$(PREFIX)/$(TARGET)/lib/' +endef diff --git a/plugins/examples/host-toolchain/qt5-host-tools.mk b/plugins/examples/host-toolchain/qt5-host-tools.mk index 07fcacb..5e13ee2 100644 --- a/plugins/examples/host-toolchain/qt5-host-tools.mk +++ b/plugins/examples/host-toolchain/qt5-host-tools.mk @@ -5,7 +5,7 @@ PKG := $(basename $(notdir $(lastword $(MAKEFILE_LIST)))) $(PKG)_FILE = $(qtbase_FILE) $(PKG)_PATCHES = $(realpath $(sort $(wildcard $(addsuffix /qtbase-[0-9]*.patch, $(TOP_DIR)/src)))) $(PKG)_SUBDIR = $(qtbase_SUBDIR) -$(PKG)_DEPS := gcc qtbase +$(PKG)_DEPS := gcc gcc-host make-w32-bin qtbase # main configure options: -platform -host-option -external-hostbindir # further testing needed: -prefix -extprefix -hostprefix -sysroot -no-gcc-sysroot @@ -15,7 +15,7 @@ define $(PKG)_BUILD $(SED) -i 's,BUILD_ON_MAC=yes,BUILD_ON_MAC=no,g' '$(1)/configure' mkdir '$(1).build' cd '$(1).build' && '$(1)/configure' \ - -prefix '$(PREFIX)/$(TARGET)/$(PKG)' \ + -prefix '$(PREFIX)/$(TARGET)/qt5' \ -static \ -release \ -c++std c++11 \ @@ -25,6 +25,7 @@ define $(PKG)_BUILD -device-option PKG_CONFIG='${TARGET}-pkg-config' \ -device-option CROSS_COMPILE=${TARGET}- \ -force-pkg-config \ + -no-icu \ -no-sql-{db2,ibase,mysql,oci,odbc,psql,sqlite,sqlite2,tds} \ -no-use-gold-linker \ -nomake examples \ @@ -34,19 +35,41 @@ define $(PKG)_BUILD -continue \ -verbose - rm -rf '$(PREFIX)/$(TARGET)/$(PKG)' - # install qmake.exe (created by configure) - # and generate remaining build configuration + # generate remaining build configuration (qmake is created by configure) $(MAKE) -C '$(1).build' -j $(JOBS) \ - sub-qmake-qmake-aux-pro-install_subtargets \ sub-src-qmake_all - # build and install other tools + # build other tools $(MAKE) -C '$(1).build/src' -j $(JOBS) \ - sub-moc-install_subtargets \ - sub-qdbuscpp2xml-install_subtargets \ - sub-qdbusxml2cpp-install_subtargets \ - sub-qlalr-install_subtargets \ - sub-rcc-install_subtargets \ - sub-uic-install_subtargets + sub-{moc,qdbuscpp2xml,qdbusxml2cpp,qlalr,rcc,uic}-all + + # install tools and create `qt.conf` for runtime config + cp '$(1).build/bin'/*.exe '$(PREFIX)/$(TARGET)/qt5/bin/' + (printf '[Paths]\r\n'; \ + printf 'Prefix = ..\r\n'; \ + ) > '$(PREFIX)/$(TARGET)/qt5/bin/qt.conf' + + # test compilation on host + # windows can't work with symlinks + $(and $(BUILD_STATIC), + rm -f '$(PREFIX)/$(TARGET)/lib/libpng.a' && \ + cp '$(PREFIX)/$(TARGET)/lib/libpng16.a' '$(PREFIX)/$(TARGET)/lib/libpng.a'; + rm -f '$(PREFIX)/$(TARGET)/lib/libharfbuzz_too.a' && \ + cp '$(PREFIX)/$(TARGET)/lib/libharfbuzz.a' '$(PREFIX)/$(TARGET)/lib/libharfbuzz_too.a'; + ) + + # copy required test files and create batch file + mkdir -p '$(PREFIX)/$(TARGET)/qt5/test-$(PKG)' + cp '$(PWD)/src/qt-test.'* '$(PREFIX)/$(TARGET)/qt5/test-$(PKG)/' + cp '$(PWD)/src/qt.mk' '$(PREFIX)/$(TARGET)/qt5/test-$(PKG)/' + (printf 'set PWD=%%~dp0\r\n'; \ + printf 'set PATH=%%PWD%%..\\bin;%%PWD%%..\\..\\bin;%%PWD%%..\\lib;%%PWD%%..\\..\\lib;%%PATH%%\r\n'; \ + printf 'set QT_QPA_PLATFORM_PLUGIN_PATH=%%PWD%%..\\plugins\r\n'; \ + printf 'mkdir build\r\n'; \ + printf 'cd build\r\n'; \ + printf 'qmake ..\r\n'; \ + printf 'make -j $(JOBS)\r\n'; \ + printf '%%PWD%%\\build\\release\\test-qt5.exe\r\n'; \ + printf 'cmd\r\n'; \ + ) > '$(PREFIX)/$(TARGET)/qt5/test-$(PKG)/test-$(PKG).bat' endef -- cgit v0.12