skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

crosscompile.html (3805B)


      1 <html>
      2   <head>
      3     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5     <meta http-equiv="Content-Language" content="en" />
      6     <title>How to cross-compile skalibs</title>
      7     <meta name="Description" content="How to cross-compile skalibs" />
      8     <meta name="Keywords" content="skalibs build cross-compilation" />
      9     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
     10   </head>
     11 <body>
     12 
     13 <p>
     14 <a href="index.html">skalibs</a><br />
     15 <a href="//skarnet.org/software/">Software</a><br />
     16 <a href="//skarnet.org/">skarnet.org</a>
     17 </p>
     18 
     19 <h1> How to cross-compile skalibs </h1>
     20 
     21 <p>
     22  There are three issues in the world of cross-compilation:
     23 </p>
     24 
     25 <ul>
     26  <li> support for parallel builds: the source directory must be read-only
     27 and each build process must have its own build tree. </li>
     28  <li> support for compiler options: to specify the target architecture,
     29 the header and library files that should be used, etc.
     30  <li> build-time tests performed on the build architecture are invalid
     31 if the target architecture is different. </li>
     32 </ul>
     33 
     34 <h2> Support for parallel builds </h2>
     35 
     36 <p>
     37  skalibs does not support out-of-tree builds at the moment,
     38 but since the source code tree is small, it's not costly to duplicate it
     39 to perform parallel builds. If the source code tree grows significantly
     40 larger, out-of-tree build support will be considered.
     41 </p>
     42 
     43 <h3> Support for staging </h3>
     44 
     45 <p>
     46  The skalibs Makefile, as well as every other
     47 <a href="//skarnet.org/software/">skarnet.org package</a>'s
     48 Makefile, supports the DESTDIR convention for staging. To install
     49 skalibs under a <em>stage</em> fake root:
     50 </p>
     51 
     52 <ul>
     53  <li> Give the options you need to <tt>./configure</tt>.
     54 The arguments to the <tt>--prefix</tt>, <tt>--libdir</tt> and similar
     55 options must be the valid paths for <strong>run-time</strong>. </li>
     56  <li> To install the software, run <tt>make install
     57 DESTDIR=<em>stage</em></tt>. </li>
     58 </ul>
     59 
     60 <h2> Support for build-time options and bypassing target execution tests </h2>
     61 
     62 <p>
     63  skalibs uses a standard <tt>./configure &amp;&amp; make &amp;&amp; make install</tt>
     64 process, and cross-compiling build-time options can be given on the
     65 <tt>./configure</tt> command line.
     66 </p>
     67 
     68 <p>
     69  skalibs performs a certain number of build-time tests, to collect
     70 behaviour information on the target architecture. Most of these tests
     71 work when cross-compiling, because they only involve characteristics
     72 of the target that the cross-toolchain knows at build time; but some
     73 actually require code execution on the target, and so they cannot be
     74 performed when cross-compiling. For those, you have to manually
     75 give a special option to configure, to tell the build system what the
     76 behaviour of the target architecture is. The option is of the form
     77 <tt>--with-sysdep-<em>key</em>=<em>value</em></tt>, where <em>key</em>
     78 is the name of the sysdep (i.e. the element of target behaviour that
     79 is being tested), and <em>value</em> the associated value, most of
     80 the time <tt>yes</tt> or <tt>no</tt>.
     81 </p>
     82 
     83 <p>
     84  At all times, <tt>./configure --help</tt> provides the list of sysdeps
     85 you need to provide a <tt>--with-sysdep-*</tt> option for. As of
     86 skalibs-2.14.0.1, there are two sysdeps in this case:
     87 </p>
     88 
     89 <ul>
     90  <li> <tt>devurandom</tt>: <tt>yes</tt> if the target has a valid
     91 pseudorandom generation device in <tt>/dev/urandom</tt>, and <tt>no</tt>
     92 otherwise. </li>
     93  <li> <tt>posixspawnearlyreturn</tt>: <tt>yes</tt> if the target has a broken
     94 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html">posix_spawn()</a>
     95 implementation that can return before the child has successfully exec'ed.
     96 That happens with old glibcs and some virtual platforms. </li>
     97 </ul>
     98 
     99 </body>
    100 </html>