Home | History | Annotate | Line # | Download | only in gmp
      1 $NetBSD: README,v 1.9 2021/07/12 07:59:51 mrg Exp $
      2 
      3 GMP in NetBSD.  We need GMP for GCC >= 4.2.
      4 
      5 
      6 Building GMP without configure - how to port GMP build to a new platform.
      7 
      8 The GMP build doesn't map very well to normal make.  The ./configure phase
      9 creates a bunch of symlinks and weeds out the sources lists, and there are
     10 files with the same name in different subdirectories linked into the same
     11 final product.  All of these issues need to be dealt with.
     12 
     13 There is a mostly-working "mknative" for GMP now.  If this fails, see the
     14 section below for the old instructions.
     15 
     16 	- run a "./build tools libs", possibly setting MKGCC=no if the
     17 	  GMP port is currently not working at all.
     18 
     19 	- cd to tools/gmp, and run $TOOLDIR/bin/nbmake-$arch native-gmp
     20 
     21 	- if that works, commit the files it changed in the source tree.
     22 
     23 	- set NEWCONFIGDIR=/writeable/src if eg /usr/src is read-only.
     24 
     25 These are the old steps, that maybe are necessary to fix the automated
     26 output:
     27 
     28 	- run ./configure, save the output.  you can use the makefile
     29 	  "Makefile.netbsd-gmp" in this directory to run this with the
     30 	  right options, etc.  run it with nbmake-$MACHINE.
     31 
     32 	- create src/external/gpl3/gmp/lib/libgmp/arch/${MACHINE_ARCH} dir,
     33 	  and copy these files into it:
     34 		config.h
     35 		config.m4
     36 		gmp-mparam.h
     37 		gmp.h
     38 
     39 	  some of these files might have src/obj references.  in particular
     40 	  fix GMP_MPARAM_H_SUGGEST to start from ./mpn/... and make sure
     41 	  we #define __GMP_CC to just "gcc", and make sure that
     42 	  CONFIG_TOP_SRCDIR is not defined in config.m4
     43 
     44 	  the "Makefile.netbsd-gmp" has a "copy-files" target that performs
     45 	  these tasks.
     46 
     47 	- parse the ./configure output and note all created symlinks
     48 	  for mpn.  these need to be converted into a new Makefile.inc.
     49 	  there is a script in this subdir build-gmp-Makefile.inc.awk
     50 	  that can be used to do this.  it should just work to generate
     51 	  the first section of Makefile.inc if fed the entire configure
     52 	  output.
     53 
     54 	  assembler files generally want -DOPERATION_${foo} defined for
     55 	  each way they are compiled or pre-processed.  the pre-processor
     56 	  used is m4 to parse, and we and create .s files from the .asm
     57 	  files that we then we feed into $CC.
     58 
     59 	  this part needs to be automated, but requires that the first
     60 	  part's ./configure output be stored for it.  this is not done.
     61 
     62 	  it would be good to convert the Makefile.inc into a pair of
     63 	  files -- srcs.mk generated from build-gmp-Makefile.inc.awk, and
     64 	  the remaining static part of the Makefile.inc left with the
     65 	  include of srcs.mk.
     66 
     67 The amd64 port is a good reference to compare.
     68 
     69 
     70 mrg (a] netbsd.org
     71 - 2021/07/11
     72