From patchwork Mon Jul 27 14:09:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1336977 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Uum4vqbH; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BFhWy6BLpz9sVf for ; Tue, 28 Jul 2020 00:09:50 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AD43C85DF7; Mon, 27 Jul 2020 14:09:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W0sTROp1cYPc; Mon, 27 Jul 2020 14:09:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C134A85FA3; Mon, 27 Jul 2020 14:09:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 82DCA1BF35C for ; Mon, 27 Jul 2020 14:09:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7D16087C30 for ; Mon, 27 Jul 2020 14:09:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bQtKLoVGsd4K for ; Mon, 27 Jul 2020 14:09:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by whitealder.osuosl.org (Postfix) with ESMTPS id D2373878C0 for ; Mon, 27 Jul 2020 14:09:29 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id b6so15038387wrs.11 for ; Mon, 27 Jul 2020 07:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8fcxTwXDkaEKZxGuMnh1soGrArNZ2B6mZl0Rr5ORBAI=; b=Uum4vqbH5tNecp2+9DHvJjQKXoFR9sgEmtLrr7pcrVEXgaH3SqsS4VeNf6dE+BfLny 6lfFRRXvjWAu9v1ZTJGvympJ3LCdHLR4T/TrjHxVZ4gA/Jhw3/o/LixldU+jv3JUfIFs Hqy3KnftytH6KDzO0ilZyl/QBvqZ8J5SpnIUga9WKYTLOsQJtTPwOGIv9m8NlVGCBYFi +pGWcBeX6DLpbY1sInzVaHIzmDFAlgRiRF5/YqKc3OQEoMNDhHhV6TCxefl3dCugbyTU V6o0RW4+4nAsasg2QJAn3OZ8FX+0ZUyNuTms9eQve5wzG+7tx8tETfm8HEsVCAgWv6Zk jmQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8fcxTwXDkaEKZxGuMnh1soGrArNZ2B6mZl0Rr5ORBAI=; b=rzseyITpsyW4hLyHrpEcNA9ftXvf1oGw2iKakIpD1JPjb7iHQLlzlbKEukwo2KdT98 WPuMmVdx33CBEwAtPQ+bDmB/k5RmicXUUdc7Umo28GAzIKF3ZF2QpGl3pbo1G5x/ly75 0zD7TBnhqPSegdNb3vdgBnG8WYAFNJr9567fGDN68Ucd4grjrpk2Bj8OlaY4pnVAYK90 0bkTK4pedaGZLgcqzNyzNqx4WdZvWFbv2iEMk1EmDsKlhwPV+GwJyefMDnEP7tWHxBZX 7nd0UApEl9JdpMuIS0ja+cH8lBKoxXGtyvmue8pnzNnxdqQJccKvbMYfS6MZkemGLfyA XJ0g== X-Gm-Message-State: AOAM531LpS1fLcs5pzFAzr5TI8BUmk+C1NLxsu5O31SChzx7xQ5wVtBV yN32/9ctSkTwgnOlCTKSINjT/Zk8 X-Google-Smtp-Source: ABdhPJxVimq0VmJpGR03MVPr7djPBHaL1VKFcju4+sCnWq+GKcacDaIMy6T04k/HeTuA2S0QNbNCxA== X-Received: by 2002:adf:ff8a:: with SMTP id j10mr19329848wrr.323.1595858967776; Mon, 27 Jul 2020 07:09:27 -0700 (PDT) Received: from localhost.localdomain (2a01cb058f8a18003dbee9eed79eb521.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:3dbe:e9ee:d79e:b521]) by smtp.gmail.com with ESMTPSA id z15sm12200747wrn.89.2020.07.27.07.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 07:09:27 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Mon, 27 Jul 2020 16:09:22 +0200 Message-Id: <20200727140922.2614959-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Subject: [Buildroot] [PATCHv3] package/bat: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , David Pierret , Romain Naour Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: David Pierret bat is a cat(1) clone with syntax highlighting and Git integration. This package need rust version 1.37.0 or later Using the Aarch64 ARM toolchain that use the prefix "aarch64-none-linux-gnu-", we need to set CC_aarch64_unknown_linux_gnu in the environment to provide the right toolchain prefix. Otherwise the build fail because rust use aarch64-unknown-linux-gnu as default toolchain prefix. Since we set CC_aarch64_unknown_linux_gnu, convert RUSTC_TARGET_NAME aarch64-unknown-linux-gnu to aarch64_unknown_linux_gnu since bash doesn't allow to minus characters in environement variables. See for all supported toolchain prefix: https://github.com/rust-lang/rust/blob/52d2c7ac948d6abdc18eb9e05a53d03ddcaffd98/src/librustc_target/spec/mod.rs#L492 Signed-off-by: David Pierret Signed-off-by: Romain Naour [Romain: Use CC_$(RUSTC_TARGET_NAME)] Signed-off-by: Romain Naour ---- bat supports syntax highlighting for a large number of programming and markup languages. He can communicates with git to show modifications with respect to the index. For conveignance use, bat can pipe its own output to less if the output is too large for one screen. v3: remove "env" and use CC_$(subst -,_,$(RUSTC_TARGET_NAME)) instead of CC_$(RUSTC_TARGET_NAME) v1 -> v2 Add selection of less out of busybox for command line option compatibility --- DEVELOPERS | 3 +++ package/Config.in | 1 + package/bat/Config.in | 13 +++++++++++++ package/bat/bat.hash | 4 ++++ package/bat/bat.mk | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+) create mode 100644 package/bat/Config.in create mode 100644 package/bat/bat.hash create mode 100644 package/bat/bat.mk diff --git a/DEVELOPERS b/DEVELOPERS index ee840dbb8b..62af154af9 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -680,6 +680,9 @@ F: linux/linux-ext-ev3dev-linux-drivers.mk F: package/brickd/ F: package/ev3dev-linux-drivers/ +N: David Pierret +F: package/bat/ + N: Davide Viti F: board/friendlyarm/nanopi-r1/ F: configs/nanopi_r1_defconfig diff --git a/package/Config.in b/package/Config.in index 5c30d27b7a..d713c73092 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2427,6 +2427,7 @@ menu "System tools" endmenu menu "Text editors and viewers" + source "package/bat/Config.in" source "package/ed/Config.in" source "package/joe/Config.in" source "package/less/Config.in" diff --git a/package/bat/Config.in b/package/bat/Config.in new file mode 100644 index 0000000000..33a33673a8 --- /dev/null +++ b/package/bat/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_BAT + bool "bat" + depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS + select BR2_PACKAGE_HOST_RUSTC + # we need a full version of less + select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + # less needs ncurses + select BR2_PACKAGE_NCURSES + select BR2_PACKAGE_LESS + help + A cat(1) clone with syntax highlighting and Git integration. + + https://github.com/sharkdp/bat diff --git a/package/bat/bat.hash b/package/bat/bat.hash new file mode 100644 index 0000000000..14438b8a6f --- /dev/null +++ b/package/bat/bat.hash @@ -0,0 +1,4 @@ +# Locally generated +sha256 f4aee370013e2a3bc84c405738ed0ab6e334d3a9f22c18031a7ea008cd5abd2a bat-0.13.0.tar.gz +sha256 c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE-APACHE +sha256 dc931b3f4376dc2b12486ded9f51487719099074587d757ea6125bb59deeb221 LICENSE-MIT diff --git a/package/bat/bat.mk b/package/bat/bat.mk new file mode 100644 index 0000000000..994a268bf6 --- /dev/null +++ b/package/bat/bat.mk @@ -0,0 +1,37 @@ +################################################################################ +# +# bat +# +################################################################################ + +BAT_VERSION = 0.13.0 +BAT_SITE = $(call github,sharkdp,bat,v$(BAT_VERSION)) +BAT_LICENSE = Apache-2.0 or MIT +BAT_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT +BAT_DEPENDENCIES = host-rustc + +BAT_CFLAGS = $(TARGET_CFLAGS) + +BAT_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo +BAT_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release) + +BAT_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(BAT_CARGO_MODE) + +BAT_CARGO_OPTS = \ + --bins \ + --$(BAT_CARGO_MODE) \ + --target=$(RUSTC_TARGET_NAME) \ + --manifest-path=$(@D)/Cargo.toml + +define BAT_BUILD_CMDS + $(TARGET_MAKE_ENV) $(BAT_CARGO_ENV) \ + CC_$(subst -,_,$(RUSTC_TARGET_NAME))=$(TARGET_CC) \ + cargo build $(BAT_CARGO_OPTS) +endef + +define BAT_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/$(BAT_BIN_DIR)/bat \ + $(TARGET_DIR)/usr/bin/bat +endef + +$(eval $(generic-package))