From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aFIZLC5k11/cCgAA0tVLHw (envelope-from ) for ; Mon, 14 Dec 2020 13:10:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gNMGKC5k118zAwAAB5/wlQ (envelope-from ) for ; Mon, 14 Dec 2020 13:10:06 +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 B2EDF94011A for ; Mon, 14 Dec 2020 13:10:05 +0000 (UTC) Received: from localhost ([::1]:47796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1konc4-00037V-LB for larch@yhetil.org; Mon, 14 Dec 2020 08:10:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1konbV-0002dK-8Z for help-guix@gnu.org; Mon, 14 Dec 2020 08:09:29 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:23977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1konbR-0005SP-0S for help-guix@gnu.org; Mon, 14 Dec 2020 08:09:28 -0500 Date: Mon, 14 Dec 2020 13:09:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail2; t=1607951360; bh=Ba2AalG8lXQNhkorZx0ceeh0fL+tT9SuEsDl0q5VSqM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=SepOM8TNSemQTNe5H5gRcbRZqJM7IbPihVAlUCP6LpTdA4baaXkPD/XHPpzKjy3oU oLI6ScGeegEUAgMyp0407Nk4Gj26fju+RAKwB2JiwdnhiJ1jzZ7fdFsm3rWd7qvXPY ZO6bAODOtVFUWiN9szgvwPwdYLuNkdHA0MusdfddBNIzgL8DqrkQltXHCmUEAVp1Eu Maje2RGKuJxbQSMGM/K7egPjFKN9CKY1rpgnaIK8sVPov/EDKduq+2KaOaU59BbABe HJFJoKbuIuB/H7EVgik6r2xGvXVE1AEHPtBRtm6kVSIvoSakFxCRR4sZwstiSETzyS hS9myfC7lnSrg== To: Matthew Brooks From: Ekaitz Zarraga Subject: Re: Custom package, specifying cmake source directory? Message-ID: In-Reply-To: <20201213205530.25cc3612@mailbox.org> References: <20201213205530.25cc3612@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.133; envelope-from=ekaitz@elenq.tech; helo=mail-40133.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ekaitz Zarraga Cc: "help-guix@gnu.org" Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.01 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=elenq.tech header.s=protonmail2 header.b=SepOM8TN; dmarc=pass (policy=none) header.from=elenq.tech; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: B2EDF94011A X-Spam-Score: -2.01 X-Migadu-Scanner: scn0.migadu.com X-TUID: PrPBwGQBgoMB Hi Matthew, =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Monday, December 14, 2020 3:55 AM, Matthew Brooks wrote: > I'm working on a custom package definition, but when it gets built the cm= ake files are in "source/src" instead of "source", and so the build system = errors out when trying to run cmake. How do I specify the source directory = for the cmake build system? > From grepping around in the definition for the cmake build system, it app= ears that it expects the "source" variable to point to the appropriate loca= tion, but I'm not at all familiar with scheme or guile, and I have no idea = if that's correct or how to change it. I'll try to answer you. I'm never played with this, but I think we can find= something together. Cmake buildsystem has an interesting keyword argument called #:out-of-sourc= e? that chooses to compile the project inside sources or in a separate buil= d directory. You need something similar, but not that. I tracked down that variable and I finally got into Cmake's configure step:= I'm reading the contents of the file `guix/build/cmake-build-system.scm`. There you can find the definition of the `configure` step. You don't really= need to do a lot in you package. You can replace the configure step with y= our own version of it, using the `sources/src` directory instead of what th= e default version uses. In order to replace the configure phase you need to do add a `#:phases` `ar= gument` to your package and use a `modify-phases` call to `replace 'configu= re` with your own. (all the parts marked with backticks are literal code, g= rep them in the gnu/packages/ directory and you'll find examples). Your version could have the exact same contents that the default but with d= ifferent directory. You just need to make a `chdir` to the place you like, = just like this block (line 46 in guix/build/cmake-build-system.scm) does: ``` scheme (when out-of-source? (mkdir "../build") (chdir "../build")) (format #t "build directory: ~s~%" (getcwd)) ``` Remove all of it and change it with `(chdir "src")` or something like that = and it should work. That's most of it. I just gave you a high-level explanation but you can ask= me more if you need. Just ask anything you need. Best, Ekaitz