Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/compat update this to reflect all the changes in src/compat ...



details:   https://anonhg.NetBSD.org/src/rev/78da8ba21224
branches:  trunk
changeset: 749943:78da8ba21224
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Dec 13 09:27:57 2009 +0000

description:
update this to reflect all the changes in src/compat version 2.0

diffstat:

 compat/README |  99 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 64 insertions(+), 35 deletions(-)

diffs (111 lines):

diff -r 5b7b1699a970 -r 78da8ba21224 compat/README
--- a/compat/README     Sun Dec 13 09:27:34 2009 +0000
+++ b/compat/README     Sun Dec 13 09:27:57 2009 +0000
@@ -1,43 +1,72 @@
-$NetBSD: README,v 1.3 2009/01/13 17:52:32 jmmv Exp $
+$NetBSD: README,v 1.4 2009/12/13 09:27:57 mrg Exp $
+
+
+Building multi- ABI libraries for NetBSD platforms.
+
 
-This directory contains Makefile fragments that will build all of the
-NetBSD libraries in 32-bit mode and install them into /usr/lib/<arch>
-and also install a /usr/libexec/ld.elf_so-<arch>.
-
-This is current only supported for the amd64 and sparc64 platforms,
-where <arch> is "i386" or "sparc" respectively.  (It could be used to
-build MIPS o32 libraries on n32 system, but not both n32 and o32 on
-a n64 system.  It only supports one extra target.)
+src/compat has a framework to (re)build the libraries shipped with
+NetBSD for a different ABI than the default for that platform.  This
+allow 32-bit libraries for the amd64 and sparc64 ports, and enables
+the mips64 port to support all three of old-style 32-bit ("o32"), the
+new 32-bit (default, "n32", 64-bit CPU required) or the 64-bit ABI.
 
 
-Most of the makefiles here were built with the "build-makefiles" script.
-The exceptions are lib/csu/Makefile and ld.elf_so/Makefile.
+The basic premise is to re-set $MAKEOBJDIRPREFIX to fresh subdirectory
+underneath src/compat and rebuild the libraries with a different set
+of options.  Each platform wanting support should create their port
+subdirectory directly in src/compat, and then one subdirectory in here
+for each ABI required.  e.g., src/compat/amd64/i386 is where we build
+the 32-bit compat libraries for the amd64port.  In each of these
+subdirs, a small Makefile and makefile fragment should exist.  The
+Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then
+include "../../Makefile.common".  Eg, amd64/i386/Makefile has:
+
+       BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk
+
+       .include "../../Makefile.common"
+
+In the makefile fragment any changes to ABI flags are passed here
+and the MLIBDIR variable must be set to the subdirectory in /usr/lib
+where libraries for the ABI will be installed.  There are a couple of
+helper Makefile's around.  amd64/i386/bsd.i386.mk looks like:
+
+       LD+=                    -m elf_i386
+       MLIBDIR=                i386
+       LIBC_MACHINE_ARCH=      ${MLIBDIR}
+       COMMON_MACHINE_ARCH=    ${MLIBDIR}
+       KVM_MACHINE_ARCH=       ${MLIBDIR}
+       PTHREAD_MACHINE_ARCH=   ${MLIBDIR}
+       BFD_MACHINE_ARCH=       ${MLIBDIR}
+       CSU_MACHINE_ARCH=       ${MLIBDIR}
+       CRYPTO_MACHINE_CPU=     ${MLIBDIR}
+       LDELFSO_MACHINE_CPU=    ${MLIBDIR}
+
+       .include "${NETBSDSRCDIR}/compat/Makefile.m32"
+
+and the referenced Makefile.m32 looks like:
+
+       COPTS+=                 -m32
+       CPUFLAGS+=              -m32
+       LDADD+=                 -m32
+       LDFLAGS+=               -m32
+       MKDEPFLAGS+=            -m32
+
+       .include "Makefile.compat"
 
 
-The method used is the:
-       - evaluate some local variables
-       - switch .CURDIR
-       - include original Makefile,
-       - evaluate some variables
-       - switch .CURDIR back
-that is used by crunchgen to build eg, installer media or /rescue.
+Makefile.common holds the list of subdirectories (the libraries and
+ld.elf_so) to build with this ABI.
+
+Makefile.md_subdir holds the list of subdirectories for each port.
+
+Makefile.compat has the basic framework to force the right paths for
+library and ld.elf_so linkage.  It contains a hack to create subdirs
+in the build that should be fixed.
+
+dirshack/Makefile is a hack to get objdirs created timely, and should
+be fixed in a better way.
 
 
 
-TODO:
-       - some yacc issue -- libc, libipsec and libpcap need "make" run
-         to generate headers properly, otherwise it complains about
-         no way to get to foo.h.  this is currently hacked by putting
-         a rule "foo.h: foo.c" in the (generated) makefiles
-       - there's an ugly hack to make libpam build correctly again the
-         right libc.  ld.elf_so has a similar (but less ugly hack)
-       - not sure that /usr/lib/{i386,sparc}{,/i18n} are created 
-         properly yet
-
-Future work
-
-Ideally this should be able to handle any number of compat targets.
-Perhaps using a "force MAKEOBJDIR, and run-run make" solution will
-work, but my initial attempts got me no where.  If not, perhaps
-build-makefiles could be expanded to be used at run-time in such
-a per-compat target obj-dir.
+mrg%eterna.com.au@localhost
+december 2009



Home | Main Index | Thread Index | Old Index