summaryrefslogtreecommitdiffstats
path: root/plugins/examples/host-toolchain/pkgconf-host.mk
blob: c971044c04ae945a213ded0a936ed06d03cf8b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 '$(SOURCE_DIR)' && ./autogen.sh
    cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
        $(MXE_CONFIGURE_OPTS)
    $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
    $(MAKE) -C '$(BUILD_DIR)' -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