From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 5/6] gnu: Add lua5.2-lpeg. Date: Thu, 26 Jan 2017 19:01:06 +0100 Message-ID: <878tpxwvj1.fsf@gnu.org> References: <20170124144015.24473-1-ricardo.wurmus@mdc-berlin.de> <20170124144015.24473-5-ricardo.wurmus@mdc-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWoMC-0004rX-C3 for guix-devel@gnu.org; Thu, 26 Jan 2017 13:01:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWoM9-000314-9E for guix-devel@gnu.org; Thu, 26 Jan 2017 13:01:12 -0500 In-Reply-To: <20170124144015.24473-5-ricardo.wurmus@mdc-berlin.de> (Ricardo Wurmus's message of "Tue, 24 Jan 2017 15:40:14 +0100") 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+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org Ricardo Wurmus skribis: > * gnu/packages/lua.scm (lua5.2-lpeg): New variable. I think you didn=E2=80=99t get feedback on this one. > +(define-public lua5.2-lpeg > + (package (inherit lua-lpeg) > + (name "lua5.2-lpeg") > + (arguments > + `(#:phases > + (modify-phases %standard-phases > + (delete 'configure) > + ;; `make install` isn't available, so we have to do it manually > + (replace 'install > + (lambda* (#:key outputs #:allow-other-keys) > + (let ((out (assoc-ref outputs "out")) > + (lua-version ,(version-major+minor (package-version l= ua-5.2)))) > + (install-file "lpeg.so" > + (string-append out "/lib/lua/" lua-version)) > + (install-file "re.lua" > + (string-append out "/share/lua/" lua-versio= n)) It would be best to avoid duplicating this phase since the only difference is the version number. However, this is currently inconvenient, so it=E2=80=99s probably fine to keep it, with an =E2=80=9CXX= X=E2=80=9D comment. To fix it, we=E2=80=99d have to arrange for the phase to stand alone as opp= osed to getting the Lua version number from the =E2=80=9Chost side=E2=80=9D. So= it would be written along the lines of: (lambda =E2=80=A6 (let* ((lua (assoc-ref inputs "lua")) (lua-version (extract-version lua))) =E2=80=A6)) The Python stuff uses a similar pattern. The =E2=80=98extract-version=E2= =80=99 thing is necessarily hacky and brittle though. Alternately, we could pass the info as an environment variable, something that=E2=80=99s not done anywhere yet. Ludo=E2=80=99.