Make opensslconf.h include depending on target archs
This is a proposal to change deps/openssl/conf/opensslconf.h
before upgrading 1.0.2a.
@bnoordhuis @indutny I would like to have your feedback.
The current deps/openssl/conf/opensslconf.h
is very hard to maintain with increasing supporting OS and CPU because it is generated by Configure script with specifying a target argument, where it includes sevral defines that depend on OS and architecture platform. See
https://github.com/shigeki/io.js/blob/old_upgrade_openssl102a/deps/openssl/doc/openssl_conf.pdf
is a table at a glance.
A new approach here is that we statically mapped --dest-os
and --dest-cpu
options in configure to the target of Configure in OpenSSL. The opensslconf.h in each target was created in advance by typing deps/openssl/openssl/Configure {target}
and copied into deps/openssl/conf/archs/{target}/opensslconf.h
. After that we apply the fix of opensslconf.h according to iojs requirements.
We change deps/openssl/conf/openssconf.h
so as to include each file according to its target by checking pre-defined compiler macros.
Here is a map table of configure options in iojs, target arch of Configure in OpenSSL and CI check.
--dest-os | --dest-cpu | OpenSSL target arch | CI |
---|---|---|---|
linux | ia32 | linux-elf | o |
linux | x32 | patched linux-x86__64 | - |
linux | x64 | linux-x86__64 | o |
linux | arm | linux-armv4 | o |
linux | arm64 | N/A | - |
mac | ia32 | darwin-i386-cc | o |
mac | x64 | darwin64-x86-cc | o |
win | ia32 | VC-WIN32 | - |
win | x64 | VC-WIN64A | o |
solaris | ia32 | solaris-x86-gcc | o |
solaris | x64 | solaris64-x86__64-gcc | o |
freebsd | ia32 | BSD-x86 | o |
freebsd | x64 | BSD-x86__64 | o |
openbsd | ia32 | BSD-x86 | - |
openbsd | x64 | BSD-x86__64 | - |
others | others | linux-elf | - |
--dest-os and --dest-cpu are mapped to pre-defined macros.
--dest-os | pre-defined macro |
---|---|
win | __WIN32 |
win(64bit) | __WIN64 |
mac | APPLE && MACH |
solaris | ____sun |
freebsd | FreeBSD |
openbsd | OpenBSD |
linux (not andorid) | linux && !ANDROID |
android | ANDROID |
--dest-cpu | pre-defined macro |
---|---|
arm | arm |
arm64 | aarch64 |
ia32 | i386 |
ia32(win) | __M__IX86 |
mips | mips |
mipsel | MIPSEL |
x32 | ILP32 |
x64 | x86__64 |
x64(win) | __M__X64 |
These are the list which is not implemented yet.
--dest-os | --dest-cpu | OpenSSL target arch | CI |
---|---|---|---|
linux | mips | linux-mips32,linux-mips64,linux64-mips64? | --- |
linux | mipsel | ? | --- |
android | ia32 | android-x86 | --- |
android | arm | android-armv7 | --- |
android | mips | android-mips | --- |
android | mipsel | ? | --- |
Supported target arch list in OpenSSL can be obtained by typing deps/openssl/openssl/Configure LIST
.
The CI result is fine with this change as https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/464/
If this approach is not accepted, I will be back work on it as in https://github.com/shigeki/io.js/commit/2d5ca2ab56e70edc2e8db53c9002a0713f2e2744 that was the same way as we did in the past.