Skip to content

Commit

Permalink
build,deps: add gen-openssl target
Browse files Browse the repository at this point in the history
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: #34642
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
evanlucas authored and richardlau committed Sep 1, 2020
1 parent 4cf93bb commit 755f9e4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 12 additions & 0 deletions deps/openssl/config/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions doc/guides/maintaining-openssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ This updates all sources in deps/openssl/openssl by:
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
```

Expand Down

0 comments on commit 755f9e4

Please sign in to comment.