From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gBaUILlHQWCpGAAA0tVLHw (envelope-from ) for ; Thu, 04 Mar 2021 20:48:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CGRPHLlHQWBfAQAAB5/wlQ (envelope-from ) for ; Thu, 04 Mar 2021 20:48:57 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2286E2EE36 for ; Thu, 4 Mar 2021 21:48:57 +0100 (CET) Received: from localhost ([::1]:57416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHuu0-00072q-68 for larch@yhetil.org; Thu, 04 Mar 2021 15:48:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHuio-0002v7-Hz for guix-devel@gnu.org; Thu, 04 Mar 2021 15:37:22 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:55281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHuik-0005qQ-LA for guix-devel@gnu.org; Thu, 04 Mar 2021 15:37:21 -0500 Received: from nijino.local (217-149-164-20.nat.highway.telekom.at [217.149.164.20]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Ds2jL1djcz3wZ9; Thu, 4 Mar 2021 21:37:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1614890230; bh=qeoPuGR+KDN9aXXnCqGBObudvfBOBD+eVKaqc+OU1Xk=; h=Subject:From:To:Date:In-Reply-To:References; b=eZwPNNfDDlZaWLsjqNkJ5aOQCtbSegyIiX5qtxJiaIw0Vz7mMKEgvq50iMNI3FkVK QIKkHS4P8JKto29ixKUXSK7QNeveW6hqwvO427tYdwOxXT60buTyEfoIHgvGOKMYY4 zKkUKW/8CkSeB4EUnppwnV/L0BIWQt2ClVUwdV78= Message-ID: Subject: Re: What features does a language/runtime need to use guix as a package manager? From: Leo Prikler To: =?ISO-8859-1?Q?Vin=EDcius?= dos Santos Oliveira , guix-devel@gnu.org Date: Thu, 04 Mar 2021 21:37:09 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 Received-SPF: pass client-ip=129.27.2.202; envelope-from=leo.prikler@student.tugraz.at; helo=mailrelay.tugraz.at X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614890937; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qeoPuGR+KDN9aXXnCqGBObudvfBOBD+eVKaqc+OU1Xk=; b=uoiWLn4ikbv/5R1j8/LAtB9llQWMGBpYJ0Lam5Q47IREGKHTloQlDcxZvoUJzCxl7xS8Nu CxsTlY9qCJAKpTIjmXbo39Y/bcEBkqMhsU7O/b9kmsjmmsi73oYZy52zrZb/skPtExhH1Z PAMmohSwy44ElHnKO+xScYstdKDs3HGUpb/6sWzENnd2puHQFHidjr17oYntHX5NflFj+9 E1q4W4olq4LsnwKIaUAvVvYKg/csuzk4dKOZht1z6ou9PYrwRcHqpfuQ3s+ttxNIgIOj68 QMlxji2I5Nvizfi40ahJwRDBQEdpgvR8o8bkf2nQ/3G13EUqQWj9et6PELpxiQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614890937; a=rsa-sha256; cv=none; b=LPN/3+pL3aDxT0pQG0688pyvxMZYb48Mu0tnU7IDnpSEcKCUJ9SzyYc8XJqkj1i0xWigVu dLizBLiUeBDX1Kgs8AxMulK6KFngaRH9PZBMCTiqv61iU28r734q/ZFvAX+oCbmPd49uE5 6Nwc5Y1LUtLVsLsfYBtKSE3taplaXw6pI2txrp+63N1ZFPUDAJdB9swQxMCpatfSJsBY33 rGmNyepTG+oIvCT9Io6yC9+wWaufiiwXbVu0aw59IIcQ0t/oAhScHSysedQt3PO/j1Omll s8t9fFlKIwWjjVnN5q4SYhUWyISnKku4l+ptEq1Dimbp5vmlBLamqWg25a6GKQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=tugraz.at header.s=mailrelay header.b=eZwPNNfD; dmarc=pass (policy=none) header.from=student.tugraz.at; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tugraz.at header.s=mailrelay header.b=eZwPNNfD; dmarc=pass (policy=none) header.from=student.tugraz.at; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 2286E2EE36 X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: XA/Ox6XRxXHR Hello Vinícius Am Mittwoch, den 03.03.2021, 15:31 -0300 schrieb Vinícius dos Santos Oliveira: > Hi, > > I was curious about how a language/runtime module system needs to be > designed to use guix as a package manager. I'm developing my own > require() function for a Lua host and I'd like to make sure it can > use > guix as a package manager. As a rule of thumb, the less "smart" your language/runtime is, the easier it gets. Now, this is only true to a certain extent – if your language/runtime does not understand the concept of environment variables at all, you may need to overthink it a little, but if it rolls out its own package manager (see also Rust, NPM, Go) things will get needlessly complicated. > From a tutorial by Andrew Tropin[1] I learned about > native-search-paths. So I changed my module system to use a *_PATH > environment variable so guix could teach the Lua-based runtime where > to find the modules. If you're planning to do cross-compilation, you might add a search-path in lieu of/addition to the native-search-path, but that sounds like a good idea. > Then there is the next question: how does the module know where to > install itself to? A similar problem is found in GStreamer, so I'll > refer to the GStreamer scenario from now on. > > The guix GStreamer package defines native-search-paths to > GST_PLUGIN_SYSTEM_PATH=lib/gstreamer-1.0. As far as I tested, if a > package gstreamer-foobar depends on gstreamer and install files to > ${prefix}/lib/gstreamer-1.0, then GST_PLUGIN_SYSTEM_PATH will be > automatically updated to also contain gstreamer-foobar's > /gnu/store/*/lib/gstreamer-1.0. > > My question here is: how should the software packaged in > gstreamer-foobar find out the proper directory to install its > plugins? > Should it be ${prefix}/lib/gstreamer-1.0? Should it be > ${prefix}/lib/gstreamer-1.1? That's something that shouldn't be > hardcoded. Why not? See [1] for how GStreamer itself does this. More generally speaking, GNU has standard for Makefiles [2], that should probably also be followed by your build tool of choice. > As far as I see, it can just use the pluginsdir from > GStreamer's pkg-config definition. Like so: > > $ pkg-config --variable=pluginsdir gstreamer-1.0 > > However this command will print the wrong dir in guix. It'll print > something like: > > /gnu/store/9if71w58d5mkxfxyc7fpz289qssnkqsv-gstreamer- > 1.18.2/lib/gstreamer-1.0 > > But that's the "namespace" for the gstreamer package, not for the > gstreamer-foobar package. A solution would be to invoke pkg-config as > follows: Using pkg-config in such a manner is a hack. Maintainers of traditional distros know (and ignore) this. > $ pkg-config --define-variable="prefix=${prefix}" > --variable=pluginsdir gstreamer-1.0 > > This will actually print the proper ${prefix}/lib/gstreamer-1.0. But > that's my question here. How should pkg-config be invoked properly? I > could just as well invoke it as: > > $ pkg-config --define-variable="prefix=${prefix}" > --define-variable=libdir='${prefix}/lib' --variable=pluginsdir > gstreamer-1.0 I think you're trying to solve a problem, that does not really need solving here. Instead of trying to fix your calls to pkg-config, do not use pkg-config to find locations to write to! On a related note, you should probably not change versions in versioned directories, such as lib/gstreamer-1.0, unless you also break the API in some way. I think Python serves as a somewhat good negative example, since most packages would support 3.x, for some values of x, but all get shoved into whatever Python was used during build. Emacs has a similar issue, which did lead many people into strange situations during the 27 upgrade or when trying out emacs-next. This does not mean, that you can't version stuff like Python or Emacs do, just that you should be careful and aware of the consequences. (Also both Python and Emacs are somewhat justified in doing so, since their minor versions typically add features, that weren't present prior.) Regards, Leo [1] https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/552da8569bca9ea5238bcbdad7432b8f7c0837b9/meson.build#L25-27 [2] https://www.gnu.org/prep/standards/html_node/Directory-Variables.html