From 12442b0d3e09ffcb611c7febdba83d68045c0f55 Mon Sep 17 00:00:00 2001 From: Sergio Lindo Date: Wed, 12 Feb 2020 14:55:20 +0100 Subject: [PATCH] Add Makefile for distribution packaging This Makefile helps to package tmux-resurrect on GNU/Linux distributions like openSUSE. --- Makefile | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 24 +++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..17d9334 --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +# This file is intended for installation in UNIX based systems +SHELL = /bin/sh +INSTALL = install +INSTALL_DATA = $(INSTALL) -m 0555 +INSTALL_DIR = $(INSTALL) -d -m 0755 + +software_name = tmux-resurrect +prefix = /usr/local +datadir = $(prefix)/share +srcdir = $(prefix)/src +software_srcdir = $(srcdir)/$(software_name) +software_datadir = $(DESTDIR)$(datadir)/$(software_name) + +files = \ +resurrect.tmux \ +save_command_strategies/gdb.sh \ +save_command_strategies/linux_procfs.sh \ +save_command_strategies/pgrep.sh \ +save_command_strategies/ps.sh \ +scripts/check_tmux_version.sh \ +scripts/helpers.sh \ +scripts/process_restore_helpers.sh \ +scripts/restore.exp \ +scripts/restore.sh \ +scripts/save.sh \ +scripts/spinner_helpers.sh \ +scripts/tmux_spinner.sh \ +scripts/variables.sh \ +strategies/irb_default_strategy.sh \ +strategies/mosh-client_default_strategy.sh \ +strategies/nvim_session.sh \ +strategies/vim_session.sh + +subdirs = \ +save_command_strategies \ +scripts \ +strategies + +# It is important to leave two empty lines between define and endef. +# Between those there is a newline character that gets inserted when ${\n} is used. +define \n + + +endef + +.PHONY: all +all: + @echo "This is the default target and does nothing. Use 'make install' to install" + +.PHONY: install +install: installdirs + $(foreach filename, $(files), $(INSTALL_DATA) $(software_srcdir)/$(filename) $(software_datadir)/$(filename)${\n}) + @echo "$(software_name) is installed :)" + +.PHONY: uninstall +uninstall: + $(foreach filename, $(files), rm $(software_datadir)/$(filename)${\n}) + $(foreach dirname, $(subdirs), rmdir $(software_datadir)/$(dirname)${\n}) + @echo "$(software_name) is uninstalled :)" + +.PHONY: installdirs +installdirs: + $(INSTALL_DIR) $(software_datadir) + $(foreach dirname, $(subdirs), $(INSTALL_DIR) $(software_datadir)/$(dirname)${\n}) diff --git a/README.md b/README.md index 9963e55..6d7e8ee 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,30 @@ Add plugin to the list of TPM plugins in `.tmux.conf`: Hit `prefix + I` to fetch the plugin and source it. You should now be able to use the plugin. +### Makefile + +Download the ZIP archive and extract the contents into the source file directory. + + $ wget https://github.com/tmux-plugins/tmux-resurrect/archive/master.zip + $ unzip -n master.zip + $ sudo mv tmux-resurrect-master /usr/local/src/tmux-resurrect + $ cd /usr/local/src/tmux-resurrect + $ sudo make install + +It will copy the needed files into the expected directory on your system, following https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard. + +Add this line to the bottom of `.tmux.conf`: + + run-shell /usr/local/share/tmux-resurrect/resurrect.tmux + +Reload TMUX environment with: `$ tmux source-file ~/.tmux.conf`. +You should now be able to use the plugin. + +To uninstall, execute + + $ cd /usr/local/src/tmux-resurrect + $ sudo make uninstall + ### Manual Installation Clone the repo: