libk  Diff

Differences From Artifact [df12302eb0]:

To Artifact [e3ee508d22]:


     1      1   #!/usr/bin/env bash
     2      2   source global/common.sh
     3      3   
            4  +# TODO: provide "modular" install option to avoid the traditional
            5  +# linux directory hierarchy on systems where this doesn't make sense.
            6  +
     4      7   check "prefix" "a directory to install to"
     5      8   build="${build:-out}"
     6      9   
     7         -bindir="$prefix/bin"
     8         -libdir="$prefix/lib"
           10  +bindir="${bindir:-$prefix/bin}"
           11  +libdir="${libdir:-$prefix/lib}"
     9     12   
    10         -if [ "$prefix" = "/" ]; then
           13  +if test "$prefix" = "/" -o "$fakeroot" = yes; then
    11     14   	say "installing docs and headers into usr instad of /"
    12         -	sharedir="$prefix/usr/share"
    13         -	incdir="$prefix/usr/include"
           15  +	sharedir="${sharedir:-$prefix/usr/share}"
           16  +	incdir="${incdir:-$prefix/usr/include}"
    14     17   else
    15         -	incdir="$prefix/include"
    16         -	sharedir="$prefix/share"
           18  +	incdir="${incdir:-$prefix/include}"
           19  +	sharedir="${sharedir:-$prefix/share}"
    17     20   fi
    18     21   
    19         -say "Starting install."
           22  +say "commencing install"
           23  +say " - prefix: $prefix"
           24  +say " - destinations:"
           25  +say "   * binaries: $bindir"
           26  +say "   * libraries: $libdir"
           27  +say "   * headers: $incdir"
           28  +say "   * shared files: $sharedir"
           29  +
           30  +mkdir -p "$bindir" "$libdir" "$incdir" "$sharedir"
    20     31   
    21     32   # Libraries
    22     33   # 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"
           34  +say "installing libraries"
           35  +test -e "$build/libk.a"  && install -Dm644 -t "$libdir" "$build/libk.a"
           36  +test -e "$build/libk.so" && install -Dm644 -t "$libdir" "$build/libk.so"
           37  +test -e "$build/kboot.o" && install -Dm644 -t "$libdir" "$build/kboot.o"
    27     38   
    28     39   # Binaries
    29         -say "Installing binaries..."
    30         -install -Dm755 -t "$bindir" "$build/kcore.testbin"
    31         -install -Dm755 -t "$bindir" "$build/kcli.testbin"
           40  +say "installing binaries"
           41  +# *.testbin files should not be installed
    32     42   install -Dm755 -t "$bindir" "$build/kgraft.attach"
    33     43   
    34     44   # Includes
    35         -say "Installing includes..."
           45  +say "installing headers"
    36     46   for inc in "$build"/k/*; do
    37     47   	install -Dm644 -t "$incdir/k" "$inc"
    38     48   done
    39     49   
    40     50   # Documentation
    41         -say "Installing documentation..."
           51  +say "installing documentation"
    42     52   for man in "$build"/doc/man/*; do
    43     53   	install -Dm644 -t "$sharedir/man" "$man"
    44     54   done
    45     55   for html in "$build"/doc/html/*; do
    46     56   	install -Dm644 -t "$sharedir/doc/libk/html" "$html"
    47     57   done
    48     58   for pdf in "$build"/doc/pdf/*; do
    49     59   	install -Dm644 -t "$sharedir/doc/libk/pdf" "$pdf"
    50     60   done
    51         -say "Install done!"
           61  +say "install complete"