diff --git a/README.md b/README.md index bee3ee8..25b9f38 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,32 @@ limitations/properties: * These are only installed for the user that ran the script. * The thing pointed to by each symlink can change out from under you. +## Alternatives + +I may have finally found a more "correct" alternative to this where I +actually used `~/usr/local` as my install prefix. I always found it +annoying that I couldn't change an install prefix after waiting for +the entire `make` command to run. The default prefix is always +`/usr/local` which requires root privileges to install into. However, +there is apparently the [env variable `DESTDIR`][1] which will at +least allow you to add a prefix in front of the default prefix. It +won't "change" it, so you're always stuck with `/usr/local` unless you +actually set the `--prefix` flag before building. But this does let +you do `asdf/usr/local`. + +```sh +make DESTDIR=$HOME install +``` + +```sh +cmake DESTDIR=$HOME --install ./ +``` + # Copyright I think this script is too small to reasonably apply copyright to. It is in the Public Domain. + + +[1]: https://cmake.org/cmake/help/latest/envvar/DESTDIR.html#envvar:DESTDIR +[2]: diff --git a/cmake-default.sh b/cmake-default.sh new file mode 100755 index 0000000..b11fca1 --- /dev/null +++ b/cmake-default.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +set -o errexit + +mkdir build +cd build + +# Source common settings +. $HOME/usr/local/share/config.site + +# Configure +cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$HOME/usr/local \ + $@ + +# Build +ninja