Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

More packager-friendly #10

Closed
mohawk2 opened this issue Aug 31, 2015 · 2 comments
Closed

More packager-friendly #10

mohawk2 opened this issue Aug 31, 2015 · 2 comments

Comments

@mohawk2
Copy link
Member

mohawk2 commented Aug 31, 2015

Following PDLPorters/pdl#139, from @kentfredric:

Presently, for a human to read Makefile.PL is an impenetrable mass of confusion.

And working out even what has changed since some ancient version is even more confusion.

A handful of things are very much unclear how they work for a downstream packager, requiring substantial cognitive investment ( for which provides copious scope to make mistakes ):

  1. Which C-based dependencies are optional?
  2. Which perl-based dependencies are optional?
  3. How are they optional?
  4. Which dependencies are strictly needed for testing and can be avoided if tests will not be performed?

These questions are all very hard to answer for me reviewing the Makefile.PL, and the file DEPENDENCIES gives little insight

This problem is additionally compounded by the fact META.json currently exposes all testing requirements as "build" requirements, which conveys the notion that they must be installed even if tests will not be run

https://metacpan.org/source/CHM/PDL-2.013/META.json#L23

Though this mistake is probably something wrong in the release process because they're declared right in Makefile.PL

( I'm in the process of attempting to upgrade gentoo from the previous version we had, which was 2.4.11, which is now relatively ancient because our "report things out of date" tool has apparently been broken for several years, and its kinda depressing :/ )

Also:

push @prereq, ('OpenGL' => $PDLA::Config{POGL_VERSION}) if $PDLA::Config{USE_POGL}; # And stuff like this is where confusion starts
and the variables '@Hasnt' and '@test' are both kinda confusing why they exist. Further inspection you're using them to delegate which tests to run, but they're the sorts of things that really should be "Let Eumm handle it and if they're missing, let the tests fail" things.

@mohawk2
Copy link
Member Author

mohawk2 commented Aug 31, 2015

Ingo Schmid sent this to pdl-devel mailing list, a gentoo build file(?) (filename PDL-2.13.ebuild):

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-perl/PDL/PDL-2.4.10.ebuild,v 1.0
# 2012/01/16 13:39:54 tove Exp $

EAPI=5

PVN=2.013

SRC_URI="http://search.cpan.org/CPAN/authors/id/C/CH/CHM/${PN}-${PVN}.tar.gz"
MODULE_AUTHOR="CHM"
inherit perl-module eutils multilib
S=${WORKDIR}/${PN}-${PVN}
DESCRIPTION="PDL Perl Module"

LICENSE="Artistic as-is"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~s390 ~sh ~sparc ~x86"
IUSE="badval fftw gsl proj"

DEPEND=">=sys-libs/ncurses-5.2
    dev-perl/Filter
    virtual/perl-File-Spec
    virtual/perl-Pod-Parser
    dev-perl/Inline
    proj? ( dev-perl/Inline-C )
    dev-perl/Astro-FITS-Header
    perl-gcpan/Devel-CheckLib
    >=dev-perl/ExtUtils-F77-1.13
    virtual/perl-Text-Balanced
    dev-perl/Term-ReadLine-Perl
    gsl? ( sci-libs/gsl )
    proj? ( sci-libs/proj )
    fftw? ( sci-libs/fftw:2.1 )"
    #opengl? ( virtual/opengl virtual/glu )

mydoc="DEPENDENCIES DEVELOPMENT MANIFEST* Release_Notes TODO"

SRC_TEST="do"

MAKEOPTS+=" -j1" #300272

src_prepare() {
    epatch "${FILESDIR}/PDL-2.4.2-makemakerfix.patch"

    # Unconditional -fPIC for the lib (#55238, #180807, #250335)
    epatch "${FILESDIR}/${PN}-2.4.4-PIC.patch"

    # TODO: everything in this function below this
    # TODO: line really belongs in src_compile() :

    # This 'fix' breaks compiles for non-opengl users
    #if ! use opengl ; then
    #   sed -e "s:WITH_3D => undef:WITH_3D => 0:" \
    #       ${FILESDIR}/perldl.conf > ${S}/perldl.conf
    #fi
    sed -i \
        -e "s:WITH_HDF => undef:WITH_HDF => 0:" \
        -e "s:USE_POGL => undef:USE_POGL => 0:" \
        -e "s:WITH_3D => undef:WITH_3D => 1:" "${S}/perldl.conf" || die

    if use badval ; then
        sed -i -e "s:WITH_BADVAL => 0:WITH_BADVAL => 1:" "${S}/perldl.conf" || die
    fi

    # Turn off GSL automagic:
    if use gsl ; then
        sed -i -e "s:WITH_GSL => undef:WITH_GSL => 1:" "${S}/perldl.conf" || die
    else
        sed -i -e "s:WITH_GSL => undef:WITH_GSL => 0:" "${S}/perldl.conf" || die
    fi
    # Turn off FFTW automagic too:
    if use fftw ; then
        sed -i -e "s:WITH_FFTW => undef:WITH_FFTW => 1:" "${S}/perldl.conf" || die
    else
        sed -i -e "s:WITH_FFTW => undef:WITH_FFTW => 0:" "${S}/perldl.conf" || die
    fi
    # Turn off Proj4 automagic too:
    if use proj ; then
        sed -i -e "s:WITH_PROJ => undef:WITH_PROJ => 1:" "${S}/perldl.conf" || die
    else
        sed -i -e "s:WITH_PROJ => undef:WITH_PROJ => 0:" "${S}/perldl.conf" || die
    fi
}

src_install() {
    perl-module_src_install

    cp "${S}"/Doc/{scantree.pl,mkhtmldoc.pl} "${D}"/${VENDOR_ARCH}/PDL/Doc/ || die
}

pkg_postinst() {
    if [[ ${ROOT} = / ]] ; then
        perl ${VENDOR_ARCH}/PDL/Doc/scantree.pl
        elog "Building perldl.db done. You can recreate this at any time"
        elog "by running"
    else
        elog "You must create perldl.db by running"
    fi
    elog "perl ${VENDOR_ARCH}/PDL/Doc/scantree.pl"
    elog "PDL requires that glx and dri support be enabled in"
    elog "your X configuration for certain parts of the graphics"
    elog "engine to work. See your X's documentation for futher"
    elog "information."
}

@kentfredric
Copy link

The first 20 lines of that already have me wtfing beyond my own understanding.

@mohawk2 mohawk2 closed this as completed Apr 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants