Differences From
Artifact [b7dc8d033f]:
1 1 #!/usr/bin/env bash
2 2 source global/common.sh
3 3
4 -say "this component of the build system does not yet exist"
4 +check "prefix" "a directory to install to"
5 +build="${build:-out}"
6 +
7 +bindir="$prefix/bin"
8 +libdir="$prefix/lib"
9 +
10 +if [ "$prefix" = "/" ]; then
11 + say "installing docs and headers into usr instad of /"
12 + sharedir="$prefix/usr/share"
13 + incdir="$prefix/usr/include"
14 +else
15 + incdir="$prefix/include"
16 + sharedir="$prefix/share"
17 +fi
18 +
19 +say "Starting install."
20 +
21 +# Libraries
22 +# These may or may not exist, depending on what library build is done, so check
23 +say "Installing libraries..."
24 +[ -e "$build/libk.a" ] && install -Dm644 -t "$libdir" "$build/libk.a"
25 +[ -e "$build/libk.so" ] && install -Dm644 -t "$libdir" "$build/libk.so"
26 +[ -e "$build/boot.o" ] && install -Dm644 -t "$libdir/libk" "$build/boot.o"
27 +
28 +# Binaries
29 +say "Installing binaries..."
30 +install -Dm755 -t "$bindir" "$build/kcore.testbin"
31 +install -Dm755 -t "$bindir" "$build/kcli.testbin"
32 +install -Dm755 -t "$bindir" "$build/kgraft.attach"
33 +
34 +# Includes
35 +say "Installing includes..."
36 +for inc in "$build"/k/*; do
37 + install -Dm644 -t "$incdir/k" "$inc"
38 +done
39 +
40 +# Documentation
41 +say "Installing documentation..."
42 +for man in "$build"/doc/man/*; do
43 + install -Dm644 -t "$sharedir/man" "$man"
44 +done
45 +for html in "$build"/doc/html/*; do
46 + install -Dm644 -t "$sharedir/doc/libk/html" "$html"
47 +done
48 +for pdf in "$build"/doc/pdf/*; do
49 + install -Dm644 -t "$sharedir/doc/libk/pdf" "$pdf"
50 +done
51 +say "Install done!"