Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add install workflow to check.yml #295

Merged
merged 6 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,24 @@ jobs:
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
install:
strategy:
matrix:
toolchain: [nightly]
os: [ubuntu-latest, macos-latest]
include:
- os: macos-latest
prefix: /usr/local/bin
- os: ubuntu-latest
prefix: /usr/bin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: make install.full
run: make install.full PREFIX=${{ matrix.prefix }}
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ else
cargo build --features vers --release --target x86_64-unknown-linux-gnu
endif

MANDIR := /usr/local/share/man/man1

install:
cargo install --features vers --path . --bin pbqff

install.full: man/rpbqff.1 target/release/pbqff qffbuddy/qffbuddy.py
src := build.rs $(shell find src -name '*.rs')

target/release/pbqff: $(src)
cargo build --features vers --release
sudo ln -sf $(realpath target/release/pbqff) /usr/bin/pbqff
sudo ln -sf $(realpath qffbuddy/qffbuddy.py) /usr/bin/qffbuddy

PREFIX := /usr/bin
MANDIR := /usr/local/share/man/man1
install.full: man/rpbqff.1 target/release/pbqff qffbuddy/qffbuddy.py
sudo ln -sf $(realpath target/release/pbqff) $(PREFIX)/pbqff
sudo ln -sf $(realpath qffbuddy/qffbuddy.py) $(PREFIX)/qffbuddy
sudo cp $< $(MANDIR)/pbqff.1
touch $@

ELAND_DEST = 'eland:programs/rust-pbqff/.'

Expand Down
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,34 @@ Assuming you have the [Rust toolchain](https://www.rust-lang.org/tools/install)
installed, run

```bash
make install
make install.full
```

As you can see in the Makefile, this simply runs

```bash
cargo build --features vers --release
sudo ln -sf $(realpath target/release/pbqff) /usr/bin/pbqff
sudo ln -sf $(realpath qffbuddy/qffbuddy.py) /usr/bin/qffbuddy
cargo build --features vers --release # indirectly through target/release/pbqff
sudo ln -sf $(realpath target/release/pbqff) $(PREFIX)/pbqff
sudo ln -sf $(realpath qffbuddy/qffbuddy.py) $(PREFIX)/qffbuddy
sudo cp $< $(MANDIR)/pbqff.1
```

to build the binary in release mode, and link it into your `$PATH` under the
name `pbqff`. It also links `qffbuddy` into `/usr/bin` and builds the `man` page
and installs that in `MANDIR`, which defaults to `/usr/local/share/man/man1`.
to build the binary in release mode, and link it into the `PREFIX` directory,
which is presumably on your `$PATH`, under the name `pbqff`. It also links
`qffbuddy` into this directory and builds the `man` page and installs that in
`MANDIR`. `PREFIX` defaults to `/usr/bin`, which should work fine on Linux, but
on macOS, you will likely need to use `/usr/local/bin`. `MANDIR` defaults to
`/usr/local/share/man/man1`, but you can override this as well. For example,
fully specifying the defaults would look something like this:

``` shell
make install.full PREFIX=/usr/bin MANDIR=/usr/local/share/man/man1
```

If you don't care about `qffbuddy` or the manual, you can use the plain
`install` recipe, which defers to `cargo install`. Depending on your Rust
installation, this will likely put the binary in `$HOME/.cargo/bin`, which you
may need to add to your `PATH`.

You can also build a PDF copy of the manual with `make man/rpbqff.pdf`.

Expand Down
Loading