Commit Graph

2 Commits

Author SHA1 Message Date
Miguel A. Colón Vélez 8440d263cd Respect the CC and CXX environment variables when cross building. 2015-01-04 00:56:47 -05:00
Miguel A. Colón Vélez b03ca5fcf4 Include some rather simple CMAKE_TOOLCHAIN_FILE.
- Update the build.sh and fix some typos.
  + Don't add the OSX ones because I have not tested them and it won't
    even build anyway due to the libaio dependency. Needs to use POSIX AIO
    or something else.
- They are rather simple and all the magic happens in two lines.
  + First line tells cmake to get ready to compile FOR linux or darwin.
    It also sets CMAKE_CROSSCOMPILING to true which is the only way to
    let cmake known that we are using stuff not from the host.
  + CMAKE_C_COMPILER/CMAKE_CXX_COMPILER are basically used to detect
    the architecture of the target. Since I used generic cc/c++ the
    hardcoded -m32 is needed to ensure we get TARGET=i386. Also
    since I hardcode -m32 and use c++/cc it's to be noted that
    we can only do i386->i386 (trivial), amd64 -> i386, and x32->i386.
    .
    Using something like i586-linux-gnu-{gcc,g++} would also work and
    enable arm -> i386, etc but it's infeasible and impractical to do all
    the combinations. File is simple enough that a distro or user can
    create their own and cross compiling is rather tedious compared
    to using a chroot to compile it.
- I tested it in Debian with "dpkg-buildpackage -ai386" but installing the
  build dependencies was rather tedious.
2015-01-03 14:51:04 +01:00