diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-01-12T16·30+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-01-12T16·30+0000 |
commit | c504d90c1159bd0fadd37bb3098ecf8622d0b13c (patch) | |
tree | 0c087a0e0d281afae7dbb79910fdc669516b73f2 /src/libstore | |
parent | 8e39d9bdb30cbe2e7c3f7d9b30ac64c3a2e32684 (diff) |
* Support i686-linux builds directly on x86_64-linux Nix
installations. This is implemented using the personality() syscall, which causes uname to return "i686" in child processes.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/build.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index f015b878c3ee..db2bed6d01f8 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -40,6 +40,12 @@ #define CHROOT_ENABLED HAVE_CHROOT && HAVE_UNSHARE && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(CLONE_NEWNS) +#if HAVE_SYS_PERSONALITY_H +#include <sys/personality.h> +#define CAN_DO_LINUX32_BUILDS +#endif + + namespace nix { using std::map; @@ -1474,7 +1480,11 @@ void DerivationGoal::startBuilder() format("building path(s) %1%") % showPaths(outputPaths(drv.outputs))) /* Right platform? */ - if (drv.platform != thisSystem) + if (drv.platform != thisSystem +#ifdef CAN_DO_LINUX32_BUILDS + && !(drv.platform == "i686-linux" && thisSystem == "x86_64-linux") +#endif + ) throw BuildError( format("a `%1%' is required to build `%3%', but I am a `%2%'") % drv.platform % thisSystem % drvPath); @@ -1806,6 +1816,13 @@ void DerivationGoal::startBuilder() initChild(); +#ifdef CAN_DO_LINUX32_BUILDS + if (drv.platform == "i686-linux" && thisSystem == "x86_64-linux") { + if (personality(PER_LINUX32_3GB) == -1) + throw SysError("cannot set i686-linux personality"); + } +#endif + /* Fill in the environment. */ Strings envStrs; for (Environment::const_iterator i = env.begin(); |