summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/cross-compilation.xml39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/cross-compilation.xml b/doc/cross-compilation.xml
index f1194720cfd..118a82bf0b0 100644
--- a/doc/cross-compilation.xml
+++ b/doc/cross-compilation.xml
@@ -200,6 +200,45 @@
     </para></note>
   </section>
 
+  <section>
+    <title>Cross packagaing cookbook</title>
+    <para>
+      Some frequently problems when packaging for cross compilation are good to just spell and answer.
+      Ideally the information above is exhaustive, so this section cannot provide any new information,
+      but its ludicrous and cruel to expect everyone to spend effort working through the interaction of many features just to figure out the same answer to the same common problem.
+      Feel free to add to this list!
+    </para>
+    <qandaset>
+      <qandaentry>
+        <question><para>
+          What if my package's build system needs to build a C program to be run under the build environment?
+        </para></question>
+        <answer><para>
+          <programlisting>depsBuildBuild = [ buildPackages.stdenv.cc ];</programlisting>
+          Add it to your <function>mkDerivation</function> invocation.
+        </para></answer>
+      </qandaentry>
+      <qandaentry>
+        <question><para>
+          My package fails to find <command>ar</command>.
+        </para></question>
+        <answer><para>
+          Many packages assume that an unprefixed <command>ar</command> is available, but Nix doesn't provide one.
+          It only provides a prefixed one, just as it only does for all the other binutils programs.
+          It may be necessary to patch the package to fix the build system to use a prefixed `ar`.
+        </para></answer>
+      </qandaentry>
+      <qandaentry>
+        <question><para>
+          My package's testsuite needs to run host platform code.
+        </para></question>
+        <answer><para>
+          <programlisting>doCheck = stdenv.hostPlatform != stdenv.buildPlatfrom;</programlisting>
+          Add it to your <function>mkDerivation</function> invocation.
+        </para></answer>
+      </qandaentry>
+    </qandaset>
+  </section>
 </section>
 
 <!--============================================================-->