Module Name: src Committed By: mrg Date: Sun Dec 13 09:27:57 UTC 2009
Modified Files: src/compat: README Log Message: update this to reflect all the changes in src/compat version 2.0 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/compat/README diff -u src/compat/README:1.3 src/compat/README:1.4 --- src/compat/README:1.3 Tue Jan 13 17:52:32 2009 +++ src/compat/README Sun Dec 13 09:27:57 2009 @@ -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 $ -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.) +Building multi- ABI libraries for NetBSD platforms. -Most of the makefiles here were built with the "build-makefiles" script. -The exceptions are lib/csu/Makefile and ld.elf_so/Makefile. +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. -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. +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" -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 +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: -Future work + 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} -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. + .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" + + +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. + + + +...@eterna.com.au +december 2009