summaryrefslogtreecommitdiffstats
path: root/src/ocaml-findlib.mk
blob: db9b2f76855ca4d7d45a7f8b10837c41112c1db2 (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
59
60
61
# This file is part of MXE.
# See index.html for further information.

PKG             := ocaml-findlib
$(PKG)_IGNORE   :=
$(PKG)_VERSION  := 1.4
$(PKG)_CHECKSUM := 6e4065e5d79d31176ec213ff94599c4eae17c3904c2896e845d0379a99f1bdf8
$(PKG)_SUBDIR   := findlib-$($(PKG)_VERSION)
$(PKG)_FILE     := findlib-$($(PKG)_VERSION).tar.gz
$(PKG)_URL      := http://download.camlcity.org/download/$($(PKG)_FILE)
$(PKG)_DEPS     := gcc ocaml-core

define $(PKG)_UPDATE
    $(WGET) -q -O- 'http://download.camlcity.org/download' | \
    $(SED) -n 's,.*findlib-\([0-9][^>]*\)\.tar.*,\1,ip' | \
    $(SORT) | \
    tail -1
endef

define $(PKG)_BUILD
    # build
    rm -f $(1)/src/findlib/ocaml_args.ml
    cd '$(1)' && \
        PATH="$(PREFIX)/$(TARGET)/bin/ocaml-native:$(PATH)" \
        ./configure \
            -config $(PREFIX)/$(TARGET)/etc/findlib.conf \
            -bindir $(PREFIX)/$(TARGET)/bin \
            -sitelib $(PREFIX)/$(TARGET)/lib/ocaml \
            -mandir $(PREFIX)/$(TARGET)/share/man \
            -with-toolbox \
            -no-topfind

    # no-topfind because it wants to be installed in /usr/bin, and creates blocking
    # error
    $(MAKE) -C '$(1)' -j '$(JOBS)' PATH="$(PREFIX)/$(TARGET)/bin/ocaml-native:$(PATH)" all
    $(MAKE) -C '$(1)' -j '$(JOBS)' PATH="$(PREFIX)/$(TARGET)/bin/ocaml-native:$(PATH)" opt

    # Install findlib
    $(MAKE) -C '$(1)' -j '$(JOBS)' install
    cp -f $(PREFIX)/$(TARGET)/bin/ocamlfind $(PREFIX)/bin/$(TARGET)-ocamlfind
    # Override etc/findlib.conf with our own version
    rm -f $(PREFIX)/$(TARGET)/etc/findlib.conf
    (echo 'stdlib="$(PREFIX)/$(TARGET)/lib/ocaml"'; \
     echo 'ldconf="$(PREFIX)/$(TARGET)/lib/ocaml/ld.conf"'; \
     echo 'destdir="$(PREFIX)/$(TARGET)/lib/ocaml"'; \
     echo 'path="$(PREFIX)/$(TARGET)/lib/ocaml"'; \
     echo 'ocamlc="$(TARGET)-ocamlc"'; \
     echo 'ocamlopt="$(TARGET)-ocamlopt"'; \
     echo 'ocamldep="$(TARGET)-ocamldep"') \
     > $(PREFIX)/$(TARGET)/etc/findlib.conf

    # test
    '$(TARGET)-ocamlfind' opt \
        -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
        < '$(TEST_FILE)'

endef

$(PKG)_BUILD_x86_64-w64-mingw32 =

$(PKG)_BUILD_SHARED =