skalibs

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

commit 16933ce845ac878f0b7a67eac8867452b0ab42c4
parent 410298c206450f855b9f4708fefe00e5af51716d
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sat, 19 Mar 2016 18:11:28 +0000

 More standard support for cross-compilation (--host only, no --enable-cross)

Diffstat:
MINSTALL | 37++++++++++++++++++++++++-------------
Mconfigure | 22+++++++++++++++-------
2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -39,20 +39,30 @@ before the "make install" phase. It will shave a few bytes off them. Controlling a build process via environment variables is a big and dangerous hammer. You should try and pass flags to configure instead; -nevertheless, the standard environment variables are recognized. +nevertheless, a few standard environment variables are recognized. - The value of the CROSS_COMPILE environment variable will prefix the -building tools' names. The --enable-cross option is preferred, see -"Cross-compilation" below. - If the CC environment variable is set, its value will override compiler -detection by configure. +detection by configure. The --host=HOST option will still add a HOST- +prefix to the value of CC. The values of CFLAGS, CPPFLAGS and LDFLAGS will be appended to flags auto-detected by configure. To entirely override the flags set by -configure instead, use make -e. +configure instead, use make variables. + + +* Make variables + -------------- + + You can invoke make with a few variables for more configuration. - The Makefile supports the DESTDIR convention for staging. + CC, CFLAGS, CPPFLAGS, LDFLAGS, LDLIBS, AR, RANLIB, STRIP, INSTALL and +CROSS_COMPILE can all be overridden on the make command line. This is +an even bigger hammer than running ./configure with environment +variables, so it is advised to only do this when it is the only way of +obtaining the behaviour you want. + + DESTDIR can be given on the "make install" command line in order to +install to a staging directory. * Shared libraries @@ -90,9 +100,8 @@ configure with a precomputed sysdeps directory, containing valid sysdeps values for your target. Use the --with-sysdeps=DIR option to specify DIR as a sysdeps -directory for your target. Also use the --enable-cross=PREFIX option -to specify a cross-compiling PREFIX for your toolchain's binaries, -or simply --enable-cross if your default toolchain is a cross-compiler. +directory for your target. Also use the --host=HOST option, HOST being +the triplet for your target. If you know the peculiarities of your target system, you can build a sysdeps directory by hand. However, a much easier, and recommended, @@ -104,11 +113,13 @@ purposes are available at Aboriginal Linux: http://landley.net/aboriginal/ skarnet.org or on third-party sites. Once you have gathered your sysdeps, for any skarnet.org package: + * make sure the binaries of your cross-toolchain (HOST-gcc, HOST-ld, +HOST-ar, etc.) are accessible via your PATH environment variable * give the correct --with-sysdeps option to ./configure - * give the correct --enable-cross option + * give the correct --host option * for --prefix, --bindir and other paths, always use the run-time path * to install the cross-compiled package in a staging directory /your/stage, - perform "make install DESTDIR=/your/stage/" + perform "make install DESTDIR=/your/staging/directory" * The slashpackage convention diff --git a/configure b/configure @@ -35,7 +35,6 @@ Optional features: --disable-shared do not build shared libraries [enabled] --disable-static do not build static libraries [enabled] --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled] - --enable-cross=PREFIX prefix toolchain executable names with PREFIX [none] $package options: --enable-libc-replacements use independent low-level primitives [disabled] @@ -202,7 +201,7 @@ addlibspath='' addlibdpath='' vpaths='' vpathd='' -cross="$CROSS_COMPILE" +build= for arg ; do @@ -225,9 +224,6 @@ for arg ; do --enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;; --enable-slashpackage) sproot= ; slashpackage=true ;; --disable-slashpackage) sproot= ; slashpackage=false ;; - --enable-cross=*) cross=${arg#*=} ;; - --enable-cross) ;; - --disable-cross) cross= ;; --enable-libc-replacements|--enable-libc-replacements=yes) replacements=true ;; --disable-libc-replacements|--enable-libc-replacements=no) replacements=false ;; --enable-egd=*) egd=${arg#*=} ;; @@ -246,8 +242,9 @@ for arg ; do --disable-force-devr|--enable-force-devr=no) forcedevr=false ;; --with-default-path=*) defaultpath=${arg#*=} ; dpathorig=false ;; --without-default-path) defaultpath=$ddefaultpath ; dpathorig=true ;; - --enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;; + --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --host=*|--target=*) target=${arg#*=} ;; + --build=*) build=${arg#*=} ;; -* ) echo "$0: unknown option $arg" ;; *=*) ;; *) target=$arg ;; @@ -308,6 +305,11 @@ if $slashpackage ; then fi # Find a C compiler to use +if test -n "$target" && test x${build} != x${target} ; then + cross=${target}- +else + cross= +fi echo "Checking for C compiler..." trycc ${cross}${CC} trycc ${cross}gcc @@ -326,7 +328,13 @@ else fi echo "Checking target system type..." -test -n "$target" || target=$($CC_AUTO -dumpmachine 2>/dev/null) || target=unknown +if test -z "$target" ; then + if test -n "$build" ; then + target=$build ; + else + target=$($CC_AUTO -dumpmachine 2>/dev/null) || target=unknown + fi +fi echo " ... $target" tryflag CPPFLAGS_AUTO -std=c99