Skip to content

Commit

Permalink
justfile: Make get-started slightly more ergonomic
Browse files Browse the repository at this point in the history
Now `just get-started` will check whether `~/.local/bin` is in $PATH
and ask the user to add it if it isn't.

In addition, some file management operations have been quieted down.

Signed-off-by: Rune Morling <[email protected]>
  • Loading branch information
ermo committed Jul 18, 2024
1 parent b6ea743 commit f20065e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
12 changes: 4 additions & 8 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[profile.release]
lto = "thin"

# We want people who use the onboarding steps to get a nice compromise
# between fast compilation and fast runtime, but with checks in place
# and full backtraces. Hyperfine tests shows opt-level = 1 to be a good
Expand All @@ -14,6 +11,9 @@ lto = "thin"
debug = true
strip = "none"

[profile.release]
lto = "thin"

[profile.packaging]
inherits = "release"
lto = true
Expand All @@ -24,15 +24,11 @@ strip = "none"
debug = true

# Having a way to detect on which system we are compiled means we can get
# away with adding rustflags here that we know are present in the Serpent
# away with adding rustflags here that we know are present in the system
# toolchain builds.
#
# We can set these extra flags via matching on a target cfg() expression.
#
# This requires that we set a custom cfg value for the Serpent rustc at
# compile time, which the cfg() expression can then match against, so that
# this target is _only_ selected for Serpent-native builds
#
# - On systems that do not use lld as the system linker (such as Solus) using
# lld directly saves about a second of build time for incremental compiles
# for building boulder (from 2.191s to 1.198s on Reilly's machine).
Expand Down
29 changes: 18 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ default: moss
root-dir := justfile_directory()
build-mode := env_var_or_default("MODE", "onboarding")
# Keep it simple for now and make installs user-local
xdg-data-home := "$HOME/.local/share"
xdg-bin-home := "$HOME/.local/bin"
home := env_var("HOME")
# Hacky -- should really check for the XDG_*_DIR env vars...
xdg-data-home := home + "/.local/share"
xdg-bin-home := home + "/.local/bin"
# Read '=~' as 'contains' in the regexp sense
xdg-bin-home-in-path := if env_var("PATH") =~ xdg-bin-home { 'is already in \$PATH. Excellent.' } else { 'is not yet in \$PATH. Please add it.' }

[private]
help:
Expand All @@ -25,18 +29,21 @@ moss: (build "moss")
get-started: (build "boulder") (build "moss")
@echo ""
@echo "Installing boulder and moss to {{xdg-bin-home}}/ ..."
mkdir -pv "{{xdg-bin-home}}/"
cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
rm -rf "{{xdg-data-home}}/boulder"
mkdir -pv "{{xdg-data-home}}/boulder/"
cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
@mkdir -p "{{xdg-bin-home}}/"
@cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
@rm -rf "{{xdg-data-home}}/boulder"
@mkdir -p "{{xdg-data-home}}/boulder/"
@cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
@echo ""
@echo "Listing installed files..."
ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
@ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
@echo ""
@echo "Checking the system path to boulder and moss executables:"
command -v boulder
command -v moss
@echo "Checking that {{xdg-bin-home}} is in \$PATH..."
@echo "... {{xdg-bin-home}} {{xdg-bin-home-in-path}}"
@echo ""
@echo "Checking the location of boulder and moss executables when executed in a shell:"
@command -v boulder
@command -v moss
@echo ""
@echo "Done."
@echo ""
Expand Down

0 comments on commit f20065e

Please sign in to comment.