Index: global/common.sh ================================================================== --- global/common.sh +++ global/common.sh @@ -6,14 +6,14 @@ test "${!var}" == "" || return 0 say "we were not able to detect a default value for the configuration variable \$$var. please set this variable to $2 and try again." exit 1 } -test "$to" = "" && { - say "\$to environment variable must be set to your build directory - are you running this script by hand? run ./build.sh in the root directory instead!" - exit 2 -} +#test "$to" = "" && { +# say "\$to environment variable must be set to your build directory - are you running this script by hand? run ./build.sh in the root directory instead!" +# exit 2 +#} reqpack() { if ! has "$1"; then say "to $2 for libk, install the $1 package and try again" exit 3 Index: install.sh ================================================================== --- install.sh +++ install.sh @@ -1,4 +1,44 @@ #!/usr/bin/env bash source global/common.sh -say "this component of the build system does not yet exist" +check "prefix" "a directory to install to" +build="${build:-out}" + +bindir="$prefix/bin" +libdir="$prefix/lib" + +if [ "$prefix" = "/" ]; then + say "installing docs and headers into usr instad of /" + sharedir="$prefix/usr/share" + incdir="$prefix/usr/include" +else + incdir="$prefix/include" + sharedir="$prefix/share" +fi + +# Libraries +# These may or may not exist, depending on what library build is done, so check +[ -e "$build/libk.a" ] && install -Dm644 -t "$libdir" "$build/libk.a" +[ -e "$build/libk.so" ] && install -Dm644 -t "$libdir" "$build/libk.so" +[ -e "$build/boot.o" ] && install -Dm644 -t "$libdir/libk" "$build/boot.o" + +# Binaries +install -Dm755 -t "$bindir" "$build/kcore.testbin" +install -Dm755 -t "$bindir" "$build/kcli.testbin" +install -Dm755 -t "$bindir" "$build/kgraft.attach" + +# Includes +for inc in "$build"/k/*; do + install -Dm644 -t "$incdir/k" "$inc" +done + +# Documentation +for man in "$build"/doc/man/*; do + install -Dm644 -t "$sharedir/man" "$man" +done +for html in "$build"/doc/html/*; do + install -Dm644 -t "$sharedir/doc/libk/html" "$html" +done +for pdf in "$build"/doc/pdf/*; do + install -Dm644 -t "$sharedir/doc/libk/pdf" "$pdf" +done