Index: dist/PKGBUILD ================================================================== --- dist/PKGBUILD +++ dist/PKGBUILD @@ -34,14 +34,16 @@ cd "$srcdir/libk" arch=$kind ./build.sh } package() { - if test "$doc" = yes; then - install -D "$srcdir/$pkgname/out/doc/html/"* -t "$pkgdir/usr/share/doc/libk/pdf/" - install -D "$srcdir/$pkgname/out/doc/pdf/"* -t "$pkgdir/usr/share/doc/libk/html/" - install -D "$srcdir/$pkgname/out/doc/man/"* -t "$pkgdir/usr/share/man/man3/" - fi - - install -D "$srcdir/$pkgname"/out/{libk.{so,a},kboot.o} -t "$pkgdir/usr/lib/" - install -D "$srcdir/$pkgname/out/k/"* -t "$pkgdir/usr/include/k/" + export fakeroot=yes prefix="$pkgdir" build="$srcdir/$pkgname/out" + "$srcdir/$pkgname/install.sh" + # if test "$doc" = yes; then + # install -D "$srcdir/$pkgname/out/doc/html/"* -t "$pkgdir/usr/share/doc/libk/pdf/" + # install -D "$srcdir/$pkgname/out/doc/pdf/"* -t "$pkgdir/usr/share/doc/libk/html/" + # install -D "$srcdir/$pkgname/out/doc/man/"* -t "$pkgdir/usr/share/man/man3/" + # fi + # + # install -D "$srcdir/$pkgname"/out/{libk.{so,a},kboot.o} -t "$pkgdir/usr/lib/" + # install -D "$srcdir/$pkgname/out/k/"* -t "$pkgdir/usr/include/k/" } Index: install.sh ================================================================== --- install.sh +++ install.sh @@ -1,51 +1,61 @@ #!/usr/bin/env bash source global/common.sh +# TODO: provide "modular" install option to avoid the traditional +# linux directory hierarchy on systems where this doesn't make sense. + check "prefix" "a directory to install to" build="${build:-out}" -bindir="$prefix/bin" -libdir="$prefix/lib" +bindir="${bindir:-$prefix/bin}" +libdir="${libdir:-$prefix/lib}" -if [ "$prefix" = "/" ]; then +if test "$prefix" = "/" -o "$fakeroot" = yes; then say "installing docs and headers into usr instad of /" - sharedir="$prefix/usr/share" - incdir="$prefix/usr/include" + sharedir="${sharedir:-$prefix/usr/share}" + incdir="${incdir:-$prefix/usr/include}" else - incdir="$prefix/include" - sharedir="$prefix/share" + incdir="${incdir:-$prefix/include}" + sharedir="${sharedir:-$prefix/share}" fi -say "Starting install." +say "commencing install" +say " - prefix: $prefix" +say " - destinations:" +say " * binaries: $bindir" +say " * libraries: $libdir" +say " * headers: $incdir" +say " * shared files: $sharedir" + +mkdir -p "$bindir" "$libdir" "$incdir" "$sharedir" # Libraries # These may or may not exist, depending on what library build is done, so check -say "Installing libraries..." -[ -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" +say "installing libraries" +test -e "$build/libk.a" && install -Dm644 -t "$libdir" "$build/libk.a" +test -e "$build/libk.so" && install -Dm644 -t "$libdir" "$build/libk.so" +test -e "$build/kboot.o" && install -Dm644 -t "$libdir" "$build/kboot.o" # Binaries -say "Installing binaries..." -install -Dm755 -t "$bindir" "$build/kcore.testbin" -install -Dm755 -t "$bindir" "$build/kcli.testbin" +say "installing binaries" +# *.testbin files should not be installed install -Dm755 -t "$bindir" "$build/kgraft.attach" # Includes -say "Installing includes..." +say "installing headers" for inc in "$build"/k/*; do install -Dm644 -t "$incdir/k" "$inc" done # Documentation -say "Installing documentation..." +say "installing 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 -say "Install done!" +say "install complete"