Bill Allombert on Sat, 19 Dec 2009 15:47:49 +0100


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

Re: A patch for native PARI/GP build on Windows (Mingw+Msys)


Hello Vasili,
I have some questions about your patch.

On Thu, Dec 17, 2009 at 06:07:10PM +0200, Vasili Burdo wrote:
> Index: config/get_dlld
> ===================================================================
> --- config/get_dlld	(revision 12034)
> +++ config/get_dlld	(working copy)
> @@ -27,6 +27,7 @@
>  # On FreeBSD 2.2.5 (Y. Uchikawa) and Cygwin, this does not work.
>  case "$osname" in 
>    freebsd|cygwin) DL_DFLT_NAME="\\\"\$(LIBPARI_DYN)\\\"" ;;
> +  mingw) DL_DFLT_NAME="\\\"\$(LIBPARI_SO)\\\"" ;;
>    *) DL_DFLT_NAME=NULL ;;
>  esac

Do you know why DL_DFLT_NAME=$(LIBPARI_DYN) does not work here ? It did not
work with wine and this is strange because LIBPARI_SO is a symlink to
LIBPARI_DYN.  Using LIBPARI_DYN is more correct, because LIBPARI_SO should only
be used by the compile-time linker. Maybe there is a better way.

> @@ -84,6 +85,7 @@
>    case "$osname" in
>      os2) DLLDFLAGS="$CFLAGS -Zdll" ;; # assume DLLD = gcc
>      cygwin) DLLDFLAGS="-Wl,--out-implib=\$(LIBPARI_SO)\$(_A),--export-all-symbols";;
> +	mingw) DLLDFLAGS="-Wl,--out-implib=\$(LIBPARI_SO)\$(_A)";;
>    esac
>    if test -n "$DLLDisGCC"; then
>      case "$arch" in

Do you know why this is different from cygwin ?

> Index: config/Makefile.SH
> ===================================================================
> --- config/Makefile.SH  (revision 12034)
> +++ config/Makefile.SH  (working copy)
> @@ -48,6 +48,10 @@
>         export_file=pari.def; export_create="emxexp -u"
>         # Actually, the build will fail until the switch to -Zomf
>         dlld_ignore=- ;;
> +  mingw)
> +    CFLAGS="$CFLAGS -fno-omit-frame-pointer"
> +    export_file='$(LIBPARI).def'
> +    ;;
>  esac

What is the purpose of 'CFLAGS="$CFLAGS -fno-omit-frame-pointer"' ?
This cause CFLAGS to have -fno-omit-frame-pointer twice 
(at least when cross-compiling).

> +if test "$osname" = "mingw"; then
> +cat >> $file << EOT
> +
> +#undef UNIX
> +#undef GPDATADIR
> +#define GPDATADIR win32_GPDATADIR()

This does not seems correct.

> Index: src/systems/mingw/mingw.c
> ===================================================================
> --- src/systems/mingw/mingw.c	(revision 0)
> +++ src/systems/mingw/mingw.c	(revision 0)
> @@ -0,0 +1,93 @@
> +#include <windows.h>
> +#include <stdio.h>
> +
> +const char* 
> +win32_GPDATADIR()
> +{
> +    static char datadir[1024] = {0};
> +    if( 0 == *datadir ) {
> +        char* slash;
> +        GetModuleFileNameA(0, datadir, sizeof(datadir) );
> +        slash = strrchr(datadir, '\\');
> +        if( slash ) *(slash+1) = 0;
> +        //while( (slash = strchr(datadir, '\\')) )
> +        //    *slash = '/';
> +        strcat(datadir, "gp-data");
> +    }
> +    return datadir;
> +}

I do not understand what this is doing. Cannot you do that in Configure
instead ?

Cheers,
Bill.