Fix cross-building, etc:
1. To cross-build, one now needs to set TARGET_ARCH, and not the MACHINE_ARCH. MACHINE_ARCH should never be changed manually! 2. Initialize DESTDIR= explicitly for bootstrap-tools, build-tools, and cross-tools stages. This fixes broken header and library dependencies problem. We build them in the host environment, and obviously want them to depend on host headers and libraries. The problem with broken header dependencies for bootstrap-tools and cross-tools was already partially solved (see BOOTSTRAPPING tests in bsd.prog.mk and bsd.lib.mk), but it was still there for build-tools if the user ran "make world DESTDIR=/foo". Also, for all of these stages, the library dependencies were broken because of how bsd.libnames.mk define DPADD members. We still provide a glue to install bootstrap- and cross-tools under the ${WORLDTMP}. Removed PATH overrides for bootstrap-, build-, and cross-tools stages. There is just no reason why we would need to override it, and the hacks to clean up the ${WORLDTMP} in the -DNOCLEAN case are no longer needed with fixes from this step. That is, we now never use ${WORLDTMP} headers and libraries, and we don't use any ${WORLDTMP} installed binaries during these stages. Again, these stages depend solely on the host environment, including compiler, headers, and libraries. 3. Moved "miniperl" back from cross-tools (it has nothing to do with a cross-compiler) to build-tools where it belongs. The change from step 1 let to do this. Also, to make this work, build-tools targets of "cc_tools" and "miniperl" were modified to call "depend". Here follow the detailed explanations. There are two categories of build tools, for now. In the first category there are "cc_tools" and "miniperl". They occupy the whole (sub)directory, and nothing needs to be done in this subdirectory later during the "all" stage. They are also constructed using system makefiles. We must build the .depend early in the build-tools stage because: 1) They use (and depend on) the host environment. 2) If we don't do this in build-tools, the "depend" stage of buildworld will do this for us; wrong library and header dependencies will be recorded (DESTDIR=${WORLDTMP}) and, what's worse, the "all" stage may then clobber the build-architecture format tools (that we built in the build-tools stage) with the target-architecture format ones, breaking cross build. In the second category there are all other build-tools. They share their directory with the "main" module that needs them in the "all" stage, and they don't show up themselves in the .depend file. The portion of this fix was already committed in gnu/usr.bin/cc/cc_tools/Makefile,v 1.52. 4. "libperl" is no longer a build tool, and "miniperl" is the stand-alone application. I had to make this change because build-tools and "all" stages share the same object directory. Without this change, if we cross compile, libperl.a is first built for the build architecture during the build-tools stage (for the purposes of immediate linkage with "miniperl"). Later on, the "all" stage sees this library as up-to-date, and doesn't rebuild it. The effect is that the wrong format static libperl library is installed with installworld. 5. Fixed "includes" to install secure/lib/libtelnet headers if required. Reviewed by: bde
This commit is contained in:
parent
8c65132c76
commit
4448c79e47
@ -20,7 +20,7 @@
|
||||
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
|
||||
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
|
||||
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
|
||||
# MACHINE_ARCH="machine arch" to crossbuild world to a different arch
|
||||
# TARGET_ARCH="arch" to crossbuild world to a different arch
|
||||
|
||||
#
|
||||
# The intended user-driven targets are:
|
||||
@ -121,13 +121,18 @@ SUPFLAGS+= -h ${SUPHOST}
|
||||
|
||||
MAKEOBJDIRPREFIX?= /usr/obj
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
.if make(buildworld)
|
||||
BUILD_ARCH!= sysctl -n hw.machine_arch
|
||||
.if ${BUILD_ARCH} == ${MACHINE_ARCH}
|
||||
.if ${MACHINE_ARCH} != ${BUILD_ARCH}
|
||||
.error To cross-build, set TARGET_ARCH.
|
||||
.endif
|
||||
.endif
|
||||
.if ${MACHINE_ARCH} == ${TARGET_ARCH}
|
||||
OBJTREE= ${MAKEOBJDIRPREFIX}
|
||||
.else
|
||||
OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
|
||||
OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET_ARCH}
|
||||
.endif
|
||||
WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH}
|
||||
WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
|
||||
# /usr/games added for fortune which depend on strfile
|
||||
STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
|
||||
TMPPATH= ${STRICTTMPPATH}:${PATH}
|
||||
@ -158,42 +163,34 @@ INSTALLTMP= ${TMPDIR}/install.${TMPPID}
|
||||
# This stage installs a previously built world.
|
||||
#
|
||||
|
||||
# Common environment for bootstrap related stages
|
||||
BOOTSTRAPENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
DESTDIR=${WORLDTMP} \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
||||
MACHINE_ARCH=${BUILD_ARCH} \
|
||||
TOOLS_PREFIX=${WORLDTMP} \
|
||||
PATH=${TMPPATH}
|
||||
|
||||
# Common environment for world related stages
|
||||
CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
MACHINE_ARCH=${TARGET_ARCH} \
|
||||
COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
|
||||
LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
|
||||
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
|
||||
CFLAGS="-nostdinc ${CFLAGS}" \
|
||||
CXXINCLUDES="-nostdinc++ ${CXXINCLUDES}" \
|
||||
PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.0 \
|
||||
GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
|
||||
GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
|
||||
GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
|
||||
|
||||
# bootstrap-tool stage
|
||||
BMAKEENV= ${BOOTSTRAPENV}
|
||||
BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
DESTDIR= \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh"
|
||||
BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
|
||||
-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
|
||||
|
||||
# build-tool stage
|
||||
TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
||||
PATH=${TMPPATH}
|
||||
DESTDIR= \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh"
|
||||
TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1
|
||||
|
||||
# cross-tool stage
|
||||
XMAKEENV= ${BOOTSTRAPENV} \
|
||||
TARGET_ARCH=${MACHINE_ARCH}
|
||||
XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
|
||||
-DNO_FORTRAN -DNO_GDB -DNOHTML -DNOINFO -DNOMAN \
|
||||
-DNOPIC -DNOPROFILE -DNOSHARED
|
||||
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
|
||||
|
||||
# world stage
|
||||
WMAKEENV= ${CROSSENV} \
|
||||
@ -246,13 +243,6 @@ buildworld:
|
||||
@echo "--------------------------------------------------------------"
|
||||
.if !defined(NOCLEAN)
|
||||
rm -rf ${WORLDTMP}
|
||||
.else
|
||||
for dir in bin games include lib sbin share; do \
|
||||
rm -rf ${WORLDTMP}/usr/$$dir; \
|
||||
done
|
||||
# XXX - Work-around for broken cc/cc_tools/Makefile.
|
||||
# This is beyond dirty...
|
||||
rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend
|
||||
.endif
|
||||
.for _dir in ${USRDIRS}
|
||||
mkdir -p ${WORLDTMP}/${_dir}
|
||||
@ -271,13 +261,13 @@ buildworld:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> stage 2: cleaning up the object tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
|
||||
cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> stage 2: rebuilding the object tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; ${TMAKE} par-obj
|
||||
cd ${.CURDIR}; ${WMAKE} par-obj
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> stage 2: build tools"
|
||||
@ -324,7 +314,7 @@ installworld:
|
||||
mkdir -p ${INSTALLTMP}
|
||||
for prog in [ awk cat chflags chmod chown date echo egrep find grep \
|
||||
ln make makewhatis mkdir mtree mv perl rm sed sh sysctl \
|
||||
test true uname wc which zic; do \
|
||||
test true uname wc zic; do \
|
||||
cp `which $$prog` ${INSTALLTMP}; \
|
||||
done
|
||||
cd ${.CURDIR}; ${IMAKE} reinstall
|
||||
@ -373,8 +363,8 @@ distribworld:
|
||||
# for building kernels and only the first of these is designated
|
||||
# as the one being installed.
|
||||
#
|
||||
# Note that we have to use MACHINE instead of MACHINE_ARCH when
|
||||
# we're in kernel-land. Since only MACHINE_ARCH is (expected) to
|
||||
# Note that we have to use MACHINE instead of TARGET_ARCH when
|
||||
# we're in kernel-land. Since only TARGET_ARCH is (expected) to
|
||||
# be set to cross-build, we have to make sure MACHINE is set
|
||||
# properly.
|
||||
|
||||
@ -386,11 +376,11 @@ KERNCONF?= GENERIC
|
||||
.endif
|
||||
INSTKERNNAME?= kernel
|
||||
|
||||
# The only exotic MACHINE_ARCH/MACHINE combination valid at this
|
||||
# The only exotic TARGET_ARCH/MACHINE combination valid at this
|
||||
# time is i386/pc98. In all other cases set MACHINE equal to
|
||||
# MACHINE_ARCH.
|
||||
.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
|
||||
MACHINE= ${MACHINE_ARCH}
|
||||
# TARGET_ARCH.
|
||||
.if ${TARGET_ARCH} != "i386" || ${MACHINE} != "pc98"
|
||||
MACHINE= ${TARGET_ARCH}
|
||||
.endif
|
||||
|
||||
KRNLSRCDIR= ${.CURDIR}/sys
|
||||
@ -572,7 +562,7 @@ bootstrap-tools:
|
||||
${MAKE} obj; \
|
||||
${MAKE} depend; \
|
||||
${MAKE} all; \
|
||||
${MAKE} install
|
||||
${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
|
||||
.endfor
|
||||
|
||||
#
|
||||
@ -590,6 +580,10 @@ _share= share/syscons/scrnmaps
|
||||
_fortran= gnu/usr.bin/cc/f771
|
||||
.endif
|
||||
|
||||
.if !defined(NOPERL)
|
||||
_perl= gnu/usr.bin/perl/miniperl
|
||||
.endif
|
||||
|
||||
.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
|
||||
!defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
_libroken4= kerberosIV/lib/libroken
|
||||
@ -602,7 +596,7 @@ _libkrb5= kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
|
||||
|
||||
build-tools:
|
||||
.for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
|
||||
${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.bin/file \
|
||||
${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.bin/file \
|
||||
usr.sbin/sysinstall
|
||||
cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
|
||||
.endfor
|
||||
@ -610,17 +604,6 @@ build-tools:
|
||||
#
|
||||
# cross-tools: Build cross-building tools
|
||||
#
|
||||
# WARNING: Because the bootstrap tools are expected to run on the
|
||||
# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
|
||||
# target is being made. TARGET_ARCH is *always* set to reflect the
|
||||
# target-machine (which you can set by specifying MACHINE_ARCH on
|
||||
# make's command-line, get it?).
|
||||
# The reason is simple: we build these tools not to be run on the
|
||||
# architecture we're cross-building, but on the architecture we're
|
||||
# currently building on (ie the host-machine) and we expect these
|
||||
# tools to produce output for the architecture we're trying to
|
||||
# cross-build.
|
||||
#
|
||||
.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
|
||||
_elf2exe= usr.sbin/elf2exe
|
||||
.endif
|
||||
@ -629,18 +612,14 @@ _elf2exe= usr.sbin/elf2exe
|
||||
_btxld= usr.sbin/btxld
|
||||
.endif
|
||||
|
||||
.if !defined(NOPERL)
|
||||
_perl= gnu/usr.bin/perl/libperl gnu/usr.bin/perl/miniperl
|
||||
.endif
|
||||
|
||||
cross-tools:
|
||||
.for _tool in ${_btxld} ${_elf2exe} ${_perl} \
|
||||
.for _tool in ${_btxld} ${_elf2exe} \
|
||||
gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} obj; \
|
||||
${MAKE} depend; \
|
||||
${MAKE} all; \
|
||||
${MAKE} install
|
||||
${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
|
||||
.endfor
|
||||
|
||||
#
|
||||
@ -677,6 +656,8 @@ includes:
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
|
||||
.elif exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
|
||||
cd ${.CURDIR}/secure/lib/libtelnet; ${MAKE} beforeinstall
|
||||
.else
|
||||
cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
|
||||
.endif
|
||||
|
@ -1,23 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.ifmake !install && !distribute
|
||||
_MINI= miniperl
|
||||
.endif
|
||||
|
||||
SUBDIR= libperl ${_MINI} perl suidperl library pod utils x2p BSDPAN
|
||||
SUBDIR= libperl miniperl perl suidperl library pod utils x2p BSDPAN
|
||||
|
||||
MAINTAINER=markm@freebsd.org
|
||||
|
||||
.BEGIN:
|
||||
.ifmake depend || all
|
||||
if [ \! -f ${.OBJDIR}/build-tools ] ; then \
|
||||
cd ${.CURDIR}/libperl && ${MAKE} depend && ${MAKE} all ; \
|
||||
cd ${.CURDIR}/miniperl && ${MAKE} depend && ${MAKE} all ; \
|
||||
touch ${.OBJDIR}/build-tools ; \
|
||||
fi
|
||||
.endif
|
||||
.ifmake cleandir || clean
|
||||
@rm -f ${.OBJDIR}/build-tools
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,7 +2,12 @@
|
||||
|
||||
PERL5SRC?= ${.CURDIR}/../../../../contrib/perl5
|
||||
PERL5LIBSRC?= ${.CURDIR}/../libperl
|
||||
MINIPERL!= echo `PATH=$$PATH:${.OBJDIR}/../miniperl:${.OBJDIR}/../../miniperl which miniperl`
|
||||
|
||||
.if exists(${.OBJDIR}/../miniperl/miniperl)
|
||||
MINIPERL?= ${.OBJDIR}/../miniperl/miniperl
|
||||
.else
|
||||
MINIPERL?= ${.OBJDIR}/../../miniperl/miniperl
|
||||
.endif
|
||||
|
||||
BINDIR?= /usr/bin
|
||||
|
||||
|
@ -19,9 +19,6 @@ NO_PERL_SCRIPT_MAKE= true
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
build-tools: cleandepend
|
||||
cd ${.CURDIR} && ${MAKE} lib${LIB}.a
|
||||
|
||||
config.h: links
|
||||
@sh config_h.sh
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
PERL5SRC?= ${.CURDIR}/../../../../../contrib/perl5
|
||||
PERL5LIBSRC?= ${.CURDIR}/../../libperl
|
||||
MINIPERL= miniperl
|
||||
|
||||
MODULEDIR?= ${MODULE}
|
||||
|
||||
|
@ -2,20 +2,20 @@
|
||||
|
||||
PROG= miniperl
|
||||
NOMAN= true
|
||||
CFLAGS+=-I${PERL5SRC} -I${.OBJDIR} -DPERL_EXTERNAL_GLOB
|
||||
SRCS= miniperlmain.c opmini.c config.h
|
||||
SRCS= miniperlmain.c
|
||||
SRCS+= perl.c gv.c toke.c perly.c op.c regcomp.c dump.c util.c mg.c \
|
||||
hv.c av.c run.c pp_hot.c sv.c pp.c scope.c pp_ctl.c pp_sys.c \
|
||||
doop.c doio.c regexec.c utf8.c taint.c universal.c \
|
||||
xsutils.c globals.c perlio.c config.h
|
||||
CFLAGS+=-I${.OBJDIR} -I${PERL5SRC} -DPERL_EXTERNAL_GLOB -DPERL_CORE
|
||||
DPADD= ${LIBM} ${LIBCRYPT}
|
||||
LDADD= -lm -lcrypt
|
||||
# Miniperl _must_ be static!!
|
||||
NOSHARED= yes
|
||||
.if exists(${.OBJDIR}/../libperl/)
|
||||
MYLIBPERL= ${.OBJDIR}/../libperl/libperl.a
|
||||
.else
|
||||
MYLIBPERL= ${.CURDIR}/../libperl/libperl.a
|
||||
.endif
|
||||
DPADD= ${MYLIBPERL} ${LIBM} ${LIBCRYPT}
|
||||
LDADD= ${MYLIBPERL} -lm -lcrypt
|
||||
|
||||
build-tools: cleandepend
|
||||
cd ${.CURDIR} && ${MAKE} ${PROG}
|
||||
build-tools: depend ${PROG}
|
||||
|
||||
install:
|
||||
|
||||
NO_PERL_SCRIPT_MAKE= true
|
||||
|
||||
@ -23,10 +23,9 @@ NO_PERL_SCRIPT_MAKE= true
|
||||
|
||||
.PATH: ${PERL5SRC}
|
||||
|
||||
opmini.c: op.c
|
||||
ln -sf ${.OODATE} ${.TARGET}
|
||||
|
||||
config.h: links
|
||||
config.h: links
|
||||
@sh config_h.sh
|
||||
|
||||
CLEANFILES+= opmini.c config.h
|
||||
.SUFFIXES:
|
||||
|
||||
.SUFFIXES: .o .po .So .s .S .c
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
PERL5SRC?= ${.CURDIR}/../../../../../contrib/perl5
|
||||
MINIPERLOPT?= -I${.OBJDIR}/../../perl/lib -I${.OBJDIR}/../../perl
|
||||
MINIPERL= miniperl
|
||||
|
||||
CLEANFILES+= ${PROG}.1 ${PROG}.PL
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
PERL5SRC= ${.CURDIR}/../../../../../contrib/perl5
|
||||
PERL5LIBSRC= ${.CURDIR}/../../libperl
|
||||
MINIPERLOPT?= -I${.OBJDIR}/../../perl/lib -I${.OBJDIR}/../../perl
|
||||
MINIPERL= miniperl
|
||||
|
||||
LDFLAGS+= -L${.OBJDIR}/../../libperl
|
||||
|
||||
|
@ -15,14 +15,18 @@ CFLAGS+= -DHAS_CGETENT -DENCRYPTION -DDES_ENCRYPTION -DAUTHENTICATION \
|
||||
INCS= ${TELNETDIR}/arpa/telnet.h
|
||||
INCDIR= /usr/include/arpa
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
.PATH: ${TELNETDIR}/libtelnet
|
||||
|
||||
#
|
||||
# Remove obsolete shared libraries, if any. We don't bother moving them
|
||||
# to /usr/lib/compat, since they were only used by telnet, telnetd and
|
||||
# tn3270.
|
||||
#
|
||||
beforeinstall:
|
||||
beforeinstall: __remove-stale-libs
|
||||
__remove-stale-libs: .PHONY
|
||||
.if exists(${DESTDIR}${SHLIBDIR}/lib${LIB}.so.2.0)
|
||||
-chflags noschg ${DESTDIR}${SHLIBDIR}/lib${LIB}.so.2.0
|
||||
rm -f ${DESTDIR}${SHLIBDIR}/lib${LIB}.so.2.0
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
.PATH: ${TELNETDIR}/libtelnet
|
||||
.endif
|
||||
|
@ -196,7 +196,7 @@ lib${LIB}_p.a:: ${POBJS}
|
||||
${RANLIB} lib${LIB}_p.a
|
||||
.endif
|
||||
|
||||
.if defined(DESTDIR)
|
||||
.if defined(DESTDIR) && !defined(BOOTSTRAPPING)
|
||||
LDDESTDIRENV?= LIBRARY_PATH=${DESTDIR}${SHLIBDIR}:${DESTDIR}${LIBDIR}
|
||||
.endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user