From 8eff648f0953a954c7414dff635b5881aece0a25 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Mon, 22 May 2017 17:46:14 +0100 Subject: [PATCH 1/4] build: don't pass DESTCPU to configure unless set If the DESTCPU wasn't manually set, the configure platform detection should be better than the Makefile one. If it was manually set, add it to the CONFIG_FLAGS. As DESTCPU no longer needs to be manually set, just set ARCH. Fixes: https://github.com/nodejs/node/issues/13150 --- Makefile | 133 +++++++++++++++++++++++-------------------------------- 1 file changed, 55 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 94e6ff455cca..c49dfac067a7 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,18 @@ ifdef DISABLE_V8_I18N V8_BUILD_OPTIONS += i18nsupport=off endif +# Use Node arch names rather than V8 ones. +ifeq ($(DESTCPU),ia32) + override DESTCPU=x86 +endif +ifeq ($(DESTCPU),aarch64) + override DESTCPU=arm64 +endif + +ifdef DESTCPU + CONFIG_FLAGS += --dest-cpu=$(DESTCPU) +endif + BUILDTYPE_LOWER := $(shell echo $(BUILDTYPE) | tr '[A-Z]' '[a-z]') # Determine EXEEXT @@ -564,86 +576,53 @@ RELEASE=$(shell sed -ne 's/\#define NODE_VERSION_IS_RELEASE \([01]\)/\1/p' src/n PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]') NPMVERSION=v$(shell cat deps/npm/package.json | grep '"version"' | sed 's/^[^:]*: "\([^"]*\)",.*/\1/') -UNAME_M=$(shell uname -m) -ifeq ($(findstring x86_64,$(UNAME_M)),x86_64) -DESTCPU ?= x64 -else -ifeq ($(findstring ppc64,$(UNAME_M)),ppc64) -DESTCPU ?= ppc64 -else -ifeq ($(findstring ppc,$(UNAME_M)),ppc) -DESTCPU ?= ppc -else -ifeq ($(findstring s390x,$(UNAME_M)),s390x) -DESTCPU ?= s390x -else -ifeq ($(findstring s390,$(UNAME_M)),s390) -DESTCPU ?= s390 +ifdef DESTCPU + ARCH = $(DESTCPU) else -ifeq ($(findstring arm,$(UNAME_M)),arm) -DESTCPU ?= arm -else -ifeq ($(findstring aarch64,$(UNAME_M)),aarch64) -DESTCPU ?= aarch64 -else -ifeq ($(findstring powerpc,$(shell uname -p)),powerpc) -DESTCPU ?= ppc64 -else -DESTCPU ?= x86 -endif -endif -endif -endif -endif -endif -endif -endif -ifeq ($(DESTCPU),x64) -ARCH=x64 -else -ifeq ($(DESTCPU),arm) -ARCH=arm -else -ifeq ($(DESTCPU),aarch64) -ARCH=arm64 -else -ifeq ($(DESTCPU),ppc64) -ARCH=ppc64 -else -ifeq ($(DESTCPU),ppc) -ARCH=ppc -else -ifeq ($(DESTCPU),s390) -ARCH=s390 -else -ifeq ($(DESTCPU),s390x) -ARCH=s390x -else -ARCH=x86 -endif -endif -endif -endif -endif -endif -endif - -# node and v8 use different arch names (e.g. node 'x86' vs v8 'ia32'). -# pass the proper v8 arch name to $V8_ARCH based on user-specified $DESTCPU. -ifeq ($(DESTCPU),x86) + UNAME_M=$(shell uname -m) + ifeq ($(findstring x86_64,$(UNAME_M)),x86_64) + ARCH ?= x64 + else + ifeq ($(findstring ppc64,$(UNAME_M)),ppc64) + ARCH ?= ppc64 + else + ifeq ($(findstring ppc,$(UNAME_M)),ppc) + ARCH ?= ppc + else + ifeq ($(findstring s390x,$(UNAME_M)),s390x) + ARCH ?= s390x + else + ifeq ($(findstring s390,$(UNAME_M)),s390) + ARCH ?= s390 + else + ifeq ($(findstring arm,$(UNAME_M)),arm) + ARCH ?= arm + else + ifeq ($(findstring aarch64,$(UNAME_M)),aarch64) + ARCH ?= aarch64 + else + ifeq ($(findstring powerpc,$(shell uname -p)),powerpc) + ARCH ?= ppc64 + else + ARCH ?= x86 + endif + endif + endif + endif + endif + endif + endif + endif +endif + +# Handle Node and V8 arch name differences for x86 and arm64. +ifeq ($(ARCH),x86) V8_ARCH=ia32 -else -V8_ARCH ?= $(DESTCPU) - endif - -# enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel -ifeq ($(ARCH),ia32) -override ARCH=x86 -endif -ifeq ($(DESTCPU),ia32) -override DESTCPU=x86 +ifeq ($(ARCH),arm64) +V8_ARCH ?= aarch64 endif +V8_ARCH ?= $(ARCH) TARNAME=node-$(FULLVERSION) TARBALL=$(TARNAME).tar @@ -762,7 +741,6 @@ doc-upload: doc $(TARBALL)-headers: release-only $(PYTHON) ./configure \ --prefix=/ \ - --dest-cpu=$(DESTCPU) \ --tag=$(TAG) \ --release-urlbase=$(RELEASE_URLBASE) \ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) @@ -794,7 +772,6 @@ $(BINARYTAR): release-only $(RM) -r out/deps out/Release $(PYTHON) ./configure \ --prefix=/ \ - --dest-cpu=$(DESTCPU) \ --tag=$(TAG) \ --release-urlbase=$(RELEASE_URLBASE) \ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) From d70e5135c5f5fa7c870c6b7c1a2ffd2716f7e7f7 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 23 May 2017 23:00:37 +0100 Subject: [PATCH 2/4] Tmp --- doc/api/assert.md | 4 +- doc/api/buffer.md | 16 ++++---- doc/api/child_process.md | 8 ++-- doc/api/cli.md | 12 +++--- doc/api/console.md | 2 +- doc/api/crypto.md | 12 +++--- doc/api/dgram.md | 4 +- doc/api/domain.md | 4 +- doc/api/process.md | 2 +- doc/api/querystring.md | 2 +- doc/api/stream.md | 8 ++-- doc/api/string_decoder.md | 2 +- doc/api/tls.md | 6 +-- doc/api/util.md | 4 +- doc/api/v8.md | 14 +++---- doc/api/zlib.md | 86 +++++++++++++++++++-------------------- src/node_version.h | 2 +- 17 files changed, 94 insertions(+), 94 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 3ad9d336460e..c9c5a9ede26c 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -18,7 +18,7 @@ An alias of [`assert.ok()`][]. @@ -736,7 +736,7 @@ console.log(arr.sort(Buffer.compare)); @@ -984,7 +984,7 @@ console.log(buffer.buffer === arrayBuffer); @@ -1257,7 +1257,7 @@ console.log(buf.includes('this', 4)); @@ -1503,7 +1503,7 @@ console.log(buf.length); ### buf.parent > Stability: 0 - Deprecated: Use [`buf.buffer`] instead. @@ -2517,7 +2517,7 @@ Note that this is a property on the `buffer` module returned by diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 7bc523f64661..fff0e5876e53 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -297,7 +297,7 @@ getVersion(); @@ -737,7 +737,7 @@ execution.** Emit pending deprecation warnings. @@ -160,7 +160,7 @@ Silence all process warnings (including deprecations). ### `--napi-modules` Enable loading native modules compiled with the ABI-stable Node.js API (N-API) @@ -175,7 +175,7 @@ Print stack traces for process warnings (including deprecations). ### `--redirect-warnings=file` Write process warnings to the given file instead of printing to stderr. The @@ -399,7 +399,7 @@ When set to `1`, process warnings are silenced. ### `NODE_OPTIONS=options...` `options...` are interpreted as if they had been specified on the command line @@ -437,7 +437,7 @@ V8 options that are allowed are: ### `NODE_PENDING_DEPRECATION=1` When set to `1`, emit pending deprecation warnings. @@ -519,7 +519,7 @@ OpenSSL, it may cause them to trust the same CAs as node. ### `NODE_REDIRECT_WARNINGS=file` When set, process warnings will be emitted to the given file instead of diff --git a/doc/api/console.md b/doc/api/console.md index ca4ff637d9e1..0f1d8308221b 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -55,7 +55,7 @@ myConsole.warn(`Danger ${name}! Danger!`); ## Class: Console @@ -1095,7 +1095,7 @@ This can be called many times with new data as it is streamed. @@ -1277,10 +1277,10 @@ The `key` is the raw key used by the `algorithm` and `iv` is an * `warning` {string|Error} The warning to emit. diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 64d557eec722..197ed179f024 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -31,7 +31,7 @@ necessary by assigning `querystring.escape` to an alternative function. Destroy the stream, and emit the passed error. After this call, the @@ -1081,7 +1081,7 @@ myReader.on('readable', () => { ##### readable.destroy([error]) Destroy the stream, and emit `'error'`. After this call, the @@ -1130,7 +1130,7 @@ Examples of Transform streams include: ##### transform.destroy([error]) Destroy the stream, and emit `'error'`. After this call, the @@ -1389,7 +1389,7 @@ user programs. #### writable.\_destroy(err, callback) * `err` {Error} An error. diff --git a/doc/api/string_decoder.md b/doc/api/string_decoder.md index a92f62ebcdfe..ab95bb315a9f 100644 --- a/doc/api/string_decoder.md +++ b/doc/api/string_decoder.md @@ -68,7 +68,7 @@ is performed before returning the remaining input. * `original` {Function} @@ -471,7 +471,7 @@ standard format of taking an error-first callback as the last argument. ### util.promisify.custom * {symbol} diff --git a/doc/api/v8.md b/doc/api/v8.md index 21c2627898e4..a36fcb385556 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -11,7 +11,7 @@ const v8 = require('v8'); ## v8.cachedDataVersionTag() Returns an integer representing a "version tag" derived from the V8 version, @@ -172,7 +172,7 @@ changes to the API or wire format) may occur until this warning is removed. ### v8.serialize(value) * Returns: {Buffer} @@ -181,7 +181,7 @@ Uses a [`DefaultSerializer`][] to serialize `value` into a buffer. ### v8.deserialize(buffer) * `buffer` {Buffer|Uint8Array} A buffer returned by [`serialize()`][]. @@ -191,7 +191,7 @@ from a buffer. ### class: v8.Serializer #### new Serializer() @@ -300,7 +300,7 @@ The default is not to treat those objects as host objects. ### class: v8.Deserializer #### new Deserializer(buffer) @@ -379,7 +379,7 @@ provided by subclasses. ### class: v8.DefaultSerializer A subclass of [`Serializer`][] that serializes `TypedArray` @@ -388,7 +388,7 @@ stores the part of their underlying `ArrayBuffer`s that they are referring to. ### class: v8.DefaultDeserializer A subclass of [`Deserializer`][] corresponding to the format written by diff --git a/doc/api/zlib.md b/doc/api/zlib.md index f889914bb0ba..35ec0d5825e6 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -277,7 +277,7 @@ Compression strategy. @@ -502,10 +502,10 @@ changes: @@ -518,10 +518,10 @@ Compress a chunk of data with [Deflate][]. @@ -529,10 +529,10 @@ changes: @@ -545,10 +545,10 @@ Compress a chunk of data with [DeflateRaw][]. @@ -556,10 +556,10 @@ changes: @@ -572,10 +572,10 @@ Decompress a chunk of data with [Gunzip][]. @@ -583,10 +583,10 @@ changes: @@ -599,10 +599,10 @@ Compress a chunk of data with [Gzip][]. @@ -610,10 +610,10 @@ changes: @@ -626,10 +626,10 @@ Decompress a chunk of data with [Inflate][]. @@ -637,10 +637,10 @@ changes: @@ -653,10 +653,10 @@ Decompress a chunk of data with [InflateRaw][]. @@ -664,10 +664,10 @@ changes: diff --git a/src/node_version.h b/src/node_version.h index ff194b21815d..056ecde0aa5a 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -26,7 +26,7 @@ #define NODE_MINOR_VERSION 0 #define NODE_PATCH_VERSION 0 -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) From 5e1cabf970531938ed58c6567127afdfe486693c Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 23 May 2017 23:02:09 +0100 Subject: [PATCH 3/4] Tmp: hack makefile to echo vars --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c49dfac067a7..aea9a24251de 100644 --- a/Makefile +++ b/Makefile @@ -767,7 +767,8 @@ ifeq ($(XZ), 0) ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-headers.tar.xz.done" endif -$(BINARYTAR): release-only +$(BINARYTAR): #release-only + echo arch=$(ARCH), destcpu=$(DESTCPU), binaryname=$(BINARYNAME), binarytar=$(BINARYTAR) #&& exit 1 $(RM) -r $(BINARYNAME) $(RM) -r out/deps out/Release $(PYTHON) ./configure \ @@ -790,7 +791,8 @@ endif binary: $(BINARYTAR) binary-upload: binary - ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" + echo arch=$(ARCH), destcpu=$(DESTCPU) #&& exit 1 + #ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" chmod 664 node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz scp -p node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz.done" From 67116238b65c1c787f2cd01bdefeabdd4ef72cb7 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Fri, 26 May 2017 13:33:42 +0100 Subject: [PATCH 4/4] TODO --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index aea9a24251de..4b9170cfb09e 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ ifeq ($(DESTCPU),aarch64) endif ifdef DESTCPU + # TODO(gib): only add if not already there CONFIG_FLAGS += --dest-cpu=$(DESTCPU) endif