Source-Changes-HG archive

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

[src/trunk]: src/external/lgpl3/gmp add a README to describe how to port GMP ...



details:   https://anonhg.NetBSD.org/src/rev/cfaca41fb271
branches:  trunk
changeset: 766500:cfaca41fb271
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Jun 24 03:50:23 2011 +0000

description:
add a README to describe how to port GMP build framework, and a script
to parse the GMP ./configure output and generate part of a makefile.

move all the mpn build stuff into the MD part of the framework, and
update the amd64 port to build all the parts it should.

XXX: amd64 build fails to preprocess redc_1.asm gcd_1.asm mod_1_4.asm,
XXX: so we're using the generic C versions for now.

diffstat:

 external/lgpl3/gmp/README                              |   46 +++
 external/lgpl3/gmp/build-gmp-Makefile.inc.awk          |   26 ++
 external/lgpl3/gmp/lib/libgmp/Makefile                 |  141 +-----------
 external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc |  207 ++++++++++++----
 4 files changed, 231 insertions(+), 189 deletions(-)

diffs (truncated from 489 to 300 lines):

diff -r 4f36ec4a55cc -r cfaca41fb271 external/lgpl3/gmp/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/lgpl3/gmp/README Fri Jun 24 03:50:23 2011 +0000
@@ -0,0 +1,46 @@
+$NetBSD: README,v 1.1 2011/06/24 03:50:23 mrg Exp $
+
+GMP in NetBSD.  We need GMP for GCC >= 4.2.
+
+
+Building GMP without configure - how to port GMP build to a new platform.
+
+The GMP build doesn't map very well to normal make.  The ./configure phase
+creates a bunch of symlinks and weeds out the sources lists, and there are
+files with the same name in different subdirectories linked into the same
+final product.  All of these issues need to be dealt with.
+
+There are a few steps to this:
+
+       - run ./configure, save the output
+
+       - create src/external/gpl3/gmp/lib/libgmp/arch/${MACHINE_ARCH} dir,
+         and copy these files into it:
+               config.h
+               config.m4
+               gmp-mparam.h
+               gmp.h
+               mp.h
+
+       - parse the ./configure output and note all created symlinks
+         for mpn.  these need to be converted into a new Makefile.inc.
+         there is a script in this subdir build-gmp-Makefile.inc.awk
+         that can be used to do this.  it should just work to generate
+         the first section of Makefile.inc if fed the entire configure
+         output.
+
+         assembler files generally want -DOPERATION_${foo} defined for
+         each way they are compiled or pre-processed.  the pre-processor
+         used is m4 to parse, and we and create .s files from the .asm
+         files that we then we feed into $CC.
+
+The amd64 port is a good reference to compare.  The trialdivtab.h
+generation may need to be moved the into libgmp/Makefile itself.
+
+
+This is still a work in progress and methods used to build may be
+changed at any time.
+
+
+mrg%netbsd.org@localhost
+- 2001/06/22
diff -r 4f36ec4a55cc -r cfaca41fb271 external/lgpl3/gmp/build-gmp-Makefile.inc.awk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/lgpl3/gmp/build-gmp-Makefile.inc.awk     Fri Jun 24 03:50:23 2011 +0000
@@ -0,0 +1,26 @@
+#! /usr/bin/awk -f
+
+/^config.status: linking/ {
+       # $3 = src
+       # $5 = dst
+
+       sub(/mpn\//, "", $5)
+       if (match($3, /\.c$/)) {
+               c_list[$5] = $3
+       } else if (match($3, /\.asm$/)) {
+               asm_list[$5] = $3
+       }
+}
+
+END {
+       printf("SRCS+= \\\n");
+       # XXX check that the basenames are the same?
+       # XXX yeah - logops_n.c and popham.c may need this
+       for (c in c_list) {
+               printf("\t%s \\\n", c)
+       }
+       printf("\nASM_SRCS_LIST= \\\n");
+       for (asm in asm_list) {
+               printf("\t%s\t\t%s \\\n", asm, asm_list[asm])
+       }
+}
diff -r 4f36ec4a55cc -r cfaca41fb271 external/lgpl3/gmp/lib/libgmp/Makefile
--- a/external/lgpl3/gmp/lib/libgmp/Makefile    Fri Jun 24 01:48:43 2011 +0000
+++ b/external/lgpl3/gmp/lib/libgmp/Makefile    Fri Jun 24 03:50:23 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2011/06/23 12:09:30 mrg Exp $
+#      $NetBSD: Makefile,v 1.3 2011/06/24 03:50:23 mrg Exp $
 
 .include <bsd.init.mk>
 
@@ -91,138 +91,6 @@
        equal.c set_z.c set_d.c                         \
        set_f.c swap.c
 
-#      addmul_2.c \
-#      addmul_3.c \
-#      addmul_4.c \
-#      addmul_5.c \
-#      addmul_6.c \
-#      addmul_7.c \
-#      addmul_8.c \
-#      and_n.c \
-#      andn_n.c \
-#      ior_n.c \
-#      iorn_n.c \
-#      mul_2.c \
-#      mul_3.c \
-#      mul_4.c \
-#      nand_n.c \
-#      nior_n.c \
-#      udiv_qrnnd.c \
-#      xor_n.c
-#      xnor_n.c
-# many asm
-#      sqr_diagonal.c \
-
-MPN_SRCS = \
-       add.c \
-       add_1.c \
-       add_n.c \
-       addmul_1.c \
-       cmp.c \
-       com.c \
-       copyd.c \
-       copyi.c \
-       dive_1.c \
-       diveby3.c \
-       divexact.c \
-       divis.c \
-       divrem.c \
-       divrem_1.c \
-       divrem_2.c \
-       sbpi1_bdiv_qr.c \
-       sbpi1_bdiv_q.c \
-       sbpi1_div_qr.c \
-       sbpi1_div_q.c \
-       sbpi1_divappr_q.c \
-       dcpi1_bdiv_qr.c \
-       dcpi1_bdiv_q.c \
-       dcpi1_div_qr.c \
-       dcpi1_div_q.c \
-       dcpi1_divappr_q.c \
-       dump.c \
-       fib2_ui.c \
-       gcd.c \
-       gcd_1.c \
-       gcdext.c \
-       get_d.c \
-       get_str.c \
-       hgcd2.c \
-       hgcd.c \
-       jacbase.c \
-       lshift.c \
-       matrix22_mul.c \
-       mod_1.c \
-       mod_34lsub1.c \
-       mode1o.c \
-       mod_1_1.c \
-       mod_1_2.c \
-       mod_1_3.c \
-       mod_1_4.c \
-       mul.c \
-       mul_1.c \
-       mul_fft.c \
-       mul_n.c \
-       mul_basecase.c \
-       nussbaumer_mul.c \
-       toom22_mul.c \
-       toom32_mul.c \
-       toom42_mul.c \
-       toom52_mul.c \
-       toom62_mul.c \
-       toom33_mul.c \
-       toom43_mul.c \
-       toom53_mul.c \
-       toom63_mul.c \
-       toom44_mul.c \
-       toom6h_mul.c \
-       toom6_sqr.c \
-       toom8h_mul.c \
-       toom8_sqr.c \
-       toom_couple_handling.c \
-       toom2_sqr.c \
-       toom3_sqr.c \
-       toom4_sqr.c \
-       toom_eval_dgr3_pm1.c \
-       toom_eval_dgr3_pm2.c \
-       toom_eval_pm1.c \
-       toom_eval_pm1.c \
-       toom_eval_pm2exp.c \
-       toom_eval_pm2rexp.c \
-       toom_interpolate_5pts.c \
-       toom_interpolate_6pts.c \
-       toom_interpolate_7pts.c \
-       toom_interpolate_8pts.c \
-       toom_interpolate_12pts.c \
-       toom_interpolate_16pts.c \
-       invertappr.c \
-       invert.c \
-       binvert.c \
-       mulmod_bnm1.c \
-       sqrmod_bnm1.c \
-       mullo_n.c \
-       mullo_basecase.c \
-       neg.c \
-       perfsqr.c \
-       pre_divrem_1.c \
-       pre_mod_1.c \
-       pow_1.c \
-       random.c \
-       random2.c \
-       rshift.c \
-       rootrem.c \
-       scan0.c \
-       scan1.c \
-       set_str.c \
-       sqr_basecase.c \
-       sqrtrem.c \
-       sub.c \
-       sub_1.c \
-       sub_n.c \
-       submul_1.c \
-       tdiv_qr.c \
-
-#      udiv_w_sdiv.c
-
 MPN_GENERIC_SRCS = \
        popcount.c \
        hamdist.c
@@ -251,11 +119,6 @@
        randlc2x.c randmt.c randmts.c rands.c randsd.c randsdui.c       \
        randbui.c randmui.c version.c nextprime.c
 
-.for _src in ${MPN_SRCS}
-COPTS.${_src}+=        -DOPERATION_${_src:R}
-.endfor
-SRCS+= ${MPN_SRCS}
-
 SRCS+= tal-reent.c
 
 # these are generated
@@ -279,6 +142,7 @@
 
 .endfor
 
+.if 0
 # Build the generic popcount/hamdist for now
 .for _srcfile in \
        ${MPN_GENERIC_SRCS}
@@ -290,6 +154,7 @@
 SRCS+=         mpn_${_srcfile}
 CLEANFILES+=   mpn_${_srcfile}
 .endfor
+.endif
 
 INCS=          gmp.h
 INCSDIR=       /usr/include
diff -r 4f36ec4a55cc -r cfaca41fb271 external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc
--- a/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc    Fri Jun 24 01:48:43 2011 +0000
+++ b/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc    Fri Jun 24 03:50:23 2011 +0000
@@ -1,63 +1,168 @@
-#      $NetBSD: Makefile.inc,v 1.1 2011/06/23 12:09:30 mrg Exp $
+#      $NetBSD: Makefile.inc,v 1.2 2011/06/24 03:50:23 mrg Exp $
 
 SRCS+= \
-       bdiv_q.c \
-       bdiv_qr.c \
-       div_q.c \
-       pow_1.c \
-       powm.c \
-       powm_sec.c \
-       powlo.c \
-       toom_eval_pm2.c \
-       toom_eval_pm2exp.c \
-       toom_eval_pm2rexp.c \
-       mu_bdiv_qr.c \
-       mu_div_qr.c \
-       sqr.c \
-       gcd_lehmer.c \
-       gcd_subdiv_step.c \
-       gcdext_lehmer.c \
-       gcdext_subdiv_step.c \
-       perfpow.c \
-       gcdext_1.c \
+       random.c \
+       toom_interpolate_7pts.c \
+       sbpi1_divappr_q.c \
+       random2.c \
        mu_bdiv_q.c \
-       mu_bdiv_qr.c \
+       toom32_mul.c \
+       toom44_mul.c \
+       toom8h_mul.c \
+       toom2_sqr.c \
+       zero.c \
+       gcdext.c \
+       binvert.c \
        mu_div_q.c \
-       mu_div_qr.c \
+       invertappr.c \
+       dump.c \



Home | Main Index | Thread Index | Old Index