Skip to content

Commit f20065e

Browse files
committed
justfile: Make get-started slightly more ergonomic
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]>
1 parent b6ea743 commit f20065e

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

.cargo/config.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[profile.release]
2-
lto = "thin"
3-
41
# We want people who use the onboarding steps to get a nice compromise
52
# between fast compilation and fast runtime, but with checks in place
63
# and full backtraces. Hyperfine tests shows opt-level = 1 to be a good
@@ -14,6 +11,9 @@ lto = "thin"
1411
debug = true
1512
strip = "none"
1613

14+
[profile.release]
15+
lto = "thin"
16+
1717
[profile.packaging]
1818
inherits = "release"
1919
lto = true
@@ -24,15 +24,11 @@ strip = "none"
2424
debug = true
2525

2626
# Having a way to detect on which system we are compiled means we can get
27-
# away with adding rustflags here that we know are present in the Serpent
27+
# away with adding rustflags here that we know are present in the system
2828
# toolchain builds.
2929
#
3030
# We can set these extra flags via matching on a target cfg() expression.
3131
#
32-
# This requires that we set a custom cfg value for the Serpent rustc at
33-
# compile time, which the cfg() expression can then match against, so that
34-
# this target is _only_ selected for Serpent-native builds
35-
#
3632
# - On systems that do not use lld as the system linker (such as Solus) using
3733
# lld directly saves about a second of build time for incremental compiles
3834
# for building boulder (from 2.191s to 1.198s on Reilly's machine).

justfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ default: moss
44
root-dir := justfile_directory()
55
build-mode := env_var_or_default("MODE", "onboarding")
66
# Keep it simple for now and make installs user-local
7-
xdg-data-home := "$HOME/.local/share"
8-
xdg-bin-home := "$HOME/.local/bin"
7+
home := env_var("HOME")
8+
# Hacky -- should really check for the XDG_*_DIR env vars...
9+
xdg-data-home := home + "/.local/share"
10+
xdg-bin-home := home + "/.local/bin"
11+
# Read '=~' as 'contains' in the regexp sense
12+
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.' }
913

1014
[private]
1115
help:
@@ -25,18 +29,21 @@ moss: (build "moss")
2529
get-started: (build "boulder") (build "moss")
2630
@echo ""
2731
@echo "Installing boulder and moss to {{xdg-bin-home}}/ ..."
28-
mkdir -pv "{{xdg-bin-home}}/"
29-
cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
30-
rm -rf "{{xdg-data-home}}/boulder"
31-
mkdir -pv "{{xdg-data-home}}/boulder/"
32-
cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
32+
@mkdir -p "{{xdg-bin-home}}/"
33+
@cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
34+
@rm -rf "{{xdg-data-home}}/boulder"
35+
@mkdir -p "{{xdg-data-home}}/boulder/"
36+
@cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
3337
@echo ""
3438
@echo "Listing installed files..."
35-
ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
39+
@ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
3640
@echo ""
37-
@echo "Checking the system path to boulder and moss executables:"
38-
command -v boulder
39-
command -v moss
41+
@echo "Checking that {{xdg-bin-home}} is in \$PATH..."
42+
@echo "... {{xdg-bin-home}} {{xdg-bin-home-in-path}}"
43+
@echo ""
44+
@echo "Checking the location of boulder and moss executables when executed in a shell:"
45+
@command -v boulder
46+
@command -v moss
4047
@echo ""
4148
@echo "Done."
4249
@echo ""

0 commit comments

Comments
 (0)