summaryrefslogtreecommitdiffstats
path: root/plugins/examples
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2016-07-15 09:04:08 (GMT)
committerTony Theodore <tonyt@logyst.com>2016-07-16 06:53:58 (GMT)
commite9299c020403c851472bef7cb685a57f936a5fde (patch)
treef6386ec5e09de2f1855638f86e492777f1b00eda /plugins/examples
parent109e905f56492c3a67248be800e9e668d0a96c15 (diff)
downloadmxe-e9299c020403c851472bef7cb685a57f936a5fde.zip
mxe-e9299c020403c851472bef7cb685a57f936a5fde.tar.gz
mxe-e9299c020403c851472bef7cb685a57f936a5fde.tar.bz2
host-toolchain plugin: add pkgconf/pkg-config
Diffstat (limited to 'plugins/examples')
-rw-r--r--plugins/examples/host-toolchain/README.md11
-rw-r--r--plugins/examples/host-toolchain/pkgconf-host.mk47
2 files changed, 58 insertions, 0 deletions
diff --git a/plugins/examples/host-toolchain/README.md b/plugins/examples/host-toolchain/README.md
index da27d42..cecefd4 100644
--- a/plugins/examples/host-toolchain/README.md
+++ b/plugins/examples/host-toolchain/README.md
@@ -48,6 +48,17 @@ terminal emulators:
Make is difficult to cross-compile so it is downloaded from the [source
recommended by the GNU Make team](http://git.savannah.gnu.org/cgit/make.git/tree/README.W32.template).
+#### pkgconf/pkg-config
+
+```
+make pkgconf-host MXE_PLUGIN_DIRS=plugins/examples/host-toolchain/
+```
+
+This will cross-compile `pkgconf` and create the `pkg-config` wrapper. The
+wrapper requires `/bin/sh` so one of the [MSYS2][msys2] options should be used.
+Run the `usr/{target}/bin/test-pkgconf-host` script to build `libffi` test
+with non-standard include paths.
+
#### Qt5 tools (`qmake.exe`, `rcc.exe`, etc.)
```
diff --git a/plugins/examples/host-toolchain/pkgconf-host.mk b/plugins/examples/host-toolchain/pkgconf-host.mk
new file mode 100644
index 0000000..c44230b
--- /dev/null
+++ b/plugins/examples/host-toolchain/pkgconf-host.mk
@@ -0,0 +1,47 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := pkgconf-host
+$(PKG)_IGNORE = $(pkgconf_IGNORE)
+$(PKG)_VERSION = $(pkgconf_VERSION)
+$(PKG)_CHECKSUM = $(pkgconf_CHECKSUM)
+$(PKG)_SUBDIR = $(pkgconf_SUBDIR)
+$(PKG)_FILE = $(pkgconf_FILE)
+$(PKG)_URL = $(pkgconf_URL)
+$(PKG)_URL_2 = $(pkgconf_URL_2)
+$(PKG)_DEPS := gcc libffi
+
+define $(PKG)_UPDATE
+ echo $(pkgconf_VERSION)
+endef
+
+define $(PKG)_BUILD
+ cd '$(1)' && ./autogen.sh
+ cd '$(1)' && ./configure \
+ $(MXE_CONFIGURE_OPTS)
+ $(MAKE) -C '$(1)' -j '$(JOBS)'
+ $(MAKE) -C '$(1)' -j 1 install
+
+ # create pkg-config script with relative paths
+ (echo '#!/bin/sh'; \
+ echo 'PKG_CONFIG_PATH="../qt5/lib/pkgconfig":"$$PKG_CONFIG_PATH_$(subst .,_,$(subst -,_,$(TARGET)))" \
+ PKG_CONFIG_LIBDIR='\''../lib/pkgconfig'\'' \
+ exec '../bin/pkgconf' \
+ $(if $(BUILD_STATIC),--static) \
+ --define-variable=prefix=.. \
+ "$$@"' \
+ ) > '$(PREFIX)/$(TARGET)/bin/pkg-config'
+ chmod 0755 '$(PREFIX)/$(TARGET)/bin/pkg-config'
+
+ # test compilation on host with libffi in non-std prefix
+ cp '$(PWD)/src/libffi-test.c' '$(PREFIX)/$(TARGET)/bin/test-$(PKG).c'
+ (echo '#!/bin/sh'; \
+ echo 'export PATH=../bin:$PATH'; \
+ echo 'gcc -v \
+ -W -Wall -Werror -ansi -pedantic \
+ test-$(PKG).c -o test-$(PKG).exe \
+ `pkg-config --cflags --libs libffi`'; \
+ echo 'test-$(PKG).exe'; \
+ ) > '$(PREFIX)/$(TARGET)/bin/test-$(PKG)'
+ chmod 0755 '$(PREFIX)/$(TARGET)/bin/test-$(PKG)'
+endef