Perl binding for GDAL on Debian 12 (Bookworm)

The XS based binding for Perl included with the Gdal library has been dropped with the release of GDAL 3.5.0 on May of 2022. Therefore, bookworm has not more a gdal-perl package available, as in the past releases of Debian.

A new CPAN module Geo::GDAL::FFI, based on the FFI interface to external libraries is available, so the Perl developers can use the usual cpan tool to install it or eventually consider to use the Debian way to build Perl modules to install system-wide the new module, making it usable by any user.

Unfortunately, both the processes are not straightforward, so this page describes the workflow to install properly all dependencies in the right order to build Geo::GDAL::FFI. First of all install sudo and add your user to the sudo admin group. All the following operations will download source packages of CPAN modules from the net, so avoid to use dh-make-perl as a privileged user.

sudo apt install dh-make-perl build-essential cmake
sudo apt install libgdal-dev
sudo apt install libtest-harness-perl
sudo apt install libtest2-suite-perl
sudo apt install libffi-checklib-perl
sudo apt install libpkgconfig-perl 

mkdir ~/perl-stuff && cd ~/perl-stuff

dh-make-perl --build --cpan Alien::Build
sudo dpkg -i libalien-build-perl_*_amd64.deb

sudo apt install libarchive-extract-perl libshell-guess-perl
dh-make-perl --build --cpan Alien::Base::ModuleBuild
dpkg -i libalien-base-modulebuild-perl_*_all.deb

dh-make-perl --build --cpan Alien::geos::af
dpkg -i libalien-geos-af-perl_*_all.deb

dh-make-perl --build --cpan Mozilla::CA
dpkg -i libmozilla-ca-perl_*_all.deb

sudo apt install sqlite3
dh-make-perl --build --cpan Alien::sqlite
dpkg -i libalien-sqlite-perl_*_all.deb

dh-make-perl --build --cpan Alien::Build::Plugin::PkgConfig::PPWrapper
sudo dpkg -i libalien-build-plugin-pkgconfig-ppwrapper-perl_*_all.deb

dh-make-perl --build --cpan Alien::proj
sudo dpkg -i libalien-proj-perl_*_all.deb

dh-make-perl --build --cpan Alien::libtiff
sudo dpkg -i libalien-libtiff-perl_*_all.deb

dh-make-perl --build --cpan Alien::GDAL
sudo dpkg -i libalien-gdal-perl_*_all.deb

sudo apt install pdl libffi-platypus-perl

dh-make-perl --build --cpan FFI::Platypus::Declare
sudo dpkg -i libffi-platypus-declare-perl_*_all.deb

dh-make-perl --build --cpan Geo::GDAL::FFI
sudo dpkg -i libgeo-gdal-ffi-perl_*_all.deb