deps: fix MacOS and Win build for OpenSSL-1.1.1

Because llvm on MacOS does not support AVX-512, asm files need to be limited to
AVX-2 support even when they are generated on Linux.  fake_gcc.pl returns the
fake llvm banner version for MacOS as if the assembler supports upto AVX-2.

For Windows, makefiles for nmake were updated in OpenSSL-1.1.1 and they are
rewritten into GNU makefile format by hand.

PR-URL: https://github.com/nodejs/node/pull/25381
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
pull/25649/head
Shigeki Ohtsu 2018-11-02 03:56:07 +09:00 committed by Sam Roberts
parent 1c5b8e5e24
commit bff1348cfc
6 changed files with 8579 additions and 2622 deletions

View File

@ -15,6 +15,7 @@ linux-armv4 linux-elf linux-x32 linux-x86_64 linux-ppc \
linux-ppc64 linux-ppc64le linux32-s390x linux64-s390x \
solaris-x86-gcc solaris64-x86_64-gcc VC-WIN64A VC-WIN32
CC = gcc
CONFIGURE = ./Configure
# no-comp: against CRIME attack
# no-shared: openssl-cli needs static link
@ -44,8 +45,11 @@ all: $(ARCHS) replace
$(ARCHS):
# Remove openssl .gitignore to follow nodejs .gitignore
if [ -e $(GITIGNORE) ]; then rm $(GITIGNORE); fi
# Confgure asm and generate asm sources
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) $@;
if [ "$(findstring darwin, $@)" = "" ]; then \
cd $(OPSSL_SRC); $(NO_WARN_ENV) ARC=$@ CC=$(CC) $(PERL) $(CONFIGURE) $(COPTS) $@; \
else \
cd $(OPSSL_SRC); $(NO_WARN_ENV) ARC=$@ CC=./fake_gcc.pl $(PERL) $(CONFIGURE) $(COPTS) $@; \
fi
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm $@
# Confgure no-asm and generate no-asm sources
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) \
@ -61,4 +65,4 @@ replace:
clean:
find archs \( -name \*.S -o -name \*.s -o -name \*.asm -o \
-name \*.gypi -o -name \*.h -o -name \*.pm \) -exec rm "{}" \;
-name \*.gypi -o -name \*.h -o -name \*.pm -o -name \*.rc \) -exec rm "{}" \;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

11
deps/openssl/config/fake_gcc.pl vendored 100755
View File

@ -0,0 +1,11 @@
#! /usr/bin/env perl
use 5.10.0;
use strict;
my $arch = $ENV{ARC};
my $ret;
if ($arch =~ /^darwin/) {
$ret = "Apple LLVM version 10.0.0 (clang-1000.11.45.2)\n";
} else {
$ret = `gcc -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`;
}
print STDOUT $ret;

View File

@ -155,6 +155,7 @@ my $clgypi = $cltemplate->fill_in(
libapps_srcs => \@libapps_srcs,
config => \%config,
target => \%target,
asm => \$asm,
arch => \$arch,
lib_cppflags => \@lib_cppflags,
is_win => \$is_win,

View File

@ -28,7 +28,9 @@
],
'openssl_cli_srcs_%%-$arch-%%': [
%%- foreach $src (@apps_openssl_srcs) {
$OUT .= " 'openssl/$src',\n";
unless ($src eq "apps/openssl.rc") {
$OUT .= " 'openssl/$src',\n";
}
}
foreach $src (@libapps_srcs) {
$OUT .= " 'openssl/$src',\n";