Skip to content

Commit 09dc7be

Browse files
committed
Move recipes
1 parent f1b2aa1 commit 09dc7be

File tree

3 files changed

+106
-55
lines changed

3 files changed

+106
-55
lines changed

tools/make/lib/install/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
# DEPENDENCIES #
2020

21-
# Please keep in alphabetical order...
21+
# Note: keep in alphabetical order...
22+
include $(TOOLS_MAKE_LIB_DIR)/install/electron.mk
2223
include $(TOOLS_MAKE_LIB_DIR)/install/node.mk
2324

2425

tools/make/lib/install/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,34 @@ Removes Node.js native [add-ons][node-js-add-ons].
125125
$ make clean-node-addons
126126
```
127127

128+
* * *
129+
130+
### Electron
131+
132+
##### install-deps-electron
133+
134+
Installs [Electron][electron].
135+
136+
```bash
137+
$ make install-deps-electron
138+
```
139+
140+
##### clean-deps-electron
141+
142+
Removes an installed [Electron][electron] distribution.
143+
144+
```bash
145+
$ make clean-deps-electron
146+
```
147+
148+
##### clean-deps-electron-tests
149+
150+
Removes compiled [Electron][electron] installation tests.
151+
152+
```bash
153+
$ make clean-deps-electron-tests
154+
```
155+
128156
</section>
129157

130158
<!-- /.usage -->
@@ -147,6 +175,8 @@ $ make clean-node-addons
147175

148176
[node-js-add-ons]: https://nodejs.org/api/addons.html
149177

178+
[electron]: https://www.electronjs.org/
179+
150180
</section>
151181

152182
<!-- /.links -->
Lines changed: 74 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ DEPS_ELECTRON_URL ?= https://github.com/electron/electron/releases/download/v$(D
2424
# Determine the basename for the download:
2525
deps_electron_basename := $(notdir $(DEPS_ELECTRON_URL))
2626

27-
# Define the path to the file containing a checksum verify a download:
28-
DEPS_ELECTRON_CHECKSUM ?= $(shell cat $(DEPS_CHECKSUMS_DIR)/$(subst .,_,$(subst -,_,$(deps_electron_basename)))/sha256)
27+
# Define the path to the file containing a checksum to verify a download:
28+
DEPS_ELECTRON_CHECKSUM ?= $(shell $(CAT) $(DEPS_CHECKSUMS_DIR)/$(subst .,_,$(subst -,_,$(deps_electron_basename)))/sha256)
2929

3030
# Define the output path when downloading:
3131
DEPS_ELECTRON_DOWNLOAD_OUT ?= $(DEPS_TMP_DIR)/$(deps_electron_basename)
@@ -72,96 +72,109 @@ deps_electron_prereqs := \
7272
deps_electron_dest := $(NODE_MODULES)/@stdlib/electron
7373

7474

75-
# TARGETS #
75+
# RULES #
7676

77-
# Download.
77+
#/
78+
# Downloads an Electron distribution.
7879
#
79-
# This target downloads an Electron distribution.
80-
80+
# @private
81+
#/
8182
$(DEPS_ELECTRON_DOWNLOAD_OUT): | $(DEPS_TMP_DIR)
8283
$(QUIET) echo 'Downloading Electron...' >&2
8384
$(QUIET) $(DEPS_DOWNLOAD_BIN) $(DEPS_ELECTRON_URL) $(DEPS_ELECTRON_DOWNLOAD_OUT)
8485

85-
86-
# Path.
86+
#/
87+
# Creates a text file containing the executable path.
8788
#
88-
# This target creates a text file containing the executable path.
89-
89+
# @private
90+
#/
9091
$(DEPS_ELECTRON_BUILD_OUT)/path.txt: | $(DEPS_BUILD_DIR)
9192
$(QUIET) $(MKDIR_RECURSIVE) $(DEPS_ELECTRON_BUILD_OUT)
9293
$(QUIET) printf $(deps_electron_path) > $(DEPS_ELECTRON_BUILD_OUT)/path.txt
9394

94-
95-
# Main entry point.
95+
#/
96+
# Creates the main entry point for a Node.js wrapper package.
9697
#
97-
# This target creates the main entry point for the Node.js wrapper package.
98-
98+
# @private
99+
#/
99100
$(DEPS_ELECTRON_BUILD_OUT)/index.js: | $(DEPS_BUILD_DIR)
100101
$(QUIET) $(MKDIR_RECURSIVE) $(DEPS_ELECTRON_BUILD_OUT)
101102
$(QUIET) printf $(deps_electron_index) > $(DEPS_ELECTRON_BUILD_OUT)/index.js
102103

103-
104-
# Command-line interface.
104+
#/
105+
# Creates a Node.js Electron command-line interface (CLI).
105106
#
106-
# This target creates the Node.js Electron command-line interface (CLI).
107-
107+
# @private
108+
#/
108109
$(DEPS_ELECTRON_BUILD_OUT)/cli.js: | $(DEPS_BUILD_DIR)
109110
$(QUIET) $(MKDIR_RECURSIVE) $(DEPS_ELECTRON_BUILD_OUT)
110111
$(QUIET) printf $(deps_electron_cli) > $(DEPS_ELECTRON_BUILD_OUT)/cli.js
111112

112-
113-
# Package.json.
113+
#/
114+
# Creates an Node.js Electron package meta data file.
114115
#
115-
# This target creates the Node.js Electron package meta data file.
116-
116+
# @private
117+
#/
117118
$(DEPS_ELECTRON_BUILD_OUT)/package.json: | $(DEPS_BUILD_DIR)
118119
$(QUIET) $(MKDIR_RECURSIVE) $(DEPS_ELECTRON_BUILD_OUT)
119120
$(QUIET) printf $(deps_electron_package_json) > $(DEPS_ELECTRON_BUILD_OUT)/package.json
120121

121-
122-
# Extract.
122+
#/
123+
# Extracts a downloaded Electron ZIP archive.
123124
#
124-
# This target extracts a ZIP archive.
125-
125+
# @private
126+
#/
126127
$(DEPS_ELECTRON_BUILD_OUT): $(DEPS_ELECTRON_DOWNLOAD_OUT) $(deps_electron_prereqs) | $(DEPS_BUILD_DIR)
127128
$(QUIET) echo 'Extracting Electron...' >&2
128129
$(QUIET) $(MKDIR_RECURSIVE) $(DEPS_ELECTRON_BUILD_OUT)/dist
129130
$(QUIET) $(UNZIP) -q $(DEPS_ELECTRON_DOWNLOAD_OUT) -d $@/dist
130131

131-
132-
# Download Electron.
132+
#/
133+
# Downloads an Electron distribution.
133134
#
134-
# This target downloads an Electron distribution.
135-
135+
# @private
136+
#
137+
# @example
138+
# make deps-download-electron
139+
#/
136140
deps-download-electron: $(DEPS_ELECTRON_DOWNLOAD_OUT)
137141

138142
.PHONY: deps-download-electron
139143

140-
141-
# Verify download.
144+
#/
145+
# Verifies a downloaded Electron distribution.
142146
#
143-
# This targets verifies a download.
144-
147+
# @private
148+
#
149+
# @example
150+
# make deps-verify-electron
151+
#/
145152
deps-verify-electron: deps-download-electron
146153
$(QUIET) echo 'Verifying download...' >&2
147154
$(QUIET) $(DEPS_CHECKSUM_BIN) $(DEPS_ELECTRON_DOWNLOAD_OUT) $(DEPS_ELECTRON_CHECKSUM) >&2
148155

149156
.PHONY: deps-verify-electron
150157

151-
152-
# Extract Electron.
158+
#/
159+
# Extracts an Electron download.
153160
#
154-
# This target extracts an Electron download.
155-
161+
# @private
162+
#
163+
# @example
164+
# make deps-extract-electron
165+
#/
156166
deps-extract-electron: $(DEPS_ELECTRON_BUILD_OUT)
157167

158168
.PHONY: deps-extract-electron
159169

160-
161-
# Test install.
170+
#/
171+
# Tests an Electron installation.
162172
#
163-
# This target tests an installation.
164-
173+
# @private
174+
#
175+
# @example
176+
# make deps-test-electron
177+
#/
165178
deps-test-electron: $(DEPS_ELECTRON_BUILD_OUT)/cli.js
166179
$(QUIET) echo 'Running tests...' >&2
167180
$(QUIET) $(NODE) $< --version >&2
@@ -170,33 +183,40 @@ deps-test-electron: $(DEPS_ELECTRON_BUILD_OUT)/cli.js
170183

171184
.PHONY: deps-test-electron
172185

173-
174-
# Install Electron.
186+
#/
187+
# Installs Electron.
175188
#
176-
# This target installs Electron.
177-
189+
# @example
190+
# make install-deps-electron
191+
#/
178192
install-deps-electron: deps-download-electron deps-verify-electron deps-extract-electron deps-test-electron
179193
$(QUIET) $(MKDIR_RECURSIVE) $(deps_electron_dest)
180194
$(QUIET) $(CP) -rp $(DEPS_ELECTRON_BUILD_OUT)/* $(deps_electron_dest)
181195

182196
.PHONY: install-deps-electron
183197

184-
185-
# Clean Electron.
198+
#/
199+
# Removes an Electron distribution.
186200
#
187-
# This target removes an Electron distribution (but does not remove an Electron download if one exists).
188-
201+
# ## Notes
202+
#
203+
# - This recipe does **not** remove an Electron download if one exists.
204+
#
205+
# @example
206+
# make clean-deps-electron
207+
#/
189208
clean-deps-electron: clean-deps-electron-tests
190209
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_ELECTRON_BUILD_OUT)
191210
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(deps_electron_dest)
192211

193212
.PHONY: clean-deps-electron
194213

195-
196-
# Clean tests.
214+
#/
215+
# Removes Electron installation test artifacts.
197216
#
198-
# This targets remove installation tests.
199-
217+
# @example
218+
# make clean-deps-electron-tests
219+
#/
200220
clean-deps-electron-tests:
201221

202222
.PHONY: clean-deps-electron-tests

0 commit comments

Comments
 (0)