[sdks] Build static binaries for Android SDK and LLVM with MXE (#14283)
commit83f17b4cf9e29b2951ad78e949ba7544a53de22d
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Tue, 28 May 2019 12:56:51 +0000 (28 08:56 -0400)
committerGitHub <noreply@github.com>
Tue, 28 May 2019 12:56:51 +0000 (28 08:56 -0400)
tree05d92976da7c3fbb078bc7f4b35f3db632a93a72
parent9fb44af2fe45eef3d6d1033d5d1046453d230a50
[sdks] Build static binaries for Android SDK and LLVM with MXE (#14283)

We used to use the static MXE toolchain, but after switching to Homebrew, we
have to explicitly pass flags to build binaries that don't depend on the
MinGW32 GCC support libraries (libstdc++-6.dll, libwinpthread-1.dll and others)
when building the LLVM and Mono binaries.

The simplest approach is just to pass CMAKE_EXE_LINKER_FLAGS=-static to cmake
and LDFLAGS=-all-static to libtool.  The rest of the changes are just to make
it easier to do that by adding a configure flag and updating the SDKs
infrastructure.

We will also need an LLVM bump to actually build a new llvm archive with the
new build flags; until then, building Mono will provision an old build of LLVM
with the old build flags that still depends on libstdc++-6.dll.

---

An alternative approach instead of passing -all-static and -static would be to
probe for the assorted -static-libXYZ flags to GCC at configure time.  (For the
LLVM build we would need to hardcode them as that build doesn't go through
autoconf).  Right now Mono doesn't have any other DLL dependencies (other than
the core windows DLLs), so -all-static works just as well and is simpler.
configure.ac
llvm/build.mk
mono/mini/Makefile.am.in
sdks/builds/android.mk
sdks/builds/llvm.mk