Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My answer works best in tandem with <a href="https://stackoverflow.com/users/1161878/gene">Gene</a>'s answer.</p> <p><code>./configure</code>'s creation of the config file is based on compiling (and possibly running) small snippets of <code>C</code> code for each test. The success of each test sets a corresponding variable in the <code>config.h.in</code> template to create the <code>config.h</code>. The compile-only tests can be successfully tested in a cross-compile environment. However, the compile <em>and</em> run tests are impossible to run in a cross-compile environment. </p> <p>Thus, to start the conversion process, you'll need to set the environment variables <code>CPP</code>,<code>CC</code>,<code>LD</code> and other tool aliases to the cross-compiler set of tools (probably the ones from the <code>NDK</code>) and then run <code>./configure</code>. Once this is done, then you'll need to correct the <code>config.h</code> to match your target environment. <strong>This is your most critical and most error prone step.</strong></p> <p>As for the <code>Android.mk</code>, it follows a format quite close to <code>Makefile.am</code> which can be easily converted into it. You can ignore the <code>Makefile.in</code> and the <code>Makefile</code>, as they are generated from the <code>Makefile.am</code>.</p> <p>To take an example of <a href="http://www.darwinsys.com/file/" rel="nofollow noreferrer">file</a> (version 5.11), I ran configure with the following options,</p> <pre><code>./configure --host arm-toshiba-linux-androideabi --build x86_64-linux-gnu \ --prefix=/data/local/ host_alias=arm-linux-androideabi \ "CFLAGS=--sysroot=~/ndk/platforms/android-8/arch-arm -Wall -Wextra" \ "CPPFLAGS=--sysroot=~/ndk/platforms/android-8/arch-arm" \ CPP=arm-linux-androideabi-cpp </code></pre> <p>The next step was to take the <code>src/Makefile.am</code> as below:</p> <pre><code>MAGIC = $(pkgdatadir)/magic lib_LTLIBRARIES = libmagic.la include_HEADERS = magic.h bin_PROGRAMS = file AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"' AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@ libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \ funcs.c file.h readelf.h tar.h apptype.c \ file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0 if MINGW MINGWLIBS = -lgnurx -lshlwapi else MINGWLIBS = endif libmagic_la_LIBADD = $(LTLIBOBJS) $(MINGWLIBS) file_SOURCES = file.c file_LDADD = libmagic.la CLEANFILES = magic.h EXTRA_DIST = magic.h.in HDR= $(top_srcdir)/src/magic.h.in BUILT_SOURCES = magic.h magic.h: ${HDR} sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" &lt; ${HDR} &gt; $@ </code></pre> <p>And create the <code>Android.mk</code> from this.</p> <p>The last and most important step was to modify the <code>config.h</code> to accurately reflect the state of the target system. This will be a manual process which I cannot give a workaround for, mainly involving looking into the configure.log, looking into the headers and "invoking" Google. The fruits of this labour are available <a href="http://forum.xda-developers.com/showthread.php?t=1612760" rel="nofollow noreferrer">on XDA</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload