Commit 4e72e62dfafe87fff8760f18c0932100ef6bb625

Authored by Matti Virkkunen
1 parent f606995b

Add real install/uninstall targets.

Showing 2 changed files with 31 additions and 12 deletions
Makefile
... ... @@ -2,8 +2,13 @@ CXX = g++
2 2 CXXFLAGS = -g -Wall -shared -fPIC \
3 3 -DHAVE_INTTYPES_H -DHAVE_CONFIG_H -DPURPLE_PLUGINS \
4 4 `pkg-config --cflags purple thrift`
  5 +THRIFT = thrift
  6 +
5 7 LIBS = `pkg-config --libs purple thrift`
6 8  
  9 +PURPLE_PLUGIN_DIR:=$(shell pkg-config --variable=plugindir purple)
  10 +PURPLE_DATA_ROOT_DIR:=$(shell pkg-config --variable=datarootdir purple)
  11 +
7 12 MAIN = libline.so
8 13  
9 14 GEN_SRCS = thrift_line/line_main_constants.cpp thrift_line/line_main_types.cpp \
... ... @@ -26,17 +31,29 @@ $(MAIN): $(OBJS)
26 31  
27 32 thrift_line: line_main.thrift
28 33 mkdir -p thrift_line
29   - thrift --gen cpp -out thrift_line line_main.thrift
  34 + $(THRIFT) --gen cpp -out thrift_line line_main.thrift
30 35  
  36 +.PHONY: clean
31 37 clean:
32 38 rm -f $(MAIN)
33 39 rm -f *.o
34 40 rm -rf thrift_line
35 41  
36   -# TODO: Make proper install target
37   -install:
38   - mkdir -p ~/.purple/plugins
39   - cp $(MAIN) ~/.purple/plugins
  42 +.PHONY: user-install
  43 +user-install: all
  44 + install -D $(MAIN) ~/.purple/plugins/$(MAIN)
  45 +
  46 +.PHONY: user-uninstall
  47 +user-uninstall:
  48 + rm -f ~/.purple/plugins/$(MAIN)
  49 +
  50 +.PHONY: install
  51 +install: all
  52 + install -D $(MAIN) $(DESTDIR)$(PURPLE_PLUGIN_DIR)/$(MAIN)
  53 +
  54 +.PHONY: uninstall
  55 +uninstall:
  56 + rm -f $(DESTDIR)$(PURPLE_PLUGIN_DIR)/$(MAIN)
40 57  
41 58 depend: .depend
42 59  
... ... @@ -45,5 +62,3 @@ depend: .depend
45 62 $(CXX) $(CXXFLAGS) -MM $(REAL_SRCS) >>.depend
46 63  
47 64 -include .depend
48   -
49   -.PHONY: clean
... ...
README.md
... ... @@ -25,19 +25,23 @@ How to install
25 25  
26 26 Make sure you have the required prerequisites:
27 27  
28   -* libpurple - probably available via package manager
  28 +* libpurple - probably available from your package manager
29 29 * Apache Thrift compiler and C++ library - v0.9.1 should be stable. The Git version and OS packages
30 30 are sometimes a bit iffy. Compiling by hand is your best bet.
31 31 * line_main.thrift - not included, must be placed in the project root directory. For the time being,
32 32 you can acquire this file from the documentation at http://altrepo.eu/
33 33  
34   -Then simply run:
  34 +To install the plugin system-wide, run:
35 35  
36 36 make
37   - make install
  37 + sudo make install
38 38  
39   -This will build and install the plugin into your home directory. Builds are only tested on Arch
40   -Linux and a recent Ubuntu for now.
  39 +You can also install the plugin for your user only by running:
  40 +
  41 + make
  42 + make user-install
  43 +
  44 +Builds are only tested on Arch Linux and a recent Ubuntu for now.
41 45  
42 46 Implemented
43 47 -----------
... ...