add host toolchain example plugin

pull/1397/head
Tony Theodore 8 years ago
parent c21bf8a169
commit ff8278ad07

@ -0,0 +1,24 @@
Cross Compiling a Host Toolchain
--------------------------------
This plugin demonstrates a minimal working toolchain built with MXE to
execute on a Windows host. To build:
```
make gcc-host MXE_PLUGIN_DIRS=plugins/examples/host-toolchain/
```
This will run the usual steps to build a cross-compiler, then build a
second pass to cross-compile the basic toolchain (`binutils` and `gcc`).
Once complete, copy `usr/{target}` to an appropriate Windows machine
and execute the `usr\{target}\bin\test-gcc-host.bat` batch file. This
builds and runs the `libgomp` test as a sanity check.
Why?
----
Simply for curiosity, it's hard to see a practical use for this. Certainly,
attempting to use it as a way to bootstrap MXE on Windows would strain
one's sanity and cross-compiling is the recommended way (even if that means
running a Linux VM on Windows).

@ -0,0 +1,26 @@
# This file is part of MXE.
# See index.html for further information.
PKG := binutils-host
$(PKG)_IGNORE = $(binutils_IGNORE)
$(PKG)_VERSION = $(binutils_VERSION)
$(PKG)_CHECKSUM = $(binutils_CHECKSUM)
$(PKG)_SUBDIR = $(binutils_SUBDIR)
$(PKG)_FILE = $(binutils_FILE)
$(PKG)_URL = $(binutils_URL)
$(PKG)_URL_2 = $(binutils_URL_2)
$(PKG)_DEPS := gcc
define $(PKG)_UPDATE
echo $(binutils_VERSION)
endef
define $(PKG)_BUILD
$(subst --disable-werror,\
--disable-werror \
--prefix='$(PREFIX)/$(TARGET)' \
--host='$(TARGET)',\
$(binutils_BUILD))
#rm -rf '$(PREFIX)/$(TARGET)/$(TARGET)'
endef

@ -0,0 +1,50 @@
# This file is part of MXE.
# See index.html for further information.
PKG := gcc-host
$(PKG)_IGNORE = $(gcc_IGNORE)
$(PKG)_VERSION = $(gcc_VERSION)
$(PKG)_CHECKSUM = $(gcc_CHECKSUM)
$(PKG)_SUBDIR = $(gcc_SUBDIR)
$(PKG)_FILE = $(gcc_FILE)
$(PKG)_URL = $(gcc_URL)
$(PKG)_URL_2 = $(gcc_URL_2)
$(PKG)_DEPS := gcc binutils-host cloog gmp isl mpfr mpc
define $(PKG)_UPDATE
echo $(gcc_VERSION)
endef
define $(PKG)_BUILD
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
--host='$(TARGET)' \
--target='$(TARGET)' \
--build='$(BUILD)' \
--prefix='$(PREFIX)/$(TARGET)' \
--with-native-system-header-dir='$(PREFIX)/$(TARGET)/include' \
--enable-languages='c,c++,objc,fortran' \
--enable-version-specific-runtime-libs \
--with-gcc \
--with-gnu-ld \
--with-gnu-as \
--disable-nls \
$(if $(BUILD_STATIC),--disable-shared) \
--disable-multilib \
--without-x \
--disable-win32-registry \
--enable-threads=$(MXE_GCC_THREADS) \
--enable-libgomp \
--with-{cloog,gmp,isl,mpc,mpfr}='$(PREFIX)/$(TARGET)'
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 install
# test compilation on host
cp '$(TOP_DIR)/src/pthreads-libgomp-test.c' '$(PREFIX)/$(TARGET)/bin/test-$(PKG).c'
(printf 'set PATH=..\\bin;%%PATH%%\r\n'; \
printf 'gcc test-$(PKG).c -o test-$(PKG).exe -fopenmp -v\r\n'; \
printf 'test-$(PKG).exe\r\n'; \
printf 'pause\r\n';) \
> '$(PREFIX)/$(TARGET)/bin/test-$(PKG).bat'
endef
Loading…
Cancel
Save