Rudimentary support for cross-compiling.

This commit is contained in:
Andy Polyakov 2006-10-21 13:38:16 +00:00
parent a4d64c7f49
commit cbfb39d1be
4 changed files with 33 additions and 13 deletions

View File

@ -38,6 +38,8 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
# --test-sanity Make a number of sanity checks on the data in this file. # --test-sanity Make a number of sanity checks on the data in this file.
# This is a debugging tool for OpenSSL developers. # This is a debugging tool for OpenSSL developers.
# #
# --cross-compile-prefix Add specified prefix to binutils components.
#
# no-hw-xxx do not compile support for specific crypto hardware. # no-hw-xxx do not compile support for specific crypto hardware.
# Generic OpenSSL-style methods relating to this support # Generic OpenSSL-style methods relating to this support
# are always compiled but return NULL if the hardware # are always compiled but return NULL if the hardware
@ -571,6 +573,7 @@ my $prefix="";
my $openssldir=""; my $openssldir="";
my $exe_ext=""; my $exe_ext="";
my $install_prefix=""; my $install_prefix="";
my $cross_compile_prefix="";
my $no_threads=0; my $no_threads=0;
my $threads=0; my $threads=0;
my $no_shared=0; # but "no-shared" is default my $no_shared=0; # but "no-shared" is default
@ -764,6 +767,10 @@ PROCESS_ARGS:
{ {
$withargs{"zlib-include"}="-I$1"; $withargs{"zlib-include"}="-I$1";
} }
elsif (/^--cross-compile-prefix=(.*)$/)
{
$cross_compile_prefix=$1;
}
else else
{ {
print STDERR $usage; print STDERR $usage;
@ -1310,7 +1317,17 @@ while (<IN>)
s/^PLATFORM=.*$/PLATFORM=$target/; s/^PLATFORM=.*$/PLATFORM=$target/;
s/^OPTIONS=.*$/OPTIONS=$options/; s/^OPTIONS=.*$/OPTIONS=$options/;
s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/; s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
s/^CC=.*$/CC= $cc/; if ($cross_compile_prefix)
{
s/^CC=.*$/CROSS_COMPILE_PREFIX= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE_PREFIX\)$cc/;
s/^AR=\s*/AR= \$\(CROSS_COMPILE_PREFIX\)/;
s/^NM=\s*/NM= \$\(CROSS_COMPILE_PREFIX\)/;
s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE_PREFIX\)/;
}
else {
s/^CC=.*$/CC= $cc/;
s/^RANLIB=.*/RANLIB= $ranlib/;
}
s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc"; s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
s/^CFLAG=.*$/CFLAG= $cflags/; s/^CFLAG=.*$/CFLAG= $cflags/;
s/^DEPFLAG=.*$/DEPFLAG= $depflags/; s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
@ -1329,7 +1346,6 @@ while (<IN>)
s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/; s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/; s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
s/^PROCESSOR=.*/PROCESSOR= $processor/; s/^PROCESSOR=.*/PROCESSOR= $processor/;
s/^RANLIB=.*/RANLIB= $ranlib/;
s/^ARFLAGS=.*/ARFLAGS= $arflags/; s/^ARFLAGS=.*/ARFLAGS= $arflags/;
s/^PERL=.*/PERL= $perl/; s/^PERL=.*/PERL= $perl/;
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/; s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;

View File

@ -66,6 +66,7 @@ EXE_EXT=
ARFLAGS= ARFLAGS=
AR=ar $(ARFLAGS) r AR=ar $(ARFLAGS) r
RANLIB= ranlib RANLIB= ranlib
NM= nm
PERL= perl PERL= perl
TAR= tar TAR= tar
TARFLAGS= --no-recursion TARFLAGS= --no-recursion
@ -174,7 +175,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
CC='${CC}' CFLAG='${CFLAG}' \ CC='${CC}' CFLAG='${CFLAG}' \
AS='${CC}' ASFLAG='${CFLAG} -c' \ AS='${CC}' ASFLAG='${CFLAG} -c' \
AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}' \ AR='${AR}' NM='${NM}' RANLIB='${RANLIB}' \
PERL='${PERL}' \
SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib' \ SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib' \
INSTALL_PREFIX='${INSTALL_PREFIX}' \ INSTALL_PREFIX='${INSTALL_PREFIX}' \
INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' \ INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' \
@ -383,12 +385,14 @@ dclean:
@set -e; target=dclean; $(RECURSIVE_BUILD_CMD) @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
rehash: rehash.time rehash: rehash.time
rehash.time: certs rehash.time: certs apps
@(OPENSSL="`pwd`/util/opensslwrap.sh"; \ @if [ -z "$(CROSS_COMPILE_PREFIX)" ]; then \
OPENSSL_DEBUG_MEMORY=on; \ (OPENSSL="`pwd`/util/opensslwrap.sh"; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \ OPENSSL_DEBUG_MEMORY=on; \
$(PERL) tools/c_rehash certs) export OPENSSL OPENSSL_DEBUG_MEMORY; \
touch rehash.time $(PERL) tools/c_rehash certs) && \
touch rehash.time; \
else :; fi
test: tests test: tests

View File

@ -14,6 +14,8 @@ CFLAGS=$(CFLAG)
LDFLAGS= LDFLAGS=
SHARED_LDFLAGS= SHARED_LDFLAGS=
NM=nm
# LIBNAME contains just the name of the library, without prefix ("lib" # LIBNAME contains just the name of the library, without prefix ("lib"
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so, # on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
# .dll, ...). This one MUST have a value when using this makefile to # .dll, ...). This one MUST have a value when using this makefile to
@ -101,7 +103,7 @@ LINK_SO= \
LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \ LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \ SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \ SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \ $(NM) -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \ LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \

View File

@ -163,9 +163,7 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \ APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \ LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target} link_app.$${shlib_target}
-(cd ..; \ @(cd ..; $(MAKE) rehash)
OPENSSL="`pwd`/util/opensslwrap.sh"; export OPENSSL; \
$(PERL) tools/c_rehash certs)
progs.h: progs.pl progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h $(PERL) progs.pl $(E_EXE) >progs.h