aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: cdc1bd22ebe1589efd421e684b935d00ff8cc271 (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
#! /usr/bin/env bash

trap 'exit 1' ERR

build=build
libcult=libcult
libfe=libfrontend-elements
libbe=libbackend-elements
libxsd_fe=libxsd-frontend
xsd=xsd

pwd=`pwd`

MAKEFLAGS="-I$pwd/stage/include $MAKEFLAGS"

target=$1

if [ "$target" = "install" ]; then
  # Since we only want to install XSD, we will handle
  # this target at the end.
  target=
fi


# build
#
if [ ! -d $pwd/stage/include/build-* ]; then
  make -C $build install_prefix=$pwd/stage install
fi


# libcult
#
make $MAKEFLAGS -C $libcult/cult $target

if [ "$target" = "clean" ]; then
  rm -f $pwd/stage/include/cult
  rm -f $pwd/stage/lib/libcult.a
  rm -f $libcult/build/system/configuration-dynamic.make
else
  if [ ! -d $pwd/stage/include/cult ]; then
    ln -s ../../$libcult/cult stage/include/
    ln -s ../../$libcult/cult/libcult.a stage/lib/
  fi
fi


# libfrontend-elements
#
make $MAKEFLAGS -C $libfe/frontend-elements $target

if [ "$target" = "clean" ]; then
  rm -f $pwd/stage/include/frontend-elements
  rm -f $pwd/stage/lib/libfrontend-elements.a
else
  if [ ! -d $pwd/stage/include/frontend-elements ]; then
    ln -s ../../$libfe/frontend-elements stage/include/
    ln -s ../../$libfe/frontend-elements/libfrontend-elements.a stage/lib/
  fi
fi


# libbackend-elements
#
make $MAKEFLAGS -C $libbe/backend-elements $target

if [ "$target" = "clean" ]; then
  rm -f $pwd/stage/include/backend-elements
else
  if [ ! -d $pwd/stage/include/backend-elements ]; then
    ln -s ../../$libbe/backend-elements stage/include/
  fi
fi


# libxsd-frontend
#
make $MAKEFLAGS -C $libxsd_fe/xsd-frontend $target

if [ "$target" = "clean" ]; then
  rm -f $pwd/stage/include/xsd-frontend
  rm -f $pwd/stage/lib/libxsd-frontend.a
else
  if [ ! -d $pwd/stage/include/xsd-frontend ]; then
    ln -s ../../$libxsd_fe/xsd-frontend stage/include/
    ln -s ../../$libxsd_fe/xsd-frontend/libxsd-frontend.a stage/lib/
  fi
fi


# xsd
#
if [ "$target" = "clean" ]; then
  make $MAKEFLAGS -C $xsd clean
else
  make $MAKEFLAGS -C $xsd/xsd $target
fi

if [ "$target" = "clean" ]; then
  rm -f $pwd/stage/include/xsd
  rm -f $pwd/stage/bin/xsd
else
  if [ ! -d $pwd/stage/include/xsd ]; then
    ln -s ../../$xsd/libxsd/xsd stage/include/
    ln -s ../../$xsd/xsd/xsd stage/bin/
  fi
fi

if [ "$1" = "install" ]; then
make $MAKEFLAGS -C $xsd install
fi

# build (clean)
#
if [ "$target" = "clean" ]; then
  rm -rf $pwd/stage/include/build-*
fi