From acf63b009dd1289bffa83201d49596df3d0885f7 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Wed, 5 Aug 2020 21:26:13 -0500 Subject: [PATCH] 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 --- Makefile | 16 ++++++++++++++++ deps/openssl/config/Dockerfile | 12 ++++++++++++ doc/guides/maintaining-openssl.md | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 deps/openssl/config/Dockerfile diff --git a/Makefile b/Makefile index 2449655ada15f2..03a3b14acc35af 100644 --- a/Makefile +++ b/Makefile @@ -1400,3 +1400,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 diff --git a/deps/openssl/config/Dockerfile b/deps/openssl/config/Dockerfile new file mode 100644 index 00000000000000..59adb3f4d73c23 --- /dev/null +++ b/deps/openssl/config/Dockerfile @@ -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 diff --git a/doc/guides/maintaining-openssl.md b/doc/guides/maintaining-openssl.md index 34deb05523b15c..8867f805acdb6b 100644 --- a/doc/guides/maintaining-openssl.md +++ b/doc/guides/maintaining-openssl.md @@ -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 ```