Skip to content

Commit

Permalink
refactor(packaging): simplify building docs
Browse files Browse the repository at this point in the history
Fixes #101

Why?

- no build.rs that is invoked on _any_ `cargo build/run`
- no extra dev dependency
- no intermediate `docs/*.out` files
- 3 lines of bash instead
- maximum gzip compression (-9/--best)
- docs will be built only when needed,
    i.e. on `make docs` or `make install`

To quickly check:

```sh
make TARGET_DIR=/tmp/wayshot MAN{1,7}_DIR=/tmp/wayshot install
```
  • Loading branch information
murlakatamenka committed Mar 12, 2024
1 parent 8f22e6d commit 6939691
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 91 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
target
*.gz
*.out
.direnv
*.jpg
*.jpeg
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ build:
run:
@cargo run

install: build
docs:
@echo -n 'Generating docs with scdoc and gzip ... '
@for file in ./docs/*.scd ; do \
scdoc < "$$file" | gzip --best > "$${file%.scd}.gz" ; \
done
@echo 'done!'

install: build docs
@mkdir -p $(TARGET_DIR)
@cp $(SOURCE_DIR)/$(BINARY) $(TARGET_DIR)
@chmod +x $(TARGET_DIR)/$(BINARY)
Expand All @@ -37,4 +44,4 @@ setup:
@rustup install stable
@rustup default stable

.PHONY: check clean setup all install build
.PHONY: check clean setup all install build docs
5 changes: 0 additions & 5 deletions wayshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ keywords.workspace = true
license.workspace = true
repository.workspace = true

[build-dependencies]
flate2 = "1.0.27"
eyre = "0.6.8"


[dependencies]
tracing.workspace = true

Expand Down
81 changes: 0 additions & 81 deletions wayshot/build.rs

This file was deleted.

1 change: 0 additions & 1 deletion wayshot/docs

This file was deleted.

0 comments on commit 6939691

Please sign in to comment.