diff --git a/.gitignore b/.gitignore index de1f6b4..8a07642 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ perl-cross.tar perl-cross-*.tar.gz tags +site diff --git a/docs/design.md b/docs/design.md new file mode 100644 index 0000000..03f97f1 --- /dev/null +++ b/docs/design.md @@ -0,0 +1,89 @@ +# Cross-compiling perl + +--- + +All configure-related files (except for ./configure which is just +a wrapper script) are stored in cnf/ directory. +For the sake of clarity/readability, sh functions are used extensively. + +Each config.sh variable is only set once, and immediately written +to config.sh. Attempts to re-set it later are ignored. This scheme is used +to implement hints and handle command-line overrides: both force the value +to be written early, prevent normal configure code from setting it. +Check configure__f.sh for the code that does it. + +Values that cannot be tested on the build host are supposed to be set +by target-specific hint files. See [hints page](hints.md) on this. + +## configure files + +cnf/configure is the entry point, and the only file that calls other +configure_* files. Test-specific functions are defined in their respective +test files. The tests are mostly independent, but do rely on values from +preceeding tests, and most rely on target toolchain being set up. + +## configure variables + +Most variables from config.sh are described in Porting/Glossary in the +perl source. Make sure to check that file. + +To see where a particular variable gets defined, grep its name in cnf/*.sh. +Beware there's one exception: d_(func)_r and (func)_r_proto are not greppable. +Those symbols are set in configure_thrd.sh. + +## Patching perl files + +There are some minor changes perl-cross needs in the original perl files. +Relevant patches for each supported upstream version are supplied in +`cnf/diffs/`. + +The patches are applied by `crosspatch` make target, which is +the first one in `make all` sequence. + +For each successfully applied `cnf/diffs/file.patch` a lock file +`cnf/diffs/file.applied` is created, so the patches are not applied +twice. + +## Building miniperl + +miniperl should work on the build, not target, platform. It is compiled +using native compiler, unlike primary perl executable which is built later +using build-to-target cross-compiler. Because of this, during cross-build +configure is run twice, first to set up miniperl and then to set up +the main perl config. + +Native and target build differ in file extensions: the latter uses usual .o +(default) but the former has .host.o instead. All object files are kept in +the same (root) directory. + +Different configs are used for different platforms: +config.{h,sh} for the target build and xconfig.{h,sh} for build-time miniperl. +**Beware**: this is exactly opposite of what the original Configure does, +The relation was inversed because most tools use config.sh by default, and cross-build +is viewed as primary. Among other things, building extensions with config.sh +is simpler, and extensions are not built for miniperl. + +See also [Cross-compiling modules](modules.md) on some issues +with config files. + +## Build-time scripts + +Most of the time perl-cross tries to use scripts like configpm, +utils/ext/* etc. unchanged. +. + +Some of the code used during build stage tries to load XS modules. +Most of the time, for mundane tasks like can_run() or tempfile() or strftime(). +This is not acceptable for perl-cross, which uses miniperl to run those +(unlike the native makefiles which can and do rely on newly-built perl). + +Current solution is either to patch the offending scripts, or to provide +minimalistic pure-perl stubs for the required XS modules. +Patches are kept in `cnf/diffs`, and stubs are in `cnf/stub`. +In one particular case, Digest::MD5, a dynaloaded module was replaced with +non-XS equivalent Digest::MD5::Perl from CPAN. + +The way configpm used to choose which files to update made no sense with +the new configure, so it was changed: --config-sh, --config-pm and --config-pod +were added, with default values set to config.sh, lib/Config.pm +and lib/Config.pod. diff --git a/docs/download.md b/docs/download.md new file mode 100644 index 0000000..10174ea --- /dev/null +++ b/docs/download.md @@ -0,0 +1,174 @@ +# Cross-compiling perl + +--- + +Current version of perl-cross is 1.1.0 +Supported perl versions: perl-5.24.0, perl-5.25.4, cperl-5.24.0, cperl-5.25.0. +Download it here: + +!!! note " " + + +To use, unpack over an appropriate perl distribution, overwriting the original Makefile. +Use one of supported perl versions; the are version-specific patches inside. + +For older releases, check [GitHub releases branch](https://github.com/arsv/perl-cross/tree/releases). + +## Changelog +- 1.1.0 (2016-09-12) + + Major code cleanup + + Package name changed to `perl-cross-N.M.tar.gz` + + Support for multiple perl versions + + Experimental cperl support + + General list of config.sh variables (configure_genc.sh) removed; values are now written to config.sh immediately + + bash is no longer necessary to run configure; dash or busybox sh should be enough + + Extended -A support removed (prepend and such) + + Build host info (cf_by, cf_email etc) is no longer passed to config.sh + + Various test fixes, and some new tests + + Hints re-arranged, support for compiler hints removed + + Newer gcc get -fwrapv -fno-strict-aliasing in ccflags + + `gccversion` is now set for any cc +- 1.1 (2016-09-10) — botched release, see 1.1.0 instead +- 1.0.3 (2016-06-30) + + perl-5.24.0 + + Android detection and proper osname + + Errno.pm building fixed for Android + + fixed rpath handling in presence of --sysroot + + busybox sed may be used now instead of GNU sed +- 1.0.2 (2015-12-15) + + perl-5.22.1 + + Berkeley DB detection fix (DB::File) +- 1.0.1 (2015-11-03) + + poisoned paths patch from Buildroot + + disable gcc built-ins to avoid false positives in hasfunc + + proper escaping for values written to config.sh +- 1.0.0 (2015-08-26) + + perl-5.22.0 + + floating-point functions detection and minor updates + + absolutely nothing special about this release +- 0.9.7 (2015-06-28) + + MakeMaker library detection fixes + + better --no-dynaloader / --all-static options handling +- 0.9.6 (2015-03-07) + + a2p yacc invocation suppressed for 5.20.2 sources +- 0.9.5 (2015-02-24) + + perl 5.20.2 + + --sysroot handling fixed +- 0.9.4 (2014-11-04) + + --all-static fix +- 0.9.3 (2014-10-14) + + perl 5.20.1 + + bigendian target byteorder detection fix +- 0.9.2 (2014-09-20) + + minor updates to handle perl 5.20.1-RC1 + + soname'd libperl installation +- 0.9.1 (2014-08-26) + + module cleanup for 5.20.0 + + host-installed miniperl stuff removed +- 0.9 (2014-08-01) + + perl-5.20.0 +- 0.8.5 (2014-02-23) + + out-of-source builds with absolute path to the source + + patch --follow-symlinks is not used anymore +- 0.8.4 (2014-02-20) + + variable/versioned libperl.so + + out-of-source building support + + default paths fixed (sitescript/vendorscript) + + some Makefile fixes + + project moved to GitHub +- 0.8.3 (2013-10-19) + + Testpack for on-target testing + + $extensions, ${static,dynamic,nonxs}_ext format changed to match Configure + + $sharepath default fixed +- 0.8.2 (2013-09-09) + + NV-related tests added + + C++ and ELF format test added + + largefile flags are now passed correctly to tests & modules + + $ccdefines variable dropped in favor of $ccflags + + hint files handling changed + + config.sh variables list updated to match current Configure closely + + --with-*, --host-* options handling fixed +- 0.8.1 (2013-09-05) + + perl-5.18.1 (with no changes to perl-cross) + + test-related fixes +- 0.8 (2013-08-08) + + perl-5.18.0 + + module stubs are provided for ExtUtils::* to make them usable with miniperl + + patch application is now done as a bulk phony target; patching the files in-place doen't translate well into make-dependencies + + module paths fixes + + Makefile dependencies cleaned up +- 0.7.4 (2013-04-11) + + shared libperl support; enable with -Duseshrplib + + nv_preserves_uv stuff reset to safe defaults; it can't be tested for currently, but at least it won't cause precision issues +- 0.7.3 (2013-04-05) + + libs/perllibs split, and libswanted handling fixes; NDBM is properly linked now + + standard format for extensions lists in $Config + + install paths adjusted to match mainline perl + + $libpth default value added, DynaLoader::dl_findfile should work now + + drop-in replacement for Digest::MD5, calling Digest::Perl::MD5; no need to alter existing scripts anymore + + patched Liblist now warns about non-usable libraries (and passes relevant tests) + + minor config.sh tweaks +- 0.7.2 (2013-03-25) + + perl-5.16.3 + + preliminary "make test" support (native builds only for now) + + specifying --mode manually should work as expected in most cases + + various configure/Makefile fixes +- 0.7.1 (2012-12-15) + + use gcc for dynalinking modules +- 0.7 (2012-07-06) + + perl-5.16.0 + + original perl files are now patched (vs. supplying modified versions) + + Digest::Perl::MD5 added to allow using install{perl,man} with miniperl + + Module name handling fixed in make_ext_Makefile.pl + + archlib is now $prefix/lib/perl/$archname, instead of just $prefix/lib/perl/arch + + d_csh set to undef, to prevent glob() failures + + useithreads and use5005threads handling added +- 0.6.5 (2012-02-16) + + inttypes.h added in byte order test +- 0.6.4 (2011-12-05) + + /bin/sh changed to /bin/bash, take 2 +- 0.6.3 (2011-11-02) + + perl-5.14.2 (without any actual changes to perl-cross) + + /bin/sh changed to /bin/bash everywhere +- 0.6.2 (2011-09-03) + + Android and Intel CC builds support + + --sysroot is now passed to compiler/linker + + target specifications not recognized by config.sub are allowed + + several configure tests fixes + + no-DynaLoader configuration support +- 0.6.1 (2011-08-24) + + static modules handling fixed + + --all-static option for configure +- 0.6 (2011-08-20) + + perl-5.14 support + + make rules to build disabled modules + + hints switched to flat directory style, added compiler and mode hints + + libswanted handling fixed + + configure now reads patchlevel.h to get perl version + + minor fixes & cleanup +- 0.5 (2011-07-23) + + need_va_copy bug fixed (this is what caused build errors on x86_64) + + configure can now load configuration from a file (-f, -O) + + support for most of the original Configure options (inc. -D, -U, -A) + + --set/-D now allow passing arbitrary variables to config.sh + + make rules to track MakeMaker dependencies + + ccflags/ldflags support fixed + + -DEBUGGING support added + + environment clean-up added, configure no longer stumbles upon stray environment variables + + Time::HiRes specific hints to allow successful builds + + removed module tests for miniperl +- 0.4.1 (2011-04-25) + + make rules for xsubpp changed + + fixed static modules handling +- 0.4 (2011-03-11) + + perl-5.12 support + + miniperl_top introduced + + make rules for all modules, make_ext is no longer used +- 0.3 (2011-03-04) + + threads support + + various fixes done after the demise of the old site +- 0.2 (2009-12-06) + + make rules for DynaLoader fixed + + other minor fixes to allow MIPS build +- 0.1 (2009-01-05) + + first public release diff --git a/docs/hints.md b/docs/hints.md new file mode 100644 index 0000000..16d7726 --- /dev/null +++ b/docs/hints.md @@ -0,0 +1,52 @@ +# Cross-compiling perl + +--- + +Hints are pre-defined values for config.sh variables, used when +testing for particular value is impossible or such test should be +avoided for whatever reasons. + +Hints for perl-cross are stored under `cnf/hints`. +Unless told otherwise with `--hints`, configure will load +hints for `$archname` and `$osname`. A build that ends +up creating `$prefix/lib/perl5/5.24.0/x86_64-linux` likely +starts by loading `cnf/hints/x86_64_linux` and `cnf/hints/linux`. + +Hints in perl-cross are not just regular shell scripts. +They are filtered with `sed` and generally should not contain +anything but + +```text +variable="properly quoted value" +``` + +lines, which are internally converted to + +```text +hint variable "properly quoted value" +``` + +and then executed. + +### Difference between mainline perl hints and perl-cross hints + +Hint files supplied with the mainline perl (hints/ in the source tree) +and not used by perl-cross configure. This is mainly because mainline perl +hint files are expected to take care of preset variables and command line +options by themselves, in style with the rest of Configure, while perl-cross +configure handles such things in a different manner. +These two systems do not mix very well. + +Another reason is that mainline hints are allowed to run tests and look +around in the host system, which is a good way to get into troubles during +cross builds. + +Mainline hints use (os).sh naming scheme and must determine +other aspects of target configuration internally using conditionals. +In contrast, perl-cross uses passive hint files with nothing but variable +assignments in them. + +perl-cross does not support callbacks and per-file cflags from the mainline +hints. Callbacks are not really necessary in non-interactive mode because all +user-set values are known from the very start, and cctype hints partially +solve the problem of compiler related settings. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..164cc57 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,76 @@ +# Cross-compiling perl + +--- + +**perl-cross** provides alternative `configure` script, +top-level Makefile as well as some auxilliary files for the standard +**perl** distribution intended to allow cross-compiling perl in +a relatively straighforward way. + +!!! note " " + perl-cross is not a part of perl distribution, it's a third-party tool in an eternal-alpha state. + + **Use at your own risk!** + + If you can use Configure from the vanilla distribution, you probably should use Configure; + **perl-cross** is for the cases when Configure just can't make it. + +The configure script from perl-cross is essentially a 100 kB long session +of severe sh(1) abuse. Unlike the products of GNU autoconf, it sacrifices +portability for readability; it will likely only run on a relatively sane GNU +system with GNU binutils (which is kind of expected for a cross-build +but still feels like a limitation). + +Typical native build: + +```sh +./configure +make +make DESTDIR=... install +``` + +Typical cross-build for a uclibc system on a Geode board: + +```sh +./configure --target=i586-pc-linux-uclibc +make +make DESTDIR=... install +``` + +See [configure usage](usage.md) page for a complete list +of available `configure` options. + +## History + +perl can't be cross-compiled "out of the box". +You can get an impression it isn't so when you read INSTALL file, +but once you start digging deeper (or just trying to do it), +you quickly find out that this cross-compilation + +- requires SSH access to the target system +- and/or requires hand-crafted config.sh +- ...and still doesn't work +- when performed routinely, is performed in some non-standard way + (by circumventing Configure and patching source tree) + +Cross-compiling is rarely easy, but in case of perl this was not enough to explain why it is **so** hard. +After all, many autoconf'ed projects allow it much easier. +I had no intention to build native toolchain for my Alix project +(more for ideological reasons, not due to impossiblity, but that's another question). +A close look at config.sh made me sure I'm **not** going to hand-craft it. +CE and other ports were outright target-specific hacks, didn't work too and could not satisfy me anyway. +So I started hacking it on my own. + +Currently the whole thing works well enough to suite my needs. +It's still of alpha quality though; use with caution, +and be ready to tweak it (I hope it's tweakable enough). + +## Authors + +Alex Suykov . +Feel free to ask questions, most of the time I'll try to help. + +Several other people contributed patches and suggestions. + +If possible, please report successful builds and/or problems you encountered +while using perl-cross for your particular platform. diff --git a/docs/modules.md b/docs/modules.md new file mode 100644 index 0000000..96ccbc1 --- /dev/null +++ b/docs/modules.md @@ -0,0 +1,130 @@ +# Cross-compiling perl + +--- + +Build process for perl modules is unbelievably complex and awfully unsuited +for cross-compiling. Perl-cross takes some shortcuts to make it work, but it +has its limitations. + +To add a module to your build, unpack it into cpan/ directory before running +configure. Check naming scheme there: a module called `Some::Module` +should be placed in cpan/Some-Module. + +Native builds with cross-compiler perl are not supported. +With rare exceptions, it is not possible to build a module on the target +machine. Everything has to be cross-compiled. + +## The problem with modules + +Building a perl module requires fully functional perl interpreter +and a bunch of rather complex modules available at build time. + +That's a kind of chicken-and-egg problem, perl and modules +are needed to build perl and modules. + +How the problem is resolved in perl-cross: miniperl is instructed +to use module sources directly for non-xs modules, without building +them, and xs modules are replaced with stubs from cnf/stub/ directory. +The entry point for the whole thing is miniperl_top. It runs miniperl +with a bunch of `-I` options to make it look like all the required +modules are available. + +## Makefile rules for modules + +For various reasons, module-related make rules only apply to modules found +by configure. A module is always a directory located under cpan/ or ext/; +check cnf/configure_mods.sh on how exactly configure decides which directories +to use, and the type of module (XS/non-XS). + +The modules to be built are listed in `$nonxs_ext`, +`$static_ext`, `$dynamic_ext`; additionally, +`$disabled_nonxs_ext` and `$disabled_dynamic_ext` variables list +modules that were found but won't be built by "make modules" or "make all". + +Consider a module located in cpan/Some-Module; its perl name is likely +Some::Module. Assuming it was correctly found by configure, the command to +make it is + +```sh +make cpan/Some-Module +``` + +which will in turn call + +```sh +make cpan/Some-Module/pm_to_blib +``` + +`pm_to_blib`, is a real file and it's used as a flag for the +whole module, which allows to avoid costly recursive make runs. +As long as pm_to_blib is up-to-date, make won't attempt to rebuild the module. +This system is not very stable, and it is possible get unfinished build with +all pm_to_blibs in place; right now there's no good way to deal with it except +for removing pm_to_blib files manually and re-running make. + +Here's what make does for a target like "cpan/Some-Module/pm_to_blib": + +- First, in case there is no cpan/Some-Module/Makefile.PL + (happens for some modules), a script called make_ext_Makefile.pl + is used to make a minimalistic Makefile.PL +- miniperl is used next to run Makefile.PL. + Makefile.PL produces regular `cpan/Some-Module/Makefile`. +- `make -C cpan/Some-Module` is spawned to build the module. + Standard MakeMaker rules ensure that, among other things, pm_to_blib + will be touch(1)ed at some point. + +Most of these operations require miniperl, so it will be built before +attempting to make any of the module targets. + +### Re-building modules + +Sometimes `pm_to_blib` file gets touched before the module is built +completely. Typically this means there were built errors, but it can also +happen when MakeMaker decides to Makefile needs to be re-built. +As long as `pm_to_blib` is up-to-date, make won't be invoked +for this module and the build won't be finished. + +There are two possible resolution. First, if the module name is known, +removing `pm_to_blib` manually will force rebuilt. Second, + +```sh +make modules-reset +``` + +will remove `pm_to_blib` from all non-disabled modules. +Even the latter is relatively cheap — it will not force a complete rebuild, +just "make -C cpan/Some-Module" invocations for all modules. + +### Cleaning up modules + +**Running `make clean` on a module** requires an **up-to-date +`Makefile`** for that module, which in turn **depends on usable +miniperl, MakeMaker and its subdependecies**. Running `make clean` +may prompt re-doing half the build. That's rather counter-intuitive, +but that's how MakeMaker works. + +Top-level Makefile will only invoke "make clean" for modules that have +pre-built Makefile. The idea is that if there's no Makefile, the module has +never been built and doesn't require any cleaning. +It's not always true. To ensure all modules are really cleaned up, + +```sh +make modules-makefiles modules-clean +``` + +can be used. Note that it will try to build Makefiles for all (non-disabled) +modules, potentially running per-module configure and other nasty things. + +## Module configuration + +Some modules have configure-like tests in their Makefile.PLs, which sometimes +can't handle cross-compilation very well. A notable case is Time::HiRes that +depends on `d_nanosleep` and `d_clock_*` from cnf/hints/linux. + +Other modules from the perl distribution seem to avoid this, but third-party +modules may be a problem. There is no good solution here. Fixing Makefile.PL +and/or hinting the values may help in some cases. + +Some modules analyze `$^O` value at build time, confusing host +and target platforms. At build time, `$^O` describes the host system, +and `$Config{osname}` should be used for the target. diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 0000000..acb7e75 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,84 @@ +# Testing perl + +--- + +Perl ships with an extensive test suite, covering the interpreter itself +and most of the modules. To run a full test, use + +```sh +(cd t && ./perl harness) +``` + +or just + +```sh +make test +``` + +This works just as well with perl-cross — assuming you do it on the target +from within a full perl build tree. Depending on the target, the latter part +may not be practical, and actually makes little sense when you think of it. + +perl-cross provides an alternative way for on-target testing: testpack, +tarball with the tests (and little else) that can be transferred to the +target. It's must smaller than the perl tree, ~23MB instead of 150+MB, +and unlike `make test` it's set up to test the perl that's already +installed in its proper location. + +To make the pack, run + +```sh +make testpack +``` + +then transfer TESTPACK.tar.gz to the target, unpack it there and do + +```sh +(cd TESTPACK/t/ && ./perl harness) +``` + +Run + +```sh +make clean-testpack +``` + +in the source tree to remove TESTPACK/ if necessary after TESTPACK.tar.gz has been built. + +At this point testpack does not include all the tests that `make test` does. +So if you need to make absolutely sure the perl passes every test, do transfer the whole +build tree and run `make test` instead. However, testpack should be more than enough +to catch bad cross-compiling issues. + +## Caveats + +Just like the rest of the language, perl testsuite is one big hack with a lot of +counter-intuitive and counter-productive issues no-one bothers to fix. Following +the tradition, I merely document some of them here. + +- Some of the tests scan perl source tree and/or check it against MANIFEST. + If you did some equivalent of "make DESTDIR=\`pwd\`/out install" within the + source tree, make sure to remove out/ before running tests. +- It may be tempting to run "perl harness" instead of + "./perl harness". It will work, however the actual tests will still be run + using ./perl, so if you do that make sure "perl" and "./perl" are the same. +- The tests (NOT the harness!) decide whether to run themselves by checking + $Config{extensions}. +- Most tests do reset @INC and populate it with values like "../lib" etc. + Testpack mitigates it somewhat, but it's still there. +- (harness only) $PERL5LIB value is ignored, however $PERL5LIB_TEST will be used. + See t/TEST for reference. +- Test for some cpan/ modules do different things depending on $PERL_CORE value. + Even in testpack, $PERL_CORE will be 1. Don't ask. Google for "dual-life perl module". +- To run a single test, use something like + `./perl harness ../cpan/Archive-Extract/t/01_Archive-Extract.t` + from the t/ directory. It is possible to run some of the tests without harness, + but others will fail with bogus error messages. + +## Tests excluded from testpack + +Check TESTPACK.px, namely %exclude hash at the top. + +Short summary: porting/, most of ExtUtils, CPAN meta-modules and some XS stuff is excluded, +the rest should work. Given the nature of the excluded tests, they will probably never work +well with cross-builds. Also, XS::APItest and anything that depends on it. diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..9772c48 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,391 @@ +# Cross-compiling perl + +--- + +Unpack perl-X.Y.Z-cross-W.Q.tar.gz over perl-X.Y.Z distribution. +Perl-cross package should overwrite top-level Makefile and some other files +in the perl source tree. + +The build process is similar to that of most autoconf-based packages. +For a native build, use something like + +```sh +./configure --prefix=/usr +make +make DESTDIR=/some/tmp/dir install +``` + +For a cross-build, specify your target: + +```sh +./configure --prefix=/usr --target=i586-pc-linux-uclibc +make +make DESTDIR=/some/tmp/dir install +``` + +Check below for [other possible make targets](#make targets). + +## Target-specific notes + +**Android**, assuming NDK is installed in `/opt/android-ndk`: + +```sh +ANDROID=/opt/android-ndk +TOOLCHAIN=arm-linux-androideabi-4.9/prebuilt/linux-x86_64 +PLATFORM=$ANDROID/platforms/android-16/arch-arm +export PATH=$PATH:$ANDROID/toolchains/$TOOLCHAIN/bin +./configure --target=arm-linux-androideabi --sysroot=$PLATFORM +``` + +Adjust platform and compiler version to match your particular NDK. + +**arm-linux-uclibc**: successful build is highly likely. +Check target tools prefix, it may be useful here, especially +if `--sysroot` is used. + +```sh +./configure --target=arm-linux-uclibc --target-tools-prefix=arm-linux- +``` + +**ix86-* with Intel cc**, native build: use `-Dcc=icc`. +Configure will not supply any optimization options to the compiler, +consider `-Doptimize` if necessary. + +**MinGW32**: cannot be built yet. Configure will produce config.sh, +but current perl-cross Makefiles can't handle win32 build. + +```sh +./configure --target=i486-mingw32 --no-dynaloader +``` + +## Complete configure options list + +Overall call order: + +```sh +configure [options] +``` + +Perl-cross configure adheres to common GNU autoconf style, but also accepts +most of the original Configure options. Both short and long options +are supported (`-D`, `--define`). + +Valid ways to supply arguments for the options: + ++ `-f config.sh` ++ `-fconfig.sh` ++ `-D key=val` ++ `-Dkey=val` ++ `--set-key=val` ++ `--set key=val` + +Whenever necessary, dashes in "key" are converted to underscores; use +`--set-d-something` instead of `--set-d_something`. + +The only essential thing configure does is writing `config.sh` +(and possibly `xconfig.sh`). Most options are meant to alter the values +written there. Refer to Porting/Glossary for description of variables found in +`config.sh`. This page only decribes _how_ to modify them, +not _which values_ to use. + +General configure control options: + +--help +: dump a short help message on stdout and exit + +--mode=(native|cross|target|buildmini) +: set configure mode; used internally + +--keeplog +: Append to config.log instead of truncating it; + used internally. + +--regenerate +: Re-generates config.h, xconfig.h and Makefile.config + from config.sh and xconfig.sh. + Does not change config.sh or xconfig.sh. + +General installation setup: + +--prefix=_/usr_ +: Installation prefix (on the target). + +--html{1,3}dir=_dir_ +: Installation prefix for HTML documentation (not used) + +--man{1,3}dir=_dir_ +: Installation prefix for manual pages + +--target=_machine_ +: Target description (e.g. i586-pc-linux-uclibc); + _machine_-gcc, _machine_-ld, _machine_-ar will be + used for target build unless explicitly overriden, and perl + `archname` will be set to _machine_. Hints will be + choosen based on this value. + +--target-tools-prefix=_prefix_ +: Use _prefix_-gcc, _prefix_-ld without overridin + `archname`. + +--build=_machine_ +: Same as --target but for host executables (miniperl) + +--hints=_h1,h2,..._ +: Suggest specified hint files (cnf/hints/h1 and so on). + The hints are processed after other options, + see [Workflow]() below. + +--with-libs=_lib1,lib2,..._ +: Comma-separated list of libraries to check + (basenames only, use "dl" to have -ldl passed to the linker). + +--with-cc=_cmd_ +: (target) C compiler. + +--with-cpp=_cmd_ +: (target) C preprocessor. + +--with-ranlib=_cmd_ +: (target) ranlib; set to 'true' or 'echo' to disable. + +--with-objdump=_cmd_ +: (target) objdump; not used during the build, + but crucial for some configure test. + +--host-cc=_cmd_ +: + +--host-cpp=_cmd_ +: + +--host-ranlib=_cmd_ +: + +--host-objdump=_cmd_ +: + +--host-libs=_cmd_ +: Same, for host executables. + Only useful when cross-compiling. + +--sysroot=_/path_ +: Passed directly to target compiler, linker and preprocessor. + See gcc(1) on how to use this option. + +Options from the original Configure which are not supported or make +no sense for this version of configure: + +-e +: go on without questioning past the production of config.sh + (ignored, you'll have to run make manually) + +-E +: stop at the end of questions, after having produced + Jconfig.sh (ignored, that's the only way perl-cross works) + +-r +: reuse C symbols value if possible, skips costly nm + extraction (ignored, configure uses completely different method + of checking function availability) + +-s +: silent mode (ignored, perl-cross has no other modes) + +-K +: (not supported) + +-S +: perform variable substitutions on all .SH files + (ignored, configure can't do that) + +-V +: show version number (not supported) + +-d +: use defaults for all answers (ignored, default mode) + +-h +: show help (ignored, use --help instead) + +The following options are used to manipulate the values configure will +write to config.sh. Check Porting/Glossary for the list of possible +symbols. + +-f _file.sh_ +: load configuration from a file. + See Workflow below. + +-D _symbol_[=_value_] +: set value for symbol; default _value_ is "define". + Common examples (see INSTALL for more info): + + + `-Duse64bitint` use 64bit integers + + `-Duse64bitall` use 64bit integers and pointers + + `-Dusethreads` use thread support (also `--enable-threads`) + + `-Dinc_version_list=none` do not include older perl trees in @INC + + `-DEBUGGING=none` DEBUGGING options + + `-Dcc=gcc` same as `--with-cc=gcc` + + `-Dprefix=/opt/perl5` same as `--prefix=/opt/perl5` + +-U _symbol_ +: set _symbol_ to "undef"; `-U symbol=` set empty + value. + +-O +: let -D and -U override definitions from loaded configuration + files; without -O, configuration files specified with + -f will overwrite anything that was set using configure options. + See Workflow below. + +-A [a:]_symbol_=_value_ +: append _value_ to _symbol_; some other forms are + supported for compatibility with Configure but their use is + discouraged. + +--set _symbol_=_value_ +: Set _symbol_ to _value_ (default ""). + +--enable-_something_ +: Same as `--set usesomething=define` + +--has-_function_ +: Same as `--set d_function=define` + +--define-_something_ +: Same as `--set something=define` + +--include-_header_[=yes|no] +: Set i_*header* to 'define' or 'undef'; + e.g. to disable `` + use `--include-sys-time-h=no`. + +When configuring for a cross-build, `-D/--set` and other +similar options affect target perl configuration (config.sh) only. +Use `--host-option[=value]` to pass +`--option[=value` over to miniperl configure. + +Configure tries to build all modules it can find in the source tree. +Use the following options to alter modules list: + +--static-mod=_mod1,mod2,..._ +: Build specified modules statically + +--disable-mod=_mod1,mod2,..._ +: Do not build specified modules. + +--only-mod=_mod1,mod2,..._ +: Build listed modules only + +--all-static +: Build all XS modules as static. + Does _not_ imply `--no-dynaloader`. + +--no-dynaloader +: Do not build DynaLoader. Implies `--all-static`. + Resulting perl won't be able to load any XS modules. + Same as `-Uusedl`. + +modX should be something like `cpan/Archive-Extract`; +static only applies to XS modules and will not affect non-XS modules. + +## make targets + +!!! warning "Warning" + run "make crosspatch" **BEFORE** making other + targets manually. + +Default make target is building perl and all configured modules. +Other targets: + +crosspatch +: Apply all patches from cnf/diffs. Files are only patched + once, cnf/diffs/path/file.applied locks are created to track + that. + +miniperl +: Build miniperl only. + +config.h +: + +xconfig.h +: + +Makefile.config +: Re-build resp. files from [x]config.sh, may be needed after + editing [x]config.sh manually. Note that make may try updating + Makefile.config as a dependency for something else, but it + won't re-read it immediately. + +dynaloader +: Build DynaLoader module. This is the first big target after + miniperl, and the first that requires target compiler. + If you can't get past dynaloder, something's really wrong. + May be used to check target compiler viability. + +perl +: Build the main perl executable. Implies dynaloader and any + static modules, but does not build dynamic or non-XS ones. + +nonxs_ext +: + +dynamic_ext +: + +static_ext +: Build all non-XS / dynamic XS / static XS modules listed + in Makefile.config. + Check [Modules](modules.md) page for details. + +modules +: + +extensions +: Build all modules at once. + +cpan/_Some-Module_ +: + +ext/_Some-Module_ +: Build _Some-Module_. + Only works for modules listed + in Makefile.config. + +modules-reset +: Remove all `pm_to_blib` locks. + See [Modules](modules.md) page for + more info. + +modules-makefiles +: Create/update Makefiles for all configured modules. + +modules-clean +: Run make clean for all modules. + May cause unexpected side effects, + see [Modules](modules.md) page. + +utilites +: Build everything in `utils/`. + +install +: Same as `make install.perl install.man`. + +install.perl +: Install perl and all the modules. + +install.man +: Install manual pages. + +test +: Run perl test suite from `t/` + +testpack +: Build testpack for on-target testing. + See [Testing](testing.md) page. + +clean +: Try to clean up the source tree. Does not always work + as expected. + +For most generated files, make _file_ should be enough to rebuild _file_. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a09590d --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,18 @@ +site_name: perl-cross +site_description: Cross-compiling perl +site_author: Alex Suykov +repo_url: https://github.com/arsv/perl-cross + +pages: +- Intro: index.md +- Download: download.md +- Usage: usage.md +- Design: design.md +- Modules: modules.md +- Hints: hints.md +- Testing: testing.md + +markdown_extensions: +- admonition +- def_list +theme: mkdocs