Rodger Allen on Mon, 29 Sep 2003 16:44:20 +1000


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

patch for building with openbsd


Hello

I've been playing with getting pari to compile on OpenBSD and have made
some patches to the current CVS tree (29 Sept 2003) for this purpose.
The attached is just a "cvs diff -c" against the tree.

I have tested this against the pari kernel, and linked against gmp.  This
was built against OpenBSD-3.3 on an i386.  I do not have access to other
hardware at the moment, so I cannot say how it would go against anything
but this architecture.

Mostly this is derived from looking at how it was built for NetBSD.

Hoping this meets with the satisfaction of the main pari developers.
Keep up the excellent work!



regards

Rodger Allen


cvs server: Diffing pari
cvs server: Diffing pari/Odos
cvs server: Diffing pari/config
Index: pari/config/arch-osname
===================================================================
RCS file: /home/megrez/cvsroot/pari/config/arch-osname,v
retrieving revision 1.9
diff -c -r1.9 arch-osname
*** pari/config/arch-osname	2003/04/10 19:46:10	1.9
--- pari/config/arch-osname	2003/09/29 06:12:21
***************
*** 11,17 ****
    fx2800)   arch=fx2800; osname=concentrix;;
    hp*)      osname=hpux; arch=`uname -m`
              if test "x$arch" = "x" ; then arch=hppa; fi ;;
!   freebsd|os2)  arch=ix86;;
    ultrix)   arch=mips;;
    nextstep) arch=`file /bin/sh | sed 's/.*(for architecture \(.*\))/\1/'`;;
    darwin*)  arch=`uname -p`
--- 11,17 ----
    fx2800)   arch=fx2800; osname=concentrix;;
    hp*)      osname=hpux; arch=`uname -m`
              if test "x$arch" = "x" ; then arch=hppa; fi ;;
!   freebsd|os2|openbsd)  arch=ix86;;
    ultrix)   arch=mips;;
    nextstep) arch=`file /bin/sh | sed 's/.*(for architecture \(.*\))/\1/'`;;
    darwin*)  arch=`uname -p`
Index: pari/config/get_archos
===================================================================
RCS file: /home/megrez/cvsroot/pari/config/get_archos,v
retrieving revision 1.13
diff -c -r1.13 get_archos
*** pari/config/get_archos	2003/06/19 13:38:37	1.13
--- pari/config/get_archos	2003/09/29 06:12:22
***************
*** 27,33 ****
  ==========================================================================
  I know of the following Operating Systems
  EOM
!   rep='os2 freebsd cygwin linux hpux aix osf1 solaris sunos nextstep concentrix irix';
    . ./display
    echo $n ..."Any of these apply ? $c"
    dflt=$osname; . ./myread
--- 27,33 ----
  ==========================================================================
  I know of the following Operating Systems
  EOM
!   rep='os2 freebsd openbsd cygwin linux hpux aix osf1 solaris sunos nextstep concentrix irix';
    . ./display
    echo $n ..."Any of these apply ? $c"
    dflt=$osname; . ./myread
Index: pari/config/get_cc
===================================================================
RCS file: /home/megrez/cvsroot/pari/config/get_cc,v
retrieving revision 1.21
diff -c -r1.21 get_cc
*** pari/config/get_cc	2003/06/15 15:52:53	1.21
--- pari/config/get_cc	2003/09/29 06:12:23
***************
*** 145,151 ****
                    OPTFLAGS=-O; cflags=-Ae; DLCFLAGS=+z;;
      aix-*)        OPTFLAGS='-O2 -qtune=auto -qmaxmem=8192'
                    cflags='-qlanglvl=ansi';;
!     cygwin*|linux-i?86|freebsd-i?86)
                    OPTFLAGS=-O2; cflags=-m486;;
      osf1-*)       OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;
      sunos-*)      OPTFLAGS=-fast; PRFFLAGS='-pg -Bstatic';;
--- 145,151 ----
                    OPTFLAGS=-O; cflags=-Ae; DLCFLAGS=+z;;
      aix-*)        OPTFLAGS='-O2 -qtune=auto -qmaxmem=8192'
                    cflags='-qlanglvl=ansi';;
