Re: Inline::F2003 - New ILSM proposed

[email protected] (Ron Grunwald via inline) Sun, 11 Jun 2017 20:23:55 +0800
Newsgroups perl.inline
Message-ID <[email protected]>
Hi Rob,

Many thanks for your expert advice. You've given me quite a few avenues =
to explore.

Cheers,
Ron.

> On 10 Jun 2017, at 9:04 pm, [email protected] wrote:
>=20
>=20
> From: Ron Grunwald via inline
> Sent: Saturday, June 10, 2017 8:53 PM
> To: [email protected]
> Subject: Re: Inline::F2003 - New ILSM proposed
> Hello all,
>=20
>> The example code below illustrates how Inline::F2003 could be =
configured to build a shared library from the Fortran source files =
listed in "SRCLIST". Also, I propose to add a new parameter called =
"MAKEFILE", and this leads me into an area that I'm unsure about.
>>=20
>> use Inline F2003 =3D> Config =3D> (
>>                      SRCLIST   =3D> "ModMatrixOps.f03",
>>                      LIBNAME   =3D> "libMatrixOps.so",
>>                      LIBTYPE   =3D> ".so",
>>                      MAKEFILE  =3D> "AUTOMAKE",
>>                      BUILDDIR  =3D> "BLD_Linux.AMD64_gfortran",
>>                      FOR       =3D> "gfortran",
>>                      FORFLG    =3D> "-v -g -c -std=3Df2003 -fpic =
-cpp"
>>                   );
>>=20
>> This new parameter "MAKEFILE" is intended to allow programmers to =
specify their own makefile. However, the special value "AUTOMAKE" can =
also be specified (as shown above), which means that Inline::F2003 would =
generate a suitable makefile, and this is where I need some advice.
>>=20
>> Inline::C uses ExtUtils::MakeMaker to generate the makefile. I would =
like to use ExtUtils::MakeMaker, but I don't think it would be possible =
since it generates makefiles for C compilation, not Fortran compilation.
>=20
> Both PDL and PGPLOT modules use ExtUtils::MakeMaker && perform fortran =
compilations.
> They make use of the  ExtUtils::F77 module.
> FAIK it might simply be that EU::F77's job is simply to determine the =
name of the fortran compiler, and the flags that it should take ... or =
perhaps there's more to it than just that.
>=20
> The fortran compilations in the PDL build occur during the building of =
PDL::Slatec and PDL::Minuit - there might be other places, too.
> With EU::F77 installed you should be able to build PDL (such that both =
PDL::Slatec and PDL::Minuit are built) with 'cpan -i PDL'.
>=20
> Hopefully there's something in there that will help.
>=20
> Any questions about how the fortran stuff is managed by PDL or EU::MM =
could also be sent to the PDL devel mailing list. It's an active list =
that's fairly well attended by informed and helpful folk.
>=20
>> Unless there is some clever way to configure ExtUtils::MakeMaker to =
output Fortran makefiles?
>>=20
>> Another option is to use the GNU autotools.
>=20
> PDL::Audio (http://search.cpan.org/~mlehmann/PDL-Audio-1.2/) is the =
only module I've ever built that makes use of autotools (in the sndlib =
folder in the source distro).
> It works well, though I haven't studied it.
> Maybe there's something useful to be gleaned from it, too.
>=20
>> In this scenario, Inline::F2003 would read an existing "Makefile.in", =
then use the parameters specified in the above example, and write out =
the final Makefile. Sounds simple, but I've never done this before.
>>=20
>> If anyone is able to provide advice, suggestions or opinions, I would =
be really grateful.
>=20
> My only other advice would be to also sound this out on perlmonks. =
(But that might pay off ... or it might not :-)
>=20
> Cheers,
> Rob
>=20