summaryrefslogtreecommitdiffstats
path: root/src/mxe-conf.mk
blob: ef67b471d026661ad0f44995278128d80e347c75 (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
48
49
50
51
52
53
54
55
56
57
58
# This file is part of MXE. See LICENSE.md for licensing information.

PKG            := mxe-conf
$(PKG)_VERSION := 1
$(PKG)_UPDATE  := echo 1
$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)

define $(PKG)_BUILD
    # create basic non-empty directory hierarchy
    for d in bin include lib share; do \
        mkdir -p "$(PREFIX)/$(TARGET)/$$d" && \
        touch    "$(PREFIX)/$(TARGET)/$$d/.gitkeep" ; \
    done

    # install target-specific autotools config file
    # setting ac_cv_build bypasses the config.guess check in every package
    echo "ac_cv_build=$(BUILD)" > '$(PREFIX)/$(TARGET)/share/config.site'

    # create pkg-config files for OpenGL/GLU
    mkdir -p '$(PREFIX)/$(TARGET)/lib/pkgconfig'
    (echo 'Name: gl'; \
     echo 'Version: 0'; \
     echo 'Description: OpenGL'; \
     echo 'Libs: -lopengl32';) \
     > '$(PREFIX)/$(TARGET)/lib/pkgconfig/gl.pc'
    (echo 'Name: glu'; \
     echo 'Version: 0'; \
     echo 'Description: OpenGL'; \
     echo 'Libs: -lglu32';) \
     > '$(PREFIX)/$(TARGET)/lib/pkgconfig/glu.pc'

endef

define $(PKG)_BUILD_$(BUILD)
    # install config.guess for general use
    mkdir -p '$(PREFIX)/bin'
    $(INSTALL) -m755 '$(EXT_DIR)/config.guess' '$(PREFIX)/bin/'

    # fail early if autotools can't autoreconf
    # 1. detect mismatches in installation locations
    # 2. ???
    (echo 'AC_INIT([mxe.cc], [1])'; \
     $(foreach PROG, autoconf automake libtool, \
         echo 'AC_PATH_PROG([$(call uc,$(PROG))], [$(PROG)])';) \
     echo 'PKG_PROG_PKG_CONFIG(0.16)'; \
     echo 'AC_OUTPUT') \
     > '$(1)/configure.ac'
    cd '$(1)' && autoreconf -fiv
    cd '$(1)' && ./configure

    #create script "wine" in a directory which is in PATH
    mkdir -p '$(PREFIX)/$(BUILD)/bin/'
    (echo '#!/usr/bin/env bash'; \
     echo 'exit 1'; \
    ) \
             > '$(PREFIX)/$(BUILD)/bin/wine'
    chmod 0755 '$(PREFIX)/$(BUILD)/bin/wine'
endef