summaryrefslogtreecommitdiffstats
path: root/src/libmysqlclient.mk
blob: 58d1137253a9e4031ace325b33e0f281ec7d8241 (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             := libmysqlclient
$(PKG)_IGNORE   :=
$(PKG)_VERSION  := 6.1.6
$(PKG)_CHECKSUM := 2222433012c415871958b61bc4f3683e1ebe77e3389f698b267058c12533ea78
$(PKG)_SUBDIR   := mysql-connector-c-$($(PKG)_VERSION)-src
$(PKG)_FILE     := $($(PKG)_SUBDIR).tar.gz
$(PKG)_URL      := https://dev.mysql.com/get/Downloads/Connector-C/$($(PKG)_FILE)
$(PKG)_DEPS     := gcc pthreads openssl zlib

define $(PKG)_UPDATE
    $(WGET) -q -O- 'https://dev.mysql.com/downloads/connector/c/' | \
    $(SED) -n 's,.*mysql-connector-c-\([0-9\.]\+\)-win.*,\1,p' | \
    head -1
endef

define $(PKG)_BUILD
    # native build for tool comp_err
    # See https://bugs.mysql.com/bug.php?id=61340
    mkdir '$(1).native'
    cd '$(1).native' && cmake \
         '$(1)'
    $(MAKE) -C '$(1).native' -j '$(JOBS)' VERBOSE=1
    # cross-compilation
    mkdir '$(1).build'
    cd '$(1).build' && cmake \
        -DCMAKE_INSTALL_PREFIX=$(PREFIX)/$(TARGET) \
        -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
        -DIMPORT_COMP_ERR='$(1).native/ImportCompErr.cmake' \
        -DHAVE_GCC_ATOMIC_BUILTINS=1 \
        -DDISABLE_SHARED=$(CMAKE_STATIC_BOOL) \
        -DENABLE_DTRACE=OFF \
        -DWITH_ZLIB=system \
        '$(1)'

    # def file created by cmake creates link errors
    cp '$(PWD)/src/$(PKG).def' '$(1).build/libmysql/libmysql_exports.def'

    $(MAKE) -C '$(1).build' -j '$(JOBS)' VERBOSE=1
    $(MAKE) -C '$(1).build/include'  -j 1 install VERBOSE=1
    $(MAKE) -C '$(1).build/libmysql' -j 1 install VERBOSE=1

    # no easy way to configure location of dll
    -mv '$(PREFIX)/$(TARGET)/lib/$(PKG).dll' '$(PREFIX)/$(TARGET)/bin/'
endef