!     cygwin*|linux-i?86|freebsd-i?86|openbsd-i?86)
                    OPTFLAGS=-O2; cflags=-m486;;
      osf1-*)       OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;
      sunos-*)      OPTFLAGS=-fast; PRFFLAGS='-pg -Bstatic';;
Index: pari/config/get_dlld
===================================================================
RCS file: /home/megrez/cvsroot/pari/config/get_dlld,v
retrieving revision 1.26
diff -c -r1.26 get_dlld
*** pari/config/get_dlld	2003/04/19 09:58:21	1.26
--- pari/config/get_dlld	2003/09/29 06:12:23
***************
*** 9,15 ****
  soname=.$soname_num
  do_dll=yes
  case "$osname" in
!   aix|osf1|solaris|linux|freebsd)
      case $libpari_base in
        pari) sodest=.$version.$patch;; # released version
        *)    sodest=.$patch.0.0;;      # unstable version
--- 9,15 ----
  soname=.$soname_num
  do_dll=yes
  case "$osname" in
!   aix|osf1|solaris|linux|freebsd|openbsd)
      case $libpari_base in
        pari) sodest=.$version.$patch;; # released version
        *)    sodest=.$patch.0.0;;      # unstable version
***************
*** 63,68 ****
--- 63,69 ----
        aix)     DLLDFLAGS='-r' ;;
        hpux)    DLLDFLAGS='-b' ;;
        freebsd) DLLDFLAGS='-Bshareable -x' ;;
+       openbsd) DLLDFLAGS="-shared" ;;
        irix)    DLLDFLAGS='-shared -elf -no_unresolved -all' ;;
        osf1)    DLLDFLAGS='-shared' ;;
        sunos)   DLLDFLAGS='-assert nodefinitions' ;;
***************
*** 82,88 ****
      DLLDFLAGS="-shared -mimpure-text \$(CFLAGS) $DLLDFLAGS"
    fi
    case "$osname" in
!     osf1|freebsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;
    esac
  
    if test "$fastread" != yes; then
--- 83,89 ----
      DLLDFLAGS="-shared -mimpure-text \$(CFLAGS) $DLLDFLAGS"
    fi
    case "$osname" in
!     osf1|freebsd|openbsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;
    esac
  
    if test "$fastread" != yes; then
Index: pari/config/get_ld
===================================================================
RCS file: /home/megrez/cvsroot/pari/config/get_ld,v
retrieving revision 1.17
diff -c -r1.17 get_ld
*** pari/config/get_ld	2003/02/27 00:35:24	1.17
--- pari/config/get_ld	2003/09/29 06:12:23
***************
*** 34,39 ****
--- 34,43 ----
    linux-*|cygwin*|freebsd-*)
      tmp=`./ldflags "$LDneedsWl" "-export-dynamic"`
      ldflags="$ldflags $tmp" ;;
+   openbsd-*)
+     retmp=`./ldflags "$LDneedsWl" "-export-dynamic"`
+ 	tmp=`echo $retmp | sed -e 's/-Wl,-export-dynamic/-Wl-export-dynamic/'`
+     ldflags="$ldflags $tmp" ;;
    aix-*)  ldflags='-brtl' ;; # in case we link against a shared library
    os2-*)  ldflags="$ldflags -Zexe"
            case "$optimization" in
***************
*** 51,57 ****
  echo "Executable linker is   $LD  $LDFLAGS"
  
  case "$osname" in
!   osf1|linux|cygwin*|freebsd) runpathprefix='-rpath ' ;;
    solaris) runpathprefix='-R ' ;;
    hpux) runpathprefix='+b ' ;;
    aix) runpathprefix='-blibpath:' ;;
--- 55,61 ----
  echo "Executable linker is   $LD  $LDFLAGS"
  
  case "$osname" in
!   osf1|linux|cygwin*|freebsd|openbsd) runpathprefix='-rpath ' ;;
    solaris) runpathprefix='-R ' ;;
    hpux) runpathprefix='+b ' ;;
    aix) runpathprefix='-blibpath:' ;;
