summary refs log tree commit diff
path: root/doc/cross-compilation.xml
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-12-30 21:57:32 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-12-30 22:42:15 -0500
commit8a434b625dc07e0f1e4f39ef6bb1219ab9c58953 (patch)
tree0be19d88bfcceb2b2681e4a156d3e863c0c35c30 /doc/cross-compilation.xml
parentedfe42f3bab5f75baf4a7b11a6458c17725ab432 (diff)
downloadnixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar.gz
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar.bz2
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar.lz
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar.xz
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.tar.zst
nixlib-8a434b625dc07e0f1e4f39ef6bb1219ab9c58953.zip
doc: Add cross cookbook
An excellent suggestion from @bgamari
Diffstat (limited to 'doc/cross-compilation.xml')
-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 f1194720cfd5..118a82bf0b06 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>
 
 <!--============================================================-->