deps: make opensslconf.h include each target arch
authorShigeki Ohtsu <ohtsu@iij.ad.jp>
Thu, 9 Apr 2015 08:46:08 +0000 (17:46 +0900)
committerShigeki Ohtsu <ohtsu@iij.ad.jp>
Fri, 10 Apr 2015 00:53:48 +0000 (09:53 +0900)
commit29a33014617902328b295f46c8417f321f57f67f
treeb019863f3214c3b55125e38e9a71ecead62d389e
parent1219e7466cddf705d340ef566f6c1958f75735bb
deps: make opensslconf.h include each target arch

In OpenSSL, opensslconf.h was generated by Configure script with
specifying a target argument, where it includes several defines that
depend on OS and architecture platform.

In iojs, we statically mapped --dest-os and --dest-cpu options in
configure to the target of Configure in OpenSSL and make
`deps/openssl/conf/openssconf.h` so as to include each file
according to its target by checking pre-defined compiler macros.

Included opnesslconf.h files for supported target architectures can
be generated by `Makefile` and stored under
`archs/{target}/opensslconf.h`. The Makefile alos fixes several
defines to meet iojs build requirements.

Here is a map table of configure options in iojs, target arch of
Configure in OpenSSL and CI support.

| --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`.

This also contains to add two new defines for all platform in the
bottom for GOST and Padlock engines are not included in iojs.

PR-URL: https://github.com/iojs/io.js/pull/1377
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
deps/openssl/config/opensslconf.h