-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmakefile
More file actions
143 lines (121 loc) · 4.49 KB
/
makefile
File metadata and controls
143 lines (121 loc) · 4.49 KB
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
134
135
136
137
138
139
140
141
142
143
# makefile - LociTerm
# Created: Sun May 1 10:42:59 PM EDT 2022 malakai
# Copyright © 2022-2026 Jeff Jahr <malakai@jeffrika.com>
#
# This file is part of LociTerm - Last Outpost Client Implementation Terminal
#
# LociTerm is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# LociTerm is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with LociTerm. If not, see <https://www.gnu.org/licenses/>.
#
# This section controls the version string that appears in the client, server,
# and archive files, and in the client/server hello protocol. It is a
# major.minor.patch semver. If you are adding localized changes and want to
# bump a version number, don't modify LOCITERM_CORE, instead see the META_
# section below.
LOCITERM_CORE = 2.16.1
# Define these meta-data variables after this comment block if you are keeping
# localized modifications to the code that are not included in the upstream
# lociterm release, but are still roughly compatible with the upstream code.
# This lets you keep track of the version of your localized changes while
# maintaining the ability to merge in lociterm code changes from upstream.
# Browser cached lociterm client code will detect changes in the META_VERSION,
# and reload to get updates.
#
# META_NAME = MyGame
# META_VERSION = 1.0.0
#
# #### Variable definitions ####
BUILD = ./dist
INSTALL = /usr/local
SERVERDIR = ./server
CLIENTDIR = ./client
NPM = ./client/node_modules
CERTNAME = loci
# #### End of tunable makefile parameters ###
# set up LOCITERM_VERSION based on provided semver parameters.
ifneq ($(origin META_NAME), undefined)
LOCITERM_VERSION = $(LOCITERM_CORE)-$(META_NAME).$(META_VERSION)
else
LOCITERM_VERSION = $(LOCITERM_CORE)
endif
TARFILE = ../lociterm_$(LOCITERM_VERSION).tgz
DATEKEY = `date +%y%m%d%H%M`
# #### Recipies Start Here ####
$(info ---------- START OF BUILD -----------)
all : $(BUILD) $(NPM) server client distlauncher
$(info ---------- END OF BUILD --- SUCCESS! -----------)
@echo ---- Run \`./lociterm\` to test out the build, then
@echo ---- run \`make install\` as root to install into $(INSTALL)
.PHONY : server
server : $(BUILD)
cd $(SERVERDIR)/src; make "LOCITERM_VERSION = $(LOCITERM_VERSION)"
cp $(SERVERDIR)/src/build/locid $(BUILD)/bin
cp $(SERVERDIR)/locid.conf $(BUILD)/etc
.PHONY : client
client : $(NPM) $(BUILD)
cd $(CLIENTDIR); npm version --allow-same-version $(LOCITERM_VERSION)
cd $(CLIENTDIR); npm run build
cp -r $(CLIENTDIR)/dist/* $(BUILD)/var/www/lociterm
.PHONY : distlauncher
distlauncher : $(BUILD) server/lociterm.sh
cp server/lociterm.sh lociterm
chmod +x lociterm
# Create run directory...
$(BUILD) :
mkdir -p $(BUILD)
mkdir -p $(BUILD)/bin
mkdir -p $(BUILD)/etc
mkdir -p $(BUILD)/etc/ssl/certs
mkdir -p $(BUILD)/etc/ssl/private
mkdir -p $(BUILD)/var/www/lociterm
mkdir -p $(BUILD)/var/lib/lociterm
$(NPM) :
cd $(CLIENTDIR); npm install
.PHONY: cert
cert : $(BUILD)
$(info --- Creating self-signed cert and key ----)
openssl req -nodes -new -x509 \
-keyout $(BUILD)/etc/ssl/private/$(CERTNAME)_key.pem \
-out $(BUILD)/etc/ssl/certs/$(CERTNAME)_cert.pem
# Cleaning up...
.PHONY : clean
clean :
cd $(SERVERDIR)/src; make clean
cd $(CLIENTDIR); npm run clean
rm lociterm
.PHONY : install
install :
$(info --- install ----)
mv -f $(INSTALL)/bin/locid $(INSTALL)/bin/locid.prev 2>/dev/null || true
cp -av $(BUILD)/* $(INSTALL)
@echo
@echo ---- Ensure you have manually backed up any DB files, THEN... ----
@echo ---- Run \`systemctl restart lociterm.service\` as root to go live ----
.PHONY: systemd
systemd:
cp server/lociterm.service /etc/systemd/system
systemctl enable lociterm.service
.PHONY : tar
tar :
$(info --- Tar file create ----)
tar -C .. -cvz --exclude-vcs --exclude-from=.exclude -f $(TARFILE) lociterm
@echo
@echo ---- Tar File is $(TARFILE) ----
.PHONY : push
push:
@git tag -a lociterm$(LOCITERM_CORE) -m "Version $(LOCITERM_CORE)" || { echo "Remember to update LOCITERM_CORE in the makefile."; exit 1; }
git push origin dev --tags
@echo ---- Run \`make github\` to publish there ----
.PHONY : github
github:
git push github dev --tags