unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Fis Trivial <ybbs.daans@hotmail.com>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Dealing with language bindings for libraries.
Date: Wed, 09 May 2018 22:08:51 +0200	[thread overview]
Message-ID: <87h8ngfv70.fsf@elephly.net> (raw)
In-Reply-To: <BLUPR16MB0500DDB8F795813D6F99A9F692990@BLUPR16MB0500.namprd16.prod.outlook.com>


Fis Trivial <ybbs.daans@hotmail.com> writes:

>> We can also
>> reuse parts of build systems without having to reimplement them
>> manually.  We would simply reference them with something like this:
>>
>> --8<---------------cut here---------------start------------->8---
>>   (add-after 'install 'strip-jar-timestamps
>>     (assoc-ref ant:%standard-phases 'strip-jar-timestamps))
>> --8<---------------cut here---------------end--------------->8---
>>
> Oh, I didn't thought about that before, thanks. But would something
> similar to this be nicer?
>
> --8<---------------cut here---------------start------------->8---
> (define-public foobar
>   (package
>     (name "foobar")
>     (source (origin ... ))
>     (build-system cmake-build-system)
>     (output "python"			; builds foobar-python
>      `(package/inherit foobar
> 		       (name "foobar-python")
> 		       (source (getcwd))
> 		       (build-system python-build-system)
> 		       (inputs
> 			`(,@(package-inputs foobar)
> 			  ("pytest" ,pytest)))
> 		       (arguments
> 			`(#:phases
> 			  (modify-phases %standard-phases
> 			    (add-before 'configure 'cd
> 			      (lambda* _
> 				(chdir "./python"))))))))
>     (home-page "https://foobar.html")
>     (license ...)))
> --8<---------------cut here---------------end--------------->8---

That’s not how the package DSL works, and I don’t think it should work
like this.  An output is not a package and it does not have its own
inputs.  Nor can a package be recursively defined (here foobar refers to
foobar itself).

You cannot have it both ways: include inputs conditionally *and* have
the thing be one and the same package.  You *can*, however, define a
procedure that generates closely related packages.  But then these are
separate packages and don’t share the same build environment.

> I read the package definition of python-capstone as pointed out by
> Julien Lepiller, thanks. It requires manipulating python build code to
> achieve the effect. It's true that we can do that by inspecting build
> code, but these language bindings are designed to be build in source
> tree, I don't think the solution of python-capstone should be adopted as
> an universal solution.

I don’t think there *can* be a universal solution.  I’ve seen both kinds
of packages in the past; the solution depends on the build system.

--
Ricardo

  reply	other threads:[~2018-05-09 20:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 15:21 Dealing with language bindings for libraries Fis Trivial
2018-05-09 16:25 ` Konrad Hinsen
2018-05-09 18:00   ` Julien Lepiller
2018-05-11  5:49     ` Konrad Hinsen
2018-05-09 18:45 ` Ricardo Wurmus
2018-05-09 19:33   ` Fis Trivial
2018-05-09 20:08     ` Ricardo Wurmus [this message]
2018-05-10  5:02       ` Fis Trivial
2018-05-10  8:18 ` Catonano
2018-05-10  9:27   ` Fis Trivial
2018-05-10 15:08     ` Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8ngfv70.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=ybbs.daans@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).