summaryrefslogtreecommitdiffstats
path: root/build/otherlibs-targets.sh
blob: bd28a0dc98001e7cc553def7b1042f4da06fa3e1 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh

#########################################################################
#                                                                       #
#                                 OCaml                                 #
#                                                                       #
#         Nicolas Pouillard, projet Gallium, INRIA Rocquencourt         #
#                                                                       #
#   Copyright 2008 Institut National de Recherche en Informatique et    #
#   en Automatique.  All rights reserved.  This file is distributed     #
#   under the terms of the Q Public License version 1.0.                #
#                                                                       #
#########################################################################

OTHERLIBS_BYTE=""
OTHERLIBS_NATIVE=""
OTHERLIBS_UNIX_NATIVE=""
UNIXDIR="otherlibs/unix"

add_native() {
  for native_file in $@; do
    OTHERLIBS_NATIVE="$OTHERLIBS_NATIVE otherlibs/$lib/$native_file"
    case $lib in
    unix|win32unix)
      OTHERLIBS_UNIX_NATIVE="$OTHERLIBS_UNIX_NATIVE otherlibs/$lib/$native_file";;
    esac
  done
}

add_byte() {
  for byte_file in $@; do
    OTHERLIBS_BYTE="$OTHERLIBS_BYTE otherlibs/$lib/$byte_file"
  done
}

add_file() {
  add_byte $@
  add_native $@
}

add_bin() {
  for bin_file in $@; do
    add_byte $bin_file.byte$EXE
    add_native $bin_file.native$EXE
  done
}

add_c_lib() {
  add_file "lib$1.$A"
}

add_ocaml_lib() {
  add_native "$1.cmxa"
  add_native "$1.$A"
  add_byte "$1.cma"
}

add_dll() {
  add_file "dll$1$EXT_DLL"
}

add() {
  add_c_lib $1
  add_ocaml_lib $1
  add_dll $1
}

THREADS_CMIS="thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi"

for lib in $OTHERLIBRARIES; do
  case $lib in
  num)
    add nums;;
  systhreads)
    add_ocaml_lib threads
    add_dll threads
    add_file $THREADS_CMIS
    add_byte libthreads.$A
    add_native libthreadsnat.$A;;
  graph|win32graph)
    add graphics;;
  threads)
    add_byte pervasives.cmi pervasives.mli \
             $THREADS_CMIS marshal.cmi marshal.mli \
             stdlib.cma unix.cma threads.cma libvmthreads.$A;;
  labltk)
    add_file      support/camltk.h
    add_byte      support/byte.otarget
    add_native    support/native.otarget
    add_file      support/liblabltk.$A
    add_byte      compiler/tkcompiler$EXE compiler/pp$EXE
    add_file      labltk/tk.ml labltk/labltk.ml
    add_byte      labltk/byte.otarget
    add_native    labltk/native.otarget
    add_byte      camltk/byte.otarget
    add_native    camltk/native.otarget
    add_ocaml_lib lib/labltk
    add_byte      lib/labltktop$EXE lib/labltk$EXE
    add_ocaml_lib jpf/jpflib
    add_ocaml_lib frx/frxlib
    add_byte      browser/ocamlbrowser$EXE
    ;;
  dbm)
    add_ocaml_lib dbm
    add_c_lib mldbm;;
  dynlink)
    add_ocaml_lib dynlink
    add_native dynlink.cmx dynlink.$O
    add_file $lib.cmi extract_crc;;
  win32unix)
    UNIXDIR="otherlibs/win32unix"
    add_file unixsupport.h cst2constr.h socketaddr.h
    add unix;;
  unix)
    add_file unixsupport.h
    add unix;;
  *)
    add $lib
  esac
done