aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..cdc1bd2
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,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