|The stupid question is the question not asked|
Writing a Perl extension framework for Inkscapeby fdesar (Beadle)
|on Jan 22, 2019 at 13:49 UTC||Need Help??|
fdesar has asked for the wisdom of the Perl Monks concerning the following question:
Sorry for this long first post, I just want to explain as clearly as possible what I'm attempting to do...
I'm a newbie at the monastery but not a perl newbie : I started using perl with version 4, beginning of the 90's...
Since a few years I started doing paper folding artwork also known as 'Origami' ((折り紙 or おりがみ) and I use a very popular OpenSource vector-drawing software called Inkscape for drawing Origami diagrams.
Diagramming Origami require somes very specific tools for drawing, to solve geometric problems to find where a crease will fall, following the axiomatic of Origami. It's sometimes tedious so, as Inkscape allows it, I decided to write a dedicated extension for it to do that. Of course, I wrote it in Perl as Inkscape allows using various scripting languages for it, but their preferences go clearly to Python : every docs and canevas for extensions are written for and in Python. So I decided to write my own tools to get my extension working with Perl and now it does work flawlessly.
As I've always been an OpenSource enthusiastic, I logically want to share my work with others. On Linux or other Unices, no problem : Perl is always available and just adding a few modules to the standard core installations is sufficient (XML::LibXML and Local::gettext as I also made support for I18n). But unfortunately, it exists a very widely used bloated thing called Windows on which many ordinary people get stuck. And here starts the problem: neither Perl nor Python are natively available on those environments.
I solved the problem by suggesting using Active Perl and it works quite well but... it is definitely *not* free software (as in free speech, not free bear) and I don't like that!
The Inkscape Team solved this issue by optionally integrating a Python2.7 chain to their Windows distribution as they already provide a lot of useful extensions written in Python. But for Perl, nothing, nada. Which I don't like neither and it makes me angry (but I keep zen).
So I had a very strange idea : building an integrated Perl framework for Inkscape on Windows that would install on top of standard Inkscape installation that would allow Perl extension to gracefully integrate with it. And if it works, maybe I'll be able to convince the Inkscape team to integrate it later on as an option within their main distribution, who knows...
For that, I need to do a number of things, all theoretically feasible I think :
1. Build a native Perl on Windows relative to the Inkscape installation directory (having an @INC pointing to (?)/Inkscape/lib/perl5)
2. Build the Lib::LibXML module for it (absolutely mandatory as Inkscape works upon SVG)
3. Build other few modules as Locale::gettext, for example, as gettext is their I18n implementation
4. Write a basic framework (in fact a module) for building extensions (mostly already done as I already wrote one for my own use but it needs to be more generalized/structured), as there is one for Python
5. Write an installer to setup things easily for dummy end-users (mainly copying the Perl executable and libraries into the installed Inkscape directory)
If all of this seems weird to you, just tell me and stop reading further...
Now, the problem:
I'm stuck on stage 1: building Perl on a windows system !
I tried many things, read a lot of threads, used a lot of configurations, from Straberry Perl, MingWin64 (MSYS2) to Visual Studio C++ Community 2017 and every thing failed:
- Strawberry Perl, no succes. I don't remember why I decided to give up, probably because using cygwin, it won't build a native Windows Perl...
- MingWin64 (MSYS2), no success, I get a fatal compiling error for a missing poll.h include file
- VS 2017 community is much better, as nmake completes the compilation correctly, but I get a fatal error running nmake test:
and, of course, nmake install won't work.
And finally, the question:
What to try next ?
If anyone's interested in helping me mongering Perl on Inkscape, you're very welcome ;-)
PS : my extension is available to download and test at https://github.com/fdesar/Origami-Ext