cvs server: Diffing pari/doc
cvs server: Diffing pari/emacs
cvs server: Diffing pari/examples
cvs server: Diffing pari/misc
cvs server: Diffing pari/src
cvs server: Diffing pari/src/basemath
cvs server: Diffing pari/src/desc
cvs server: Diffing pari/src/desc/PARI
cvs server: Diffing pari/src/functions
cvs server: Diffing pari/src/functions/conversions
cvs server: Diffing pari/src/functions/elliptic_curves
cvs server: Diffing pari/src/functions/graphic
cvs server: Diffing pari/src/functions/linear_algebra
cvs server: Diffing pari/src/functions/number_fields
cvs server: Diffing pari/src/functions/number_theoretical
cvs server: Diffing pari/src/functions/operators
cvs server: Diffing pari/src/functions/polynomials
cvs server: Diffing pari/src/functions/programming
cvs server: Diffing pari/src/functions/sums
cvs server: Diffing pari/src/functions/transcendental
cvs server: Diffing pari/src/gp
cvs server: Diffing pari/src/graph
cvs server: Diffing pari/src/headers
cvs server: Diffing pari/src/kernel
cvs server: Diffing pari/src/kernel/alpha
cvs server: Diffing pari/src/kernel/gmp
cvs server: Diffing pari/src/kernel/hppa
cvs server: Diffing pari/src/kernel/ia64
cvs server: Diffing pari/src/kernel/ix86
Index: pari/src/kernel/ix86/l0asm.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/kernel/ix86/l0asm.c,v
retrieving revision 1.4
diff -c -r1.4 l0asm.c
*** pari/src/kernel/ix86/l0asm.c	2001/03/12 15:28:33	1.4
--- pari/src/kernel/ix86/l0asm.c	2003/09/29 06:12:25
***************
*** 36,42 ****
     global variable `hiremainder'. */
  
  /* This should ideally be determined at configure time. */
! #if defined(__EMX__) || defined(__DJGCC__) || defined(__GO32__) || (defined(linux) && !defined(__ELF__)) || defined(__386BSD__) || defined(__NetBSD__) || (defined(__FreeBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__CYGWIN32__) || defined(__MINGW32__)
  #  define ASM_UNDERSCORE
  #endif
  
--- 36,42 ----
     global variable `hiremainder'. */
  
  /* This should ideally be determined at configure time. */
! #if defined(__EMX__) || defined(__DJGCC__) || defined(__GO32__) || (defined(linux) && !defined(__ELF__)) || defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__CYGWIN32__) || defined(__MINGW32__)
  #  define ASM_UNDERSCORE
  #endif
  
Index: pari/src/kernel/ix86/level0.h
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/kernel/ix86/level0.h,v
retrieving revision 1.7
diff -c -r1.7 level0.h
*** pari/src/kernel/ix86/level0.h	2003/03/02 18:10:47	1.7
--- pari/src/kernel/ix86/level0.h	2003/09/29 06:12:26
***************
*** 47,53 ****
  
  /* Different assemblers have different syntax for the "shldl" and "shrdl"
     instructions. */
! #if defined(__EMX__) || defined(__DJGCC__) || defined(__GO32__) || (defined(linux) && !defined(__ELF__)) || defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(NeXT) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(COHERENT)
  #  define SHCL "%%cl,"
  #else
  #  define SHCL
--- 47,53 ----
  
  /* Different assemblers have different syntax for the "shldl" and "shrdl"
     instructions. */
! #if defined(__EMX__) || defined(__DJGCC__) || defined(__GO32__) || (defined(linux) && !defined(__ELF__)) || defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(NeXT) || defined(__CYGWIN32__) || defined(__MINGW32__) || defined(COHERENT)
  #  define SHCL "%%cl,"
  #else
  #  define SHCL
cvs server: Diffing pari/src/kernel/m68k
cvs server: Diffing pari/src/kernel/none
cvs server: Diffing pari/src/kernel/ppc
cvs server: Diffing pari/src/kernel/sparcv7
cvs server: Diffing pari/src/kernel/sparcv8
cvs server: Diffing pari/src/kernel/sparcv8_micro
cvs server: Diffing pari/src/kernel/sparcv8_super
cvs server: Diffing pari/src/kernel/sparcv9
cvs server: Diffing pari/src/language
cvs server: Diffing pari/src/modules
cvs server: Diffing pari/src/systems
cvs server: Diffing pari/src/systems/darwin
cvs server: Diffing pari/src/systems/os2
cvs server: Diffing pari/src/test
cvs server: Diffing pari/src/test/32
cvs server: Diffing pari/src/test/64
cvs server: Diffing pari/src/test/in