Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on Perl packages. #1790

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/maintainer/knowledge_base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1518,3 +1518,65 @@ The tl;dr here is that conda sorts as follows:
So make sure that you **tag** your package in such a way that the package name
that conda-build spits out will sort the package uploaded with an ``rc`` label
higher than the package uploaded with the ``dev`` label.

Perl packages
=============

Perl has three standard install locations: **core**, **vendor**, and **site**. Here, **core** is used only for the perl itself, **vendor** is used for installing any other conda-forge packages, and **site** is used for the user to install things locally from sources other than conda-forge.

The most commonly used build system for `Perl packages <https://github.com/conda-forge/perl-file-which-feedstock>`__ is ``ExtUtils::MakeMaker``. For typical packaging of packages of this form, you can have a look at the `perl-file-which recipe <https://github.com/conda-forge/perl-file-which-feedstock/blob/main/recipe/meta.yaml>`__.

A few things to note in the `perl-file-which recipe <https://github.com/conda-forge/perl-file-which-feedstock/blob/main/recipe/meta.yaml>`__ are:

* The ``name`` is composed of ``perl-`` **+** the lowercase version of the CPAN name.

.. code-block::

package:
name: perl-{{ name|lower }}
version: {{ version }}

* The requirements section contains ``make`` for build, ``perl`` and ``perl-extutils-makemaker`` for host, and ``perl`` for run, in addition to any other packages that the particular Perl module being bullt may require.

.. code-block::

requirements:
build:
- make
host:
- perl
- perl-extutils-makemaker
run:
- perl

* The test section contains ``imports``, which lists the CPAN module that can be used in Perl.

.. code-block::

test:
imports:
- File::Which


The build section in the ``meta.yaml`` file should be something like this:

.. code-block::

build:
number: 0
noarch: generic
script:
- perl Makefile.PL INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1
- make
- make test
- make install VERBINST=1

Notable here is ``INSTALLDIRS=vendor``, which selects the appropriate install location for a conda-forge package, and the ``NO_PERLLOCAL`` and ``NO_PACKLIST`` switches, which suppress various CPAN tracking files (as described in the `ExtUtils::MakeMaker documentation <https://perldoc.perl.org/ExtUtils::MakeMaker>`__) that are unnecessary when the module is being externally packaged via conda.

.. note::

``noarch: generic`` should be used only if the package is a pure Perl package.

The other build system used for Perl packages is ``Module::Build``. ``Module::Build`` is a system for building, testing, and installing Perl modules.
It is an alternative to ``ExtUtils::MakeMaker``. It does not require a ``make`` on your system - most of the ``Module::Build`` code is pure-perl and written in a very cross-platform way.
ssurbhi560 marked this conversation as resolved.
Show resolved Hide resolved
To know more about ``Module::Build`` and difference between the two build systems read `Comparision <https://metacpan.org/pod/Module::Build#COMPARISON>`__ and `Module::Build <https://metacpan.org/pod/Module::Build>`__.
ssurbhi560 marked this conversation as resolved.
Show resolved Hide resolved