Sun Dec 13 09:27:57 2009 UTC ()
update this to reflect all the changes in src/compat version 2.0


(mrg)
diff -r1.3 -r1.4 src/compat/README

cvs diff -r1.3 -r1.4 src/compat/README (expand / switch to unified diff)

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