summarylogtreecommitdiffstats
path: root/0001-Add-ability-to-specify-custom-install-prefix-for-pac.patch
blob: e6c551cc2569bf089db81d7f3227379cca065382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
From 9e854fb3c346d8e4afc63c30fdc277b8c7ddbeb4 Mon Sep 17 00:00:00 2001
From: Anish Bhatt <anish7@gmail.com>
Date: Thu, 23 Apr 2015 22:29:55 -0700
Subject: [PATCH] Add ability to specify custom install prefix, for packaging
 purposes

---
 Makefile                         | 14 +++++++++++++-
 doc/Makefile                     |  3 ++-
 package/Makefile                 |  4 ++--
 programs/piaware-config/Makefile |  5 ++---
 programs/piaware-status/Makefile |  5 ++---
 programs/piaware/Makefile        |  5 ++---
 6 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 3937de4..d875ce2 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,18 @@
 # locate the config directory of the init system
 SYSTEMD := $(shell ls -d /etc/systemd/system/ 2>/dev/null)
 SYSVINIT := $(shell ls -d /etc/init.d/ 2>/dev/null)
+TCLSH=$(shell which tclsh || which tclsh8.5 || which tclsh8.6)
+USR_DIR := /usr
+
+ifeq ($(PREFIX),)
+    PREFIX_DIR := $(USR_DIR)
+else
+    PREFIX_DIR := $(PREFIX)/$(USR_DIR)
+    $(warning Installing to $(PREFIX))
+endif
+
+export TCLSH
+export PREFIX_DIR
 
 all:
 	@echo "'make install' as root to install client package and program"
@@ -21,7 +33,7 @@ ifdef SYSVINIT
 	install scripts/piaware-rc-script $(SYSVINIT)piaware
 else
 ifdef SYSTEMD
-	install scripts/piaware.service $(SYSTEMD)
+	install scripts/piaware.service $(PREFIX)/$(SYSTEMD)
 else
 	@echo "No init service found"
 endif
diff --git a/doc/Makefile b/doc/Makefile
index de37361..dff13c3 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -2,7 +2,7 @@
 # makefile for piaware doc files
 #
 
-DOCDIR=/usr/share/man/man1
+DOCDIR=$(PREFIX_DIR)/share/man/man1
 
 MANPAGES= faup1090.1 piaware.1 piaware-config.1 piaware-status.1
 
@@ -11,6 +11,7 @@ all:
 
 install:
 	@echo ---- installing docs
+	install -d $(DOCDIR)
 	cp $(MANPAGES) $(DOCDIR)
 	@echo --- compressing docs
 	cd $(DOCDIR); gzip --force -9 $(MANPAGES)
diff --git a/package/Makefile b/package/Makefile
index ca36ad0..a79768f 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -1,7 +1,7 @@
 
-LIB=/usr/lib/fa_adept_packages
 
-TCLSH=$(shell which tclsh || which tclsh8.5 || which tclsh8.6)
+
+LIB=$(PREFIX_DIR)/lib/fa_adept_packages
 
 FILES=fa_adept_config.tcl fa_adept_client.tcl piaware.tcl ca/DigiCertCA.crt
 
diff --git a/programs/piaware-config/Makefile b/programs/piaware-config/Makefile
index fcf01ee..e56fb61 100644
--- a/programs/piaware-config/Makefile
+++ b/programs/piaware-config/Makefile
@@ -3,9 +3,8 @@
 #  configure and do other stuff as a FlightAware adept client
 #
 
-LIB=/usr/lib
-BIN=/usr/bin
-TCLSH=tclsh8.5
+LIB=$(PREFIX_DIR)/lib
+BIN=$(PREFIX_DIR)/bin
 
 CLIENT_INSTALLFILES= *.tcl
 
diff --git a/programs/piaware-status/Makefile b/programs/piaware-status/Makefile
index 0d434e1..5c341c7 100644
--- a/programs/piaware-status/Makefile
+++ b/programs/piaware-status/Makefile
@@ -3,9 +3,8 @@
 #  get the status of the piaware toolchain
 #
 
-LIB=/usr/lib
-BIN=/usr/bin
-TCLSH=tclsh8.5
+LIB=$(PREFIX_DIR)/lib
+BIN=$(PREFIX_DIR)/bin
 
 CLIENT_INSTALLFILES= *.tcl
 
diff --git a/programs/piaware/Makefile b/programs/piaware/Makefile
index f9f3033..3dd4a44 100644
--- a/programs/piaware/Makefile
+++ b/programs/piaware/Makefile
@@ -3,9 +3,8 @@
 # FA's simple aviation data exchange protocol
 #
 
-LIB=/usr/lib
-BIN=/usr/bin
-TCLSH=tclsh8.5
+LIB=$(PREFIX_DIR)/lib
+BIN=$(PREFIX_DIR)/bin
 
 CLIENT_INSTALLFILES= *.tcl
 
-- 
2.3.5