Lisp package guidelines (Italiano)

From ArchWiki
Revision as of 18:51, 2 May 2011 by Lorenzog (Talk | contribs) (Directory Structure and Naming)

Jump to: navigation, search


This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Lisp package guidelines (Italiano)#)
Nota: Questo articolo è in fase di traduzione. Seguite per ora le istruzioni della versione inglese.

Introduzione

Attualmente ci sono relativamente pochi pacchetti lisp disponibili nei repository di Arch. Questo significa che prima o poi, probabilmente, se ne aggiungeranno altri. E' dunque utile pensare, adesso che ce ne sono pochi, a come dovrebbero essere pacchettizzati. Questa pagina vuole essere un punto di riferimento sulle linee guida per i pacchetti lisp. E' bene comunque tenere a mente che questa non è una versione definitiva; se non siete d'accordo con alcune idee suggerite qui, sentitevi liberi di modificare la pagina e proporre qualcosa di migliore.

Struttura delle cartelle e nomi

C'è almeno un pacchetto nel repository base (libgpg-errpor) che include dei file lisp, che sono posizionati in /usr/share/common-lisp/source/gpg-error. Per conformità, gli altri pacchetti lisp dovrebbero installare i propri files in /usr/share/common-lisp/source/. Ogni pacchetto dovrebbe avere la propria cartella, in modo da non creare disordine in questa cartella di base.

La cartella del pacchetto dovrebbe avere lo stesso nome del pacchetto lisp, e non dovrebbe essere nominata come nel repository Arch (o AUR). Questo si applica anche ai pacchetti costituiti soltanto da un file.

Ad esempio, un pacchetto Lisp chiamato cl-ppcre' dovrebbe essere nominato cl-ppcre in AUR e risiedere in /usr/share/common-lisp/source/cl-ppcre. Un pacchetto chiamato alexandria dovrebbe essere nominato cl-alexandria in AUR e risiedere in in /usr/share/common-lisp/source/alexandria.

ASDF

Try to avoid the usage of ASDF-Install as a means of installing these system-wide packages.

ASDF itself may be necessary or helpful as a means of compiling and/or loading packages. In that case, it is suggested that the directory used for the central registry (the location of all of the symlinks to *.asd) be /usr/share/common-lisp/systems/.

However, I have observed problems with doing the compilation with asdf as a part of the package compilation process. However, it does work during an install, through use of a package.install file. Such a file might look like this:

# cl-ppcre.install
# arg 1:  the new package version
post_install() {
    echo "---> Compiling lisp files <---"

    clisp --silent -norc -x \
        "(load #p\"/usr/share/common-lisp/source/asdf/asdf\") \
        (pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal) \
        (asdf:operate 'asdf:compile-op 'cl-ppcre)"

    echo "---> Done compiling lisp files <---"

    cat << EOM

    To load this library, load asdf and then place the following lines
    in your ~/.clisprc.lisp file:

    (push #p"/usr/share/common-lisp/systems/" asdf:*central-registry*)
    (asdf:operate 'asdf:load-op 'cl-ppcre)
EOM
}

post_upgrade() {
    post_install $1
}

pre_remove() {
    rm /usr/share/common-lisp/source/cl-ppcre/{*.fas,*.lib}
}

op=$1
shift

$op $*

Of course, for this example to work, there needs to be a symlink to package.asd in the asdf system directory. During package compilation, a stanza such as this will do the trick...

pushd ${_lispdir}/systems
ln -s ../source/cl-ppcre/cl-ppcre.asd .
ln -s ../source/cl-ppcre/cl-ppcre-test.asd .
popd

...where $_lispdir is ${startdir}/pkg/usr/share/common-lisp. By linking to a relative, rather than an absolute, path, it's possible to guarantee that the link will not break post-install.

Lisp-specific packaging

When possible, do not make packages specific to a single lisp implementation; try to be as cross-platform as the package itself will allow. If, however, the package is specifically designed for a single lisp implementation (i.e., the developers haven't gotten around to adding support for others yet, or the package's purpose is specifically to provide a capability that is built in to another lisp implementation), it is appropriate to make your Arch package lisp-specific.

To avoid making packages implementation-specific, ideally all implementation packages (SBCL, cmucl, clisp) would be built with the PKGBUILD field common-lisp. However, that's not the case (and that would likely cause problems for people who prefer to have multiple lisps at their fingertips). In the meantime, you could (a) not make your package depend on *any* lisp and include a statement in the package.install file telling folks to make sure they have a lisp installed (not ideal), or (b) Take direction from the sbcl PKGBUILD and include a conditional statement to figure out which lisp is needed (which is hackish and, again, far from ideal). Other ideas are welcome.

Also note that if ASDF is needed to install/compile/load the package, things could potentially get awkward as far as dependencies go, since SBCL comes with asdf installed, clisp does not but there is an AUR package, and CMUCL may or may not have it (the author of this doc. knows next to nothing about CMUCL; sorry).

People currently maintaining lisp-specific packages that don't need to be lisp-specific should consider doing at least one of the following:

  • Editing their PKGBUILD(s) to be cross-platform, provided someone else is not already maintaining the same package for a different lisp.
  • Offering to take over maintenance or help with maintenance of the same package for a different lisp, and then combining them into a single package.
  • Offering up their package to the maintainer of a different lisp's version of the same package, so as to allow that person to combine them into a single package.

(Note that joyfulgirl, the author of this doc., currently maintains clisp versions of cl-ppcre and of stumpwm; she is open to either giving up the packages to the maintainers of the SBCL versions or to maintain the new, cross-platform versions herself if the SBCL-version maintainers don't want to).

Things you, the reader, can do

  • Maintain lisp packages following these guidelines
  • Update and fix problems with these guidelines
  • Keep up with what's changed here
  • Provide (polite) thoughts, feedback, and suggestions both on this document and to people's work.
  • Translate this page and future updates to this page.