converting Alien::GMP to use Alien::Base

zaki
Sun, 25 Jan 2015 03:47:56 +0000
perl

A while back, I wrote Unicode::Number which was based on libuninum. This is a library that can convert numbers written in various languages to integers and vice versa. I also wrote a library to install libuninum automatically, Alien::Uninum, with the help of Alien::Base.

This all worked quite well, but I wanted to go a step further. libuninum can support the numbers stored with the GNU Multiple Precision Arithmetic Library (libgmp). This allows converting to and from arbitrarily long numbers. To support this, the computer must have libgmp installed.

So I thought to myself, why not write Alien::GMP and install it myself?

Well, Alien::GMP already exists and is authored by Richard Simões, but it bundles an old version of libgmp (v5.0.4). Alien::GMP should be able to download the latest version and install that.

So I created an issue to point out that it needed updates. That led to me getting co-maintainership on the package.

I went ahead and pointed Alien::GMP to the download page for the source code, but it needed HTTPS: https://gmplib.org/download/gmp/. Alien::Base didn't have support for HTTPS, so I added support.

I could finally get back to Alien::GMP.

I cleared out the original code and made Alien::GMP inherit from Alien::Base.

I also added support for using the tool with Inline so that it is easy to compile with other code. I just need to change the tests that look for gmp.h and libgmp.so and the module was good to go. The overall changes can be seen at https://github.com/zmughal/p5-Alien-GMP/compare/zmughal:v0.0.6...v0.0.6_01 and a new dev release of Alien::GMP is at https://metacpan.org/release/ZMUGHAL/Alien-GMP-v0.0.6_01.