summaryrefslogtreecommitdiff
path: root/mxe.sh
blob: 2ba3470a053e6d1ae85f0b98d1c7768fd0d4c734 (plain) (blame)
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
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
export CROSS=i686-w64-mingw32.shared
cross_req="cc smpeg ffmpeg sdl sdl_image sdl_ttf sdl_net sdl_gfx libxml2 curl libpng zlib gettext sdl_mixer gdb"
docker_req="gcc g++ python autoconf automake autopoint bash bison bzip2 flex gettext git gperf intltoolize libtool lzip make makensis openssl p7zip patch perl ruby sed unzip wget lzma"


req_check()
{
    echo "*** sys-info *** >---------------------------------------------------"
    uname -a
    req_err=""
    for req in $docker_req; do
        if ! command -v $req > /dev/null 2>&1; then
          req_err="$req_err $req";  
        fi
    done
    if [ "$req_err" != "" ]; then
        echo "! missing req: $req_err !";
        exit 1;
    fi
    echo "*** sys-info *** <---------------------------------------------------"
}

mxe()
{
    echo "*** mxe-build *** >--------------------------------------------------"
    cd /
    git clone https://github.com/mxe/mxe.git
    cd mxe

    sha=885cc27552e242bbd0b7656716d14d114fb269e1
    git reset --hard $sha
    
    # mxe params to settings.mk
    echo "MXE_TARGETS := ${CROSS}" > settings.mk
    echo "LOCAL_PKG_LIST := ${cross_req}" >> settings.mk
    echo ".DEFAULT_GOAL  := local-pkg-list" >> settings.mk
    echo 'local-pkg-list: $(LOCAL_PKG_LIST)' >> settings.mk
    
    # mxe patch
    git apply ../mxe.patch || exit 1

    # make mxe
    make || exit 1

    # sdl patch
    sed -i 's|#define GL_GLEXT_VERSION 29|#ifndef GL_GLEXT_VERSION\n#define GL_GLEXT_VERSION 29\n#endif|' /mxe/usr/${CROSS}/include/SDL/SDL_opengl.h
    
    # cleanup downloads & logs
    make clean-junk || exit 1
    cp /mxe/usr/${CROSS}/bin/gdb.exe /build/ || exit 1
    echo "*** mxe-build *** <--------------------------------------------------"
}


test_mxe()
{
    export PATH=/mxe/usr/bin:/mxe/usr/${CROSS}/bin:$PATH
    echo `${CROSS}-gcc --version`
    echo `${CROSS}-g++ --version`
    echo "${PATH}"
}

req_check
mxe
test_mxe