From 7fb01df39ff083b79652ecc17382457b8a1063f3 Mon Sep 17 00:00:00 2001 From: wowario Date: Thu, 8 Apr 2021 11:06:36 +0300 Subject: [PATCH] add make install, uninstall, clean --- HACKING.md | 24 ++++++++++++++++++++++++ Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/HACKING.md b/HACKING.md index 6b8fe78..a84e8c9 100644 --- a/HACKING.md +++ b/HACKING.md @@ -82,6 +82,30 @@ Enable debugging symbols: -DCMAKE_BUILD_TYPE=Debug ``` +## Make + +To install WOWlet in local user directory, run: + +```bash +make install +``` +For macOS, the app is moved to user's Desktop. + +To remove all installed files, run: + +```bash +make uninstall +``` + +This will also delete the the app's .config file. So, if you want to keep +configurations, be sure to back up the file before uninstalling. + +To delete the build directory, run: + +```bash +make clean +``` + ## Wowlet It's best to install Tor locally as a service and start `wowlet` with `--use-local-tor`, this diff --git a/Makefile b/Makefile index 03e41a4..824dee1 100644 --- a/Makefile +++ b/Makefile @@ -74,3 +74,45 @@ mac-release: cmake -Bbuild $(CMAKEFLAGS) $(MAKE) -Cbuild $(MAKE) -Cbuild deploy + +install: +ifeq ($(shell uname),Linux) + install -d ~/.local/bin + install -d ~/.local/share/man/man1 + install -d ~/.local/share/applications + install -d ~/.local/share/icons/hicolor/scalable/apps + install -m755 build/bin/wowlet ~/.local/bin + install -m644 src/assets/wowlet.1.gz ~/.local/share/man/man1 + install -m644 src/assets/org.wowlet.wowlet.desktop ~/.local/share/applications + install -m644 src/assets/images/appicons/wowlet.svg ~/.local/share/icons/hicolor/scalable/apps + @echo "Wowlet installed locally to $HOME/.local/bin. To remove program, run: make uninstall"; \ + exit 0; +endif +ifeq ($(shell uname),Darwin) + cp -r build/bin/wowlet.app ~/Desktop/wowlet.app + @echo "Copied wowlet.app to Desktop."; \ + exit 0; +endif + +uninstall: +ifeq ($(shell uname),Linux) + rm -rf ~/.local/bin/wowlet + rm -rf ~/.local/share/man/man1/wowlet.1.gz + rm -rf ~/.local/share/applications/org.wowlet.wowlet.desktop + rm -rf ~/.local/share/icons/hicolor/scalable/apps/wowlet.svg + rm -rf ~/.config/wowlet + @echo "Removed wowlet and cleared config files."; \ + exit 0; +endif +ifeq ($(shell uname),Darwin) + rm -rf ~/Desktop/wowlet.app + rm -rf ~/.config/wowlet + @echo "Removed wowlet.app from Desktop and cleared config files."; \ + exit 0; +endif + +clean: + @echo "WARNING: This will delete the build directory."; \ + read -r -p "Did you want to continue (y/N)?: " CONTINUE; \ + [ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || [ $$CONTINUE = "yes" ] || [ $$CONTINUE = "Yes" ] || exit 1; + rm -rf build \ No newline at end of file