Skip to content

Commit

Permalink
Add Makefile for distribution packaging
Browse files Browse the repository at this point in the history
This Makefile helps to package tmux-resurrect on GNU/Linux
distributions like openSUSE.
  • Loading branch information
binary-sequence committed Feb 13, 2020
1 parent 905abba commit 12442b0
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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})
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 12442b0

Please sign in to comment.