File: library-test

package info (click to toggle)
mlton 20130715-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 60,900 kB
  • ctags: 69,386
  • sloc: xml: 34,418; ansic: 17,399; lisp: 2,879; makefile: 1,605; sh: 1,254; pascal: 256; python: 143; asm: 97
file content (37 lines) | stat: -rwxr-xr-x 882 bytes parent folder | download | duplicates (5)
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
#! /usr/bin/env bash

ML=../../build/bin/mlton

O[0]='-default-ann'
O[1]='allowFFI true'
O[2]='-link-opt'
O[3]='-L.'

LIB="-link-opt -l"

# Enable finding libraries locally
export LD_LIBRARY_PATH=.

set -ex

# Compile DSO #1
$ML "${O[@]}" "$@" -format libarchive libm1.sml libm1.c
$ML "${O[@]}" "$@" ${LIB}m1 -format library libm2.sml libm2.c

# Compile DSO #2
$ML "${O[@]}" "$@" -format libarchive libm3.sml libm3.c
$ML "${O[@]}" "$@" ${LIB}m3 ${LIB}m2 -format library libm4.sml libm4.c

# Compile executable
$ML "${O[@]}" "$@" -format archive libm5.sml libm5.c
$ML "${O[@]}" "$@" ${LIB}m5 ${LIB}m4 -format executable \
  -default-ann 'allowFFI true' -export-header check.h check.sml check.c

# Check that symbols resolved correctly
./check | sed '' > check.log

# Confirm expected output
set +x
diff -u check.ok check.log
echo '********** PASS:' "$@" '**********'
rm -f check.log