Skip to content
Draft
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
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ UPSTREAM= https://github.com/filiparag/wikiman
UPSTREAM_API= https://api.github.com/repos/filiparag/wikiman/releases/latest

MKFILEREL!= echo ${.MAKE.MAKEFILES} | sed 's/.* //'
MKFILEABS!= readlink -f ${MKFILEREL} 2>/dev/null
MKFILEABS!= readlink -f "${MKFILEREL}" 2>/dev/null
MKFILEABS+= $(shell readlink -f ${MAKEFILE_LIST})
WORKDIR!= dirname ${MKFILEABS} 2>/dev/null

Expand All @@ -28,7 +28,7 @@ core:
${BUILDDIR}/usr/share/man/man1
install -Dm755 ${WORKDIR}/${NAME}.sh \
${BUILDDIR}/usr/bin/${NAME}
cp -fr ${WORKDIR}/sources \
cp -fR ${WORKDIR}/sources \
${BUILDDIR}/usr/share/${NAME}
install -Dm644 ${WORKDIR}/LICENSE \
${BUILDDIR}/usr/share/licenses/${NAME}
Expand All @@ -39,7 +39,7 @@ core:
widgets: core
test ! -f ${BUILDDIR}/.local
mkdir -p ${BUILDDIR}/usr/share/${NAME}
cp -fr ${WORKDIR}/widgets \
cp -fR ${WORKDIR}/widgets \
${BUILDDIR}/usr/share/${NAME}

completions: core
Expand Down Expand Up @@ -69,7 +69,7 @@ docs:
reinstall: install
install: all
mkdir -p $(prefix)/
cp -fr ${BUILDDIR}/* \
cp -fR ${BUILDDIR}/* \
$(prefix)/

plist: all
Expand Down Expand Up @@ -131,14 +131,24 @@ source-reinstall: source-install
source-install:
[ -d ${SOURCESDIR}/usr/share/doc ] && \
mkdir -p $(prefix)/usr/share/doc && \
cp -rf ${SOURCESDIR}/usr/share/doc \
cp -Rf ${SOURCESDIR}/usr/share/doc \
$(prefix)/usr/share || true

[ -d ${SOURCESDIR}/usr/local/share/doc ] && \
mkdir -p $(prefix)/usr/local/share/doc && \
cp -rf ${SOURCESDIR}/usr/local/share/doc \
cp -Rf ${SOURCESDIR}/usr/local/share/doc \
$(prefix)/usr/local/share || true

[ -d ${SOURCESDIR}/usr/share/doc ] && \
[ -d ${HOMEBREW_PREFIX}/share/doc ] && \
cp -Rf ${SOURCESDIR}/usr/share/doc \
${HOMEBREW_PREFIX}/share || true

[ -d ${SOURCESDIR}/usr/local/share/doc ] && \
[ -d ${HOMEBREW_PREFIX}/share/doc ] && \
cp -Rf ${SOURCESDIR}/usr/local/share/doc \
${HOMEBREW_PREFIX}/share || true

source-clean:
rm -rf ${SOURCESDIR}

Expand All @@ -154,6 +164,12 @@ source-uninstall:
$(prefix)/usr/local/share/doc/freebsd-docs \
$(prefix)/usr/local/share/doc/gentoo-wiki \
$(prefix)/usr/local/share/doc/tldr-pages
source-uninstall-homebrew:
rm -rf ${HOMEBREW_PREFIX}/share/doc/arch-wiki/html \
${HOMEBREW_PREFIX}/share/doc/devdocs \
${HOMEBREW_PREFIX}/share/doc/freebsd-docs \
${HOMEBREW_PREFIX}/share/doc/gentoo-wiki \
${HOMEBREW_PREFIX}/share/doc/tldr-pages
Comment thread
paulhdk marked this conversation as resolved.

source-local:
test ! -d ${SOURCESDIR}/usr/local/share/doc
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ Or download latest _.txz_ package from [Releases](https://github.com/filiparag/w
pkg install wikiman*.txz
```

### Manual installation for Linux and BSD
### Manual installation for Linux, BSD, and macOS

Dependencies: `man`, `fzf`, `ripgrep`, `awk`, `w3m`, `coreutils`, `parallel`

Wikiman uses GNU `find` and `awk`, so BSD and macOS users have to additionally install `findutils` and `gawk`.
macOS users are also required to install and use `gmake` instead of the system-default `make`. That either requires replacing every subsequent call to `make` in this document with `gmake` or setting `alias make=gmake`.

```bash
# Clone from GitHub
git clone 'https://github.com/filiparag/wikiman'
Expand All @@ -83,12 +86,13 @@ make all
# Only for BSD users: install to /usr/local instead of /usr
make local

# Only for macOS users: install to $HOME/.local instead of /usr and ensure that $HOME/.local/bin is in your PATH
make install prefix=$HOME/.local

# Install Wikiman
sudo make install
```

Wikiman uses GNU `find` and `awk`, so BSD users have to install `findutils` and `gawk`.

## Additional documentation sources

Currently available optional sources are:
Expand Down
6 changes: 6 additions & 0 deletions wikiman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ init() {
'/usr/local/bin'|'/usr/local/sbin')
conf_sys_usr='/usr/local';
conf_sys_etc='/usr/local/etc';;
${HOMEBREW_PREFIX+"$HOMEBREW_PREFIX/bin"})
conf_sys_usr="$HOMEBREW_PREFIX";
conf_sys_etc="$HOMEBREW_PREFIX/etc";;
*)
case "$(dirname "$(command -v wikiman)")" in
"$HOME/bin"|"$HOME/.local/bin")
Expand All @@ -77,6 +80,9 @@ init() {
>&2 echo 'warning: unsupported installation path, using fallback for BSD' ;
conf_sys_usr='/usr/local';
conf_sys_etc='/usr/local/etc';;
${HOMEBREW_PREFIX+"$HOMEBREW_PREFIX/bin"})
conf_sys_usr="$HOMEBREW_PREFIX";
conf_sys_etc="$HOMEBREW_PREFIX/etc";;
*)
>&2 echo 'error: unsupported installation path - failed to establish fallback' ;
exit 5;;
Expand Down