Skip to content

Commit

Permalink
Add make install and uninstall tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed Jun 27, 2024
1 parent ad58fdd commit 5dd926e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
PREFIX := /usr
BINDIR := ${PREFIX}/bin
DATADIR := ${PREFIX}/share

# The directory to store the assets in.
ASSETS := ${PREFIX}/share/idoc/assets
# The directory to install the asset files (CSS, JS, etc) in.
ASSETS := ${DATADIR}/idoc/assets

.check-version:
@test $${VERSION?The VERSION variable must be set}
Expand All @@ -10,6 +12,19 @@ build:
inko pkg sync
inko build --define 'idoc.cmd.ASSETS=${ASSETS}' -o ./build/idoc

${DESTDIR}${BINDIR}/idoc:
install -D --mode=755 build/idoc "${@}"

${DESTDIR}${ASSETS}:
mkdir -p "${@}"
cp --recursive assets/* "${@}"

install: build ${DESTDIR}${BINDIR}/idoc ${DESTDIR}${ASSETS}

uninstall:
rm --force ${BINDIR}/idoc
rm --recursive --force ${ASSETS}

release/version: .check-version
sed -E -i -e "s/^let VERSION = '([^']+)'$$/let VERSION = '${VERSION}'/" \
src/idoc/cmd.inko
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,40 @@ at `./build/idoc/public`. For more information, run `idoc --help`.
Building from source:

```bash
make build
make install PREFIX=~/.local
```

This assumes the assets used by the website (e.g. the CSS files) are located at
`/usr/share/idoc/assets`. You can change this path by settings the `ASSETS` make
variable. For example, to use the local `assets` directory you'd run the
following:
This installs `idoc` into `~/.local`, with the executable being found at
`~/.local/bin`, and the assets located at `~/.local/share/idoc/assets`. To
uninstall, run the following:

```bash
make uninstall PREFIX=~/.local
```

For testing changes locally, run the following

```bash
make build ASSETS=$PWD/assets
```

You can also use the provided Docker image:
This builds the executable such that it uses the `assets/` directory directly
from the repository. In this case the executable is found at `./build/idoc`.

You can also use the provided [Docker](https://www.docker.com/) image:

```bash
docker pull ghcr.io/inko-lang/idoc:latest
docker run --rm --volume $PWD:$PWD:z --workdir $PWD idoc:latest
```

Or when using [Podman](http://podman.io/):

```bash
podman pull ghcr.io/inko-lang/idoc:latest
podman run --rm --volume $PWD:$PWD:z --workdir $PWD idoc:latest
```

## License

All source code in this repository is licensed under the Mozilla Public License
Expand Down

0 comments on commit 5dd926e

Please sign in to comment.