Commit fec0ded465
Unsigned
Layout: unified · split
Makefile +21 −3
| @@ -1,12 +1,18 @@ | ||
| 1 | 1 | # See https://weechat.org/files/doc/weechat/stable/weechat_user.en.html#xdg_directories |
| 2 | 2 | XDG_DATA_HOME ?= $(HOME)/.local/share |
| 3 | 3 | WEECHAT_DATA_DIR ?= $(XDG_DATA_HOME)/weechat |
| 4 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null) | |
| 5 | ifeq ($(DEB_HOST_MULTIARCH),) | |
| 6 | WEECHAT_PLUGIN_DIR ?= /usr/lib/weechat/plugins | |
| 7 | else | |
| 8 | WEECHAT_PLUGIN_DIR ?= /usr/lib/$(DEB_HOST_MULTIARCH)/weechat/plugins | |
| 9 | endif | |
| 4 | 10 | |
| 5 | 11 | SOURCES := $(wildcard src/*.rs src/bar_items/*.rs src/commands/*.rs src/room/*.rs Cargo.lock) |
| 6 | 12 | |
| 7 | 13 | PROFILE ?= release |
| 8 | 14 | |
| 9 | .PHONY: install install-dir lint all help deb | |
| 15 | .PHONY: install install-user uninstall uninstall-user install-dir install-user-dir lint all help deb | |
| 10 | 16 | |
| 11 | 17 | all: help |
| 12 | 18 | |
| @@ -19,10 +25,22 @@ target/debug/libmatrix.so: $(SOURCES) ## Build plugin in dev profile | ||
| 19 | 25 | target/release/libmatrix.so: $(SOURCES) ## Build plugin release profile |
| 20 | 26 | cargo build --release |
| 21 | 27 | |
| 22 | install: install-dir target/$(PROFILE)/libmatrix.so ## Install plugin to weechat dir | |
| 28 | install: install-dir target/$(PROFILE)/libmatrix.so ## Install plugin systemwide | |
| 29 | install -m644 target/$(PROFILE)/libmatrix.so $(DESTDIR)$(WEECHAT_PLUGIN_DIR)/matrix.so | |
| 30 | ||
| 31 | install-user: install-user-dir target/$(PROFILE)/libmatrix.so ## Install plugin to user WeeChat dir | |
| 23 | 32 | install -m644 target/$(PROFILE)/libmatrix.so $(DESTDIR)$(WEECHAT_DATA_DIR)/plugins/matrix.so |
| 24 | 33 | |
| 25 | install-dir: ## Create plugins directory | |
| 34 | uninstall: ## Remove systemwide plugin | |
| 35 | rm -f $(DESTDIR)$(WEECHAT_PLUGIN_DIR)/matrix.so | |
| 36 | ||
| 37 | uninstall-user: ## Remove plugin from user WeeChat dir | |
| 38 | rm -f $(DESTDIR)$(WEECHAT_DATA_DIR)/plugins/matrix.so | |
| 39 | ||
| 40 | install-dir: | |
| 41 | install -d $(DESTDIR)$(WEECHAT_PLUGIN_DIR) | |
| 42 | ||
| 43 | install-user-dir: | |
| 26 | 44 | install -d $(DESTDIR)$(WEECHAT_DATA_DIR)/plugins |
| 27 | 45 | |
| 28 | 46 | lint: ## Lint issues with clippy |
README.md +25 −3
| @@ -55,9 +55,26 @@ On Linux this creates a `libmatrix.so` file in the `target/release/` | ||
| 55 | 55 | (`target/debug` for dev builds) folder. Rename it to `matrix.so` and copy it to |
| 56 | 56 | your WeeChat plugin directory. |
| 57 | 57 | |
| 58 | `make install` uses WeeChat's XDG data directory by default: | |
| 58 | `make install` installs the plugin systemwide: | |
| 59 | 59 | |
| 60 | make install | |
| 60 | sudo make install | |
| 61 | ||
| 62 | On Debian-like multiarch systems this installs the release build to: | |
| 63 | ||
| 64 | /usr/lib/${DEB_HOST_MULTIARCH}/weechat/plugins/matrix.so | |
| 65 | ||
| 66 | On other systems it defaults to: | |
| 67 | ||
| 68 | /usr/lib/weechat/plugins/matrix.so | |
| 69 | ||
| 70 | Set `WEECHAT_PLUGIN_DIR` if your distribution uses another system plugin | |
| 71 | directory: | |
| 72 | ||
| 73 | sudo make install WEECHAT_PLUGIN_DIR=/path/to/weechat/plugins | |
| 74 | ||
| 75 | To install only for the current user, use: | |
| 76 | ||
| 77 | make install-user | |
| 61 | 78 | |
| 62 | 79 | This installs the release build to: |
| 63 | 80 | |
| @@ -65,7 +82,12 @@ This installs the release build to: | ||
| 65 | 82 | |
| 66 | 83 | Use `PROFILE=debug` for a debug build: |
| 67 | 84 | |
| 68 | make install PROFILE=debug | |
| 85 | make install-user PROFILE=debug | |
| 86 | ||
| 87 | The matching uninstall targets are: | |
| 88 | ||
| 89 | sudo make uninstall | |
| 90 | make uninstall-user | |
| 69 | 91 | |
| 70 | 92 | On older WeeChat setups the plugin directory may instead live under |
| 71 | 93 | `$WEECHAT_HOME/plugins`, commonly `~/.weechat/plugins/`. Create the directory if |