Files
linuxkit/projects/miragesdk/pkg/mirage-compile/compile.sh
Thomas Gazagnaire 47b9f08b16 miragesdk: move files around
The new hiearchy is:
- pkg/{init,mirage-compile}: additional Moby packages
- src/sdk -> the begining of the MirageOS SDK for Moby
- src/dhcp-client -> the code for the MirageOS dhcp-client service

Signed-off-by: Thomas Gazagnaire <thomas@gazagnaire.org>
2017-03-29 13:39:20 +02:00

49 lines
587 B
Bash
Executable File

#!/bin/sh
set -e
usage() {
echo "Usage: -o file"
exit 1
}
[ $# = 0 ] && usage
while [ $# -gt 0 ]
do
flag="$1"
case "$flag" in
-o)
[ $# -eq 1 ] && usage
out="$2"
mkdir -p "$(dirname $2)"
shift
;;
*)
echo "Unknown option $1"
exit 1
esac
shift
done
[ -z "$out" ] && usage
package=$(basename "$out")
dir="/src"
# untar input
tar xf - -C $dir
(
cd $dir
opam config exec -- mirage configure -o $out -t unix
opam config exec -- make depend
opam config exec -- make
mv $(readlink $out) $out
) > /src/logs 2>&1
cd $dir && tar -cf - $out
exit 0