chore: update docs and non-standard readlink refs

This commit is contained in:
Marc Durdin 2023-02-22 10:41:54 +07:00
parent f962f483a5
commit 3005a82a8f
8 changed files with 17 additions and 25 deletions

View file

@ -10,7 +10,7 @@ if [[ -n "$WINDIR" ]]; then
# https://stackoverflow.com/a/39160850/1836776
SCRIPT_DIR=$(cmd //C cd)
else
SCRIPT_DIR="$(dirname "$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")")"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
fi
case $1 in

10
docs/build/macos.md vendored
View file

@ -59,17 +59,11 @@ These dependencies are also listed below if you'd prefer to install manually.
echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile
```
On M1 only (as greadlink is not on the path otherwise in XCode):
```shell
sudo ln -s /opt/homebrew/bin/greadlink /usr/local/bin/greadlink
```
On Ventura, you will need to adjust your PATH so that coreutils `realpath` takes precedence over the BSD one:
On macOS, you will need to adjust your PATH so that coreutils `realpath` takes precedence over the BSD one:
```shell
# Credit: brew info coreutils
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
```
* Web: node.js, emscripten, openjdk 8

View file

@ -43,7 +43,7 @@ set -eu
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/<relative-path-to-repo-root>/resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
@ -78,14 +78,12 @@ We use `set -eu` throughout:
```bash
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/<relative-path-to-repo-root>/resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
```
This somewhat unwieldy incantation handles all our build environments, with
`greadlink` necessary on macOS (again installed with homebrew) due to the
included macOS `readlink` struggling with canonicalization of symbolic links.
This somewhat unwieldy incantation handles all our build environments.
The intent is to get a good solid consistent path for the script so that we can
safely include the build script, no matter what `pwd` is when the script is run.
@ -172,10 +170,10 @@ a user or called by another script:
will execute for all targets of the dependency script. If you are working on
code within a dependency, you are currently expected to rebuild and test that
dependency locally.
A dependency is similar to, but not the same as, a child project. Child
projects live in sub-folders of the parent project, whereas generally a
dependency will be in another folder altogether.
dependency will be in another folder altogether.
Dependencies can be defined for all actions and targets, or may be limited to
specific action and/or targets.
@ -379,7 +377,7 @@ builder_describe "Sample script" \
A dependency always starts with `@`. The path to the dependency will be relative
to the build script folder if the path does not start with `/`. Otherwise, the path
to the dependency is interpreted relative to the root of the repository. It is an
to the dependency is interpreted relative to the root of the repository. It is an
error to specify a dependency outside the repo root.
Relative paths will be expanded to full paths, again, relative to the root of

View file

@ -22,7 +22,7 @@
# Here is how to include this script reliably, cross-platform:
# ## START STANDARD BUILD SCRIPT INCLUDE
# # adjust relative paths as necessary
# THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
# THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
# . "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh"
# # END STANDARD BUILD SCRIPT INCLUDE
#
@ -38,7 +38,7 @@ function findKeymanRoot() {
# See https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself
# None of the answers are 100% correct for cross-platform
# On macOS, requires coreutils (`brew install coreutils`)
local SCRIPT=$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")
local SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
KEYMAN_ROOT=$(dirname $(dirname $(dirname "$SCRIPT")))
readonly KEYMAN_ROOT
}

View file

@ -30,7 +30,7 @@ function _builder_findRepoRoot() {
# See https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself
# None of the answers are 100% correct for cross-platform
# On macOS, requires coreutils (`brew install coreutils`)
local SCRIPT=$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")
local SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
REPO_ROOT=$(dirname $(dirname "$SCRIPT"))
readonly REPO_ROOT
}
@ -44,7 +44,7 @@ function _builder_findRepoRoot() {
# ```bash
# ## START STANDARD BUILD SCRIPT INCLUDE
# # adjust relative paths as necessary
# THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
# THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
# . "$(dirname "$THIS_SCRIPT")/resources/builder.inc.sh"
# ## END STANDARD BUILD SCRIPT INCLUDE
# ```

View file

@ -1,4 +1,4 @@
source $HOME/.cargo/env
# source $HOME/.cargo/env
#echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc
#echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.bashrc
export ANT_HOME=/usr/local/opt/ant
@ -15,7 +15,7 @@ export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/30.0.3:$PATH
export PATH="/usr/local/opt/openjdk@8/bin:$PATH"
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export JAVA_HOME=/usr/local/opt/openjdk@8
# Python 2.7

View file

@ -13,7 +13,7 @@
#
# Get the directory where this script lives, i.e. resources/git-hooks
HOOK_DIRECTORY="$(dirname "$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")")"
HOOK_DIRECTORY="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -f $(dirname "${BASH_SOURCE[0]}")/commit-msg-defs ]; then
# This script was run from a symlink and the repo in question has its own commit-msg-defs.

View file

@ -18,7 +18,7 @@ COMMIT_SOURCE=$2
SHA1=$3
# Get the directory where this script lives, i.e. resources/git-hooks
HOOK_DIRECTORY="$(dirname "$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")")"
HOOK_DIRECTORY="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ -f $(dirname "${BASH_SOURCE[0]}")/commit-msg-defs ]; then
# This script was run from a symlink and the repo in question has its own commit-msg-defs.