build,deps: add gen-openssl target

This adds a new make target to generate platform dependent
files for openssl on non-linux machines. The scripts we currently
have in place require linux. This adds a Dockerfile that installs
the necessary dependencies to be able to generate these files.

Previously, it was necessary to run `make -C deps/openssl/config`
on a linux machine. Now, as long as docker is installed and in
your `PATH`, it is possible to run `make gen-openssl`.

PR-URL: https://github.com/nodejs/node/pull/34642
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Evan Lucas 2020-08-05 21:26:13 -05:00
parent ad2c22df61
commit 4b6036a07b
3 changed files with 32 additions and 0 deletions

View File

@ -1406,3 +1406,19 @@ endif
lint-clean:
$(RM) tools/.*lintstamp
$(RM) .eslintcache
HAS_DOCKER ?= $(shell which docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
ifeq ($(HAS_DOCKER), 1)
DOCKER_COMMAND ?= docker run -it -v $(PWD):/node
IS_IN_WORKTREE = $(shell grep '^gitdir: ' $(PWD)/.git 2>/dev/null)
GIT_WORKTREE_COMMON = $(shell git rev-parse --git-common-dir)
DOCKER_COMMAND += $(if $(IS_IN_WORKTREE), -v $(GIT_WORKTREE_COMMON):$(GIT_WORKTREE_COMMON))
gen-openssl: ## Generate platform dependent openssl files (requires docker)
docker build -t node-openssl-builder deps/openssl/config/
$(DOCKER_COMMAND) node-openssl-builder make -C deps/openssl/config
else
gen-openssl:
@echo "No docker command, cannot continue"
@exit 1
endif

12
deps/openssl/config/Dockerfile vendored Normal file
View File

@ -0,0 +1,12 @@
FROM ubuntu:20.04
VOLUME /node
RUN buildDeps='binutils build-essential vim nasm git' \
&& apt-get update \
&& apt-get install -y --no-install-recommends --force-yes $buildDeps \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /node

View File

@ -80,6 +80,10 @@ The patch is currently supported only for openssl-1.1.1e.
Use `make` to regenerate all platform dependent files in
`deps/openssl/config/archs/`:
```console
# On non-linux machines
% make gen-openssl
# On Linux machine
% make -C deps/openssl/config
```