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 # https://stackoverflow.com/a/39160850/1836776
SCRIPT_DIR=$(cmd //C cd) SCRIPT_DIR=$(cmd //C cd)
else 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 fi
case $1 in 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 echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile
``` ```
On M1 only (as greadlink is not on the path otherwise in XCode): On macOS, you will need to adjust your PATH so that coreutils `realpath` takes precedence over the BSD one:
```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:
```shell ```shell
# Credit: brew info coreutils # 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 * Web: node.js, emscripten, openjdk 8

View file

@ -43,7 +43,7 @@ set -eu
## START STANDARD BUILD SCRIPT INCLUDE ## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary # 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" . "$(dirname "$THIS_SCRIPT")/<relative-path-to-repo-root>/resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE ## END STANDARD BUILD SCRIPT INCLUDE
@ -78,14 +78,12 @@ We use `set -eu` throughout:
```bash ```bash
## START STANDARD BUILD SCRIPT INCLUDE ## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary # 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" . "$(dirname "$THIS_SCRIPT")/<relative-path-to-repo-root>/resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE ## END STANDARD BUILD SCRIPT INCLUDE
``` ```
This somewhat unwieldy incantation handles all our build environments, with This somewhat unwieldy incantation handles all our build environments.
`greadlink` necessary on macOS (again installed with homebrew) due to the
included macOS `readlink` struggling with canonicalization of symbolic links.
The intent is to get a good solid consistent path for the script so that we can 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. safely include the build script, no matter what `pwd` is when the script is run.

View file

@ -22,7 +22,7 @@
# Here is how to include this script reliably, cross-platform: # Here is how to include this script reliably, cross-platform:
# ## START STANDARD BUILD SCRIPT INCLUDE # ## START STANDARD BUILD SCRIPT INCLUDE
# # adjust relative paths as necessary # # 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" # . "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh"
# # END STANDARD BUILD SCRIPT INCLUDE # # 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 # 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 # None of the answers are 100% correct for cross-platform
# On macOS, requires coreutils (`brew install coreutils`) # 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"))) KEYMAN_ROOT=$(dirname $(dirname $(dirname "$SCRIPT")))
readonly KEYMAN_ROOT 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 # 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 # None of the answers are 100% correct for cross-platform
# On macOS, requires coreutils (`brew install coreutils`) # 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")) REPO_ROOT=$(dirname $(dirname "$SCRIPT"))
readonly REPO_ROOT readonly REPO_ROOT
} }
@ -44,7 +44,7 @@ function _builder_findRepoRoot() {
# ```bash # ```bash
# ## START STANDARD BUILD SCRIPT INCLUDE # ## START STANDARD BUILD SCRIPT INCLUDE
# # adjust relative paths as necessary # # 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" # . "$(dirname "$THIS_SCRIPT")/resources/builder.inc.sh"
# ## END STANDARD BUILD SCRIPT INCLUDE # ## 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"' >> ~/.zshrc
#echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.bashrc #echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.bashrc
export ANT_HOME=/usr/local/opt/ant 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/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/30.0.3:$PATH export PATH=$ANDROID_HOME/build-tools/30.0.3:$PATH
export PATH="/usr/local/opt/openjdk@8/bin:$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 export JAVA_HOME=/usr/local/opt/openjdk@8
# Python 2.7 # Python 2.7

View file

@ -13,7 +13,7 @@
# #
# Get the directory where this script lives, i.e. resources/git-hooks # 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 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. # 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 SHA1=$3
# Get the directory where this script lives, i.e. resources/git-hooks # 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 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. # This script was run from a symlink and the repo in question has its own commit-msg-defs.