Thread: plperl win32

plperl win32

From
"Magnus Hagander"
Date:
Here is a patch required to build plperl with win32. The issues were:

* perl_useshrplib gets set to "yes" and not to "true". I assume it's set
to "true" on unix, so I left both.
* Need to translate backslashes into slashes
* The linker config coming out of perl was for MSVC and not for mingw


Some of this is pretty ugly stuff - the reassigning into a second
variable etc. If somebody with a little better "makefile knowledge"
would clean that up (if it can be, but it should be possible), please
do!


//Magnus

 <<plperl_win32.patch>>

Attachment

Re: plperl win32

From
Bruce Momjian
Date:
Magnus, why is this reassignment needed, basically the 'else' part:

! ifeq ($(PORTNAME), win32)
! xperl_archlibexp=$(subst \,/,$(perl_archlibexp))
! xperl_privlibexp=$(subst \,/,$(perl_privlibexp))
! perl_embed_ldflags=-L $(xperl_archlibexp)/CORE -lperl58
! else
! xperl_archlibexp=$(perl_archlibxep)
! xperl_privlibexp=$(perl_privlibexp)
! endif


---------------------------------------------------------------------------

Magnus Hagander wrote:
> Here is a patch required to build plperl with win32. The issues were:
>
> * perl_useshrplib gets set to "yes" and not to "true". I assume it's set
> to "true" on unix, so I left both.
> * Need to translate backslashes into slashes
> * The linker config coming out of perl was for MSVC and not for mingw
>
>
> Some of this is pretty ugly stuff - the reassigning into a second
> variable etc. If somebody with a little better "makefile knowledge"
> would clean that up (if it can be, but it should be possible), please
> do!
>
>
> //Magnus
>
>  <<plperl_win32.patch>>

Content-Description: plperl_win32.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: plperl win32

From
"Magnus Hagander"
Date:
>
>Magnus, why is this reassignment needed, basically the 'else' part:
>
>! ifeq ($(PORTNAME), win32)
>! xperl_archlibexp=$(subst \,/,$(perl_archlibexp))
>! xperl_privlibexp=$(subst \,/,$(perl_privlibexp))
>! perl_embed_ldflags=-L $(xperl_archlibexp)/CORE -lperl58
>! else
>! xperl_archlibexp=$(perl_archlibxep)
>! xperl_privlibexp=$(perl_privlibexp)
>! endif
>

Most likely because I'm not experienced enough at writing makefiles ;-)

I originally tried the approach with
ifeq ($(PORTNAME),win32)
perl_archlibexp=$(subst, \,/,$(perl_archlibexp))
...

but then make complained about recursive assignment of the variable. If
there is a simple way to get around that, it wouldn't be necessary.
Since I didn't know of one, I had to change the name of the variable,
which in turned required the part under else, so I didn't have to ifeq
the actual build rule.

//Magnus

Re: plperl win32

From
Tom Lane
Date:
"Magnus Hagander" <mha@sollentuna.net> writes:
> I originally tried the approach with
> ifeq ($(PORTNAME),win32)
> perl_archlibexp=$(subst, \,/,$(perl_archlibexp))
> ...

> but then make complained about recursive assignment of the variable. If
> there is a simple way to get around that, it wouldn't be necessary.

Use := not = ...

When you write foo = something, you are defining something that acts
like a macro rather than a constant string, and so the above is a
self-referential macro.  In particular $(x) references are not expanded
yet in something that's assigned with =.

Here is an example of the difference:

    x = foo
    y = bar$(x)
    x = baz

If you now evaluate $(y) you will get barbaz, not barfoo (in fact,
there is no need to define x before y at all in this case).
On the other hand, in

    x = foo
    y := bar$(x)

y is assigned barfoo, and it won't change if x is modified later.

            regards, tom lane

Re: plperl win32

From
Bruce Momjian
Date:

Attached is the modified patch I applied.  Thanks.

---------------------------------------------------------------------------


Magnus Hagander wrote:
> Here is a patch required to build plperl with win32. The issues were:
>
> * perl_useshrplib gets set to "yes" and not to "true". I assume it's set
> to "true" on unix, so I left both.
> * Need to translate backslashes into slashes
> * The linker config coming out of perl was for MSVC and not for mingw
>
>
> Some of this is pretty ugly stuff - the reassigning into a second
> variable etc. If somebody with a little better "makefile knowledge"
> would clean that up (if it can be, but it should be possible), please
> do!
>
>
> //Magnus
>
>  <<plperl_win32.patch>>

Content-Description: plperl_win32.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/pl/plperl/GNUmakefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/pl/plperl/GNUmakefile,v
retrieving revision 1.14
diff -c -c -r1.14 GNUmakefile
*** src/pl/plperl/GNUmakefile    5 Jul 2004 23:24:12 -0000    1.14
--- src/pl/plperl/GNUmakefile    16 Jul 2004 19:16:57 -0000
***************
*** 8,13 ****
--- 8,16 ----
  ifeq ($(perl_useshrplib),true)
  shared_libperl = yes
  endif
+ ifeq ($(perl_useshrplib),yes)
+ shared_libperl = yes
+ endif

  # If we don't have a shared library and the platform doesn't allow it
  # to work without, we have to skip it.
***************
*** 18,24 ****
  override CFLAGS := $(filter-out -Wall -Wmissing-declarations -Wmissing-prototypes, $(CFLAGS))
  endif

! override CPPFLAGS := -I$(srcdir) -I$(perl_archlibexp)/CORE $(CPPFLAGS)


  NAME = plperl
--- 21,33 ----
  override CFLAGS := $(filter-out -Wall -Wmissing-declarations -Wmissing-prototypes, $(CFLAGS))
  endif

! ifeq ($(PORTNAME), win32)
! perl_archlibexp := $(subst \,/,$(perl_archlibexp))
! perl_privlibexp := $(subst \,/,$(perl_privlibexp))
! perl_embed_ldflags := -L $(perl_archlibexp)/CORE -lperl58
! endif
!
! override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE


  NAME = plperl