From patchwork Mon Sep 2 13:50:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Neidhardt X-Patchwork-Id: 15206 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B184A17348; Mon, 2 Sep 2019 14:51:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 768DB17320 for ; Mon, 2 Sep 2019 14:51:12 +0100 (BST) Received: from localhost ([::1]:36812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4mjg-000098-2J for patchwork@mira.cbaines.net; Mon, 02 Sep 2019 09:51:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54497) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4mjZ-00008D-Ty for guix-patches@gnu.org; Mon, 02 Sep 2019 09:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4mjW-00063J-PI for guix-patches@gnu.org; Mon, 02 Sep 2019 09:51:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4mjW-000639-MO for guix-patches@gnu.org; Mon, 02 Sep 2019 09:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i4mjW-0003Yw-Jr for guix-patches@gnu.org; Mon, 02 Sep 2019 09:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37269] [PATCH] build-system/asdf: Add option to compress programs. Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Sep 2019 13:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37269 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37269@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.156743223413658 (code B ref -1); Mon, 02 Sep 2019 13:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Sep 2019 13:50:34 +0000 Received: from localhost ([127.0.0.1]:57619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i4mj2-0003YB-1A for submit@debbugs.gnu.org; Mon, 02 Sep 2019 09:50:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:59910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i4miy-0003Y0-CF for submit@debbugs.gnu.org; Mon, 02 Sep 2019 09:50:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4mix-00088q-2E for guix-patches@gnu.org; Mon, 02 Sep 2019 09:50:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4miv-00051D-HW for guix-patches@gnu.org; Mon, 02 Sep 2019 09:50:26 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:35173) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i4miv-0004vI-4c for guix-patches@gnu.org; Mon, 02 Sep 2019 09:50:25 -0400 X-Originating-IP: 92.169.116.127 Received: from localhost.localdomain (lfbn-1-4117-127.w92-169.abo.wanadoo.fr [92.169.116.127]) (Authenticated sender: mail@ambrevar.xyz) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4E3CC1C0011 for ; Mon, 2 Sep 2019 13:50:21 +0000 (UTC) From: Pierre Neidhardt Date: Mon, 2 Sep 2019 15:50:20 +0200 Message-Id: <20190902135020.14473-1-mail@ambrevar.xyz> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/build/lisp-utils.scm (build-program): Add `compress?' key argument. (generate-executable-for-system): Same. (generate-executable): Same. --- guix/build/lisp-utils.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm index 97bc6197a3..c7a589c902 100644 --- a/guix/build/lisp-utils.scm +++ b/guix/build/lisp-utils.scm @@ -220,12 +220,19 @@ Also load TEST-ASD-FILE if necessary." "Return a lisp keyword for the concatenation of STRINGS." (string->symbol (apply string-append ":" strings))) -(define (generate-executable-for-system type system) +(define* (generate-executable-for-system type system #:key compress?) "Use LISP to generate an executable, whose TYPE can be 'asdf:image-op or 'asdf:program-op. The latter will always be standalone. Depends on having created a \"SYSTEM-exec\" system which contains the entry program." (lisp-eval-program `((require :asdf) + ;; Only SBCL supports compression as of 2019-09-02. + ,(if (and compress? (string=? (%lisp-type) "sbcl")) + '(defmethod asdf:perform ((o asdf:image-op) (c asdf:system)) + (uiop:dump-image (asdf:output-file o c) + :executable t + :compression t)) + '()) (asdf:operate ',type ,(string-append system "-exec"))))) (define (generate-executable-wrapper-system system dependencies) @@ -339,6 +346,7 @@ which are not nested." (dependency-prefixes (list (library-output outputs))) (dependencies (list (basename program))) entry-program + compress? #:allow-other-keys) "Generate an executable program containing all DEPENDENCIES, and which will execute ENTRY-PROGRAM. The result is placed in PROGRAM. When executed, it @@ -350,6 +358,7 @@ retained." #:dependencies dependencies #:dependency-prefixes dependency-prefixes #:entry-program entry-program + #:compress? compress? #:type 'asdf:program-op) (let* ((name (basename program)) (bin-directory (dirname program))) @@ -382,6 +391,7 @@ DEPENDENCY-PREFIXES to ensure references to those libraries are retained." dependency-prefixes entry-program type + compress? #:allow-other-keys) "Generate an executable by using asdf operation TYPE, containing whithin the image all DEPENDENCIES, and running ENTRY-PROGRAM in the case of an @@ -405,7 +415,7 @@ references to those libraries are retained." `(((,bin-directory :**/ :*.*.*) (,bin-directory :**/ :*.*.*))))))) - (generate-executable-for-system type name) + (generate-executable-for-system type name #:compress? compress?) (let* ((after-store-prefix-index (string-index out-file #\/