node: Fix incorrect detection of arm_version and arm_fpu
authorHirokazu MORIKAWA <redacted>
Thu, 17 May 2018 06:16:52 +0000 (15:16 +0900)
committerHirokazu MORIKAWA <redacted>
Thu, 17 May 2018 06:16:52 +0000 (15:16 +0900)
Automatic detection of the arm architecture does not work well.

http://downloads.lede-project.org/snapshots/faillogs/arm_arm1176jzf-s_vfp/packages/node/compile.txt

```
../deps/v8/src/arm/assembler-arm.cc:176:2: error: #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
 #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
   ^~~~~
```

https://github.com/openwrt/packages/issues/5728

Explicitly set cpu arch optimization flag to the compiler option so that "configure" script correctly identifies "arm version".

(Raspberry Pi Zero W)
Raspbian:
```
raspberrypi:~ $ echo | gcc -dM -E - | grep ARM_ARCH
```
OpenWrt (cross-env):
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -dM -E - | grep ARM_ARCH
```
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -mcpu=arm1176jzf-s -dM -E - | grep ARM_ARCH
```

Also specifying an option lines compactly.

Signed-off-by: Hirokazu MORIKAWA <redacted>
lang/node/Makefile

index 40fa2a3ce25adee55292b6e63e0b69cee4c46c9d..1274caba5ca0264c28287232c6f02bf9125ed890 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=node
 PKG_VERSION:=v8.10.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
 PKG_HASH:=b72d4e71618d6bcbd039b487b51fa7543631a4ac3331d7caf69bdf55b5b2901a
@@ -73,56 +73,27 @@ NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst
 MAKE_VARS+= \
        DESTCPU=$(NODEJS_CPU)
 
+CONFIGURE_VARS:= \
+       CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
+       CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
+       CC_host="$(HOSTCC)" \
+       CXX_host="$(HOSTCXX)"
+
 CONFIGURE_ARGS:= \
        --dest-cpu=$(NODEJS_CPU) \
        --dest-os=linux \
        --without-snapshot \
        --shared-zlib \
        --shared-openssl \
+       --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
+       $(if $(findstring mips,$(NODEJS_CPU)), \
+               $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
+       $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
+       $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
+       $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
+       $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
        --prefix=/usr
 
-ifneq ($(findstring arm,$(NODEJS_CPU)),)
-ifeq ($(CONFIG_SOFT_FLOAT),y)
-CONFIGURE_ARGS+= --with-arm-float-abi=softfp
-else
-
-CONFIGURE_ARGS+= --with-arm-float-abi=hard
-
-ifneq ($(findstring vfp,$(CONFIG_CPU_TYPE)),)
-ARM_FPU=vfp
-endif
-
-ifneq ($(findstring vfpv3,$(CONFIG_CPU_TYPE)),)
-ARM_FPU=vfpv3
-endif
-
-ifneq ($(findstring vfpv3-d16,$(CONFIG_CPU_TYPE)),)
-ARM_FPU=vfpv3-d16
-endif
-
-ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),)
-ARM_FPU=neon
-endif
-
-CONFIGURE_ARGS+= --with-arm-fpu=$(ARM_FPU)
-endif
-endif
-
-ifneq ($(findstring mips,$(NODEJS_CPU)),)
-ifeq ($(CONFIG_SOFT_FLOAT),y)
-CONFIGURE_ARGS+= \
-       --with-mips-float-abi=soft
-endif
-endif
-
-ifeq ($(CONFIG_NODEJS_ICU),y)
-CONFIGURE_ARGS+= \
-       --with-intl=system-icu
-else
-CONFIGURE_ARGS+= \
-       --with-intl=none
-endif
-
 HOST_CONFIGURE_VARS:=
 
 HOST_CONFIGURE_ARGS:= \
git clone https://git.99rst.org/PROJECT