From patchwork Thu Jun 18 19:43:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1312366 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=EgWIeg9S; 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 49nsn50hnpz9sR4 for ; Fri, 19 Jun 2020 05:43:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F04FE87D34; Thu, 18 Jun 2020 19:43:34 +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 Esha5HGpESRE; Thu, 18 Jun 2020 19:43:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D4F2A87C28; Thu, 18 Jun 2020 19:43:32 +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 F13DE1BF2C7 for ; Thu, 18 Jun 2020 19:43:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E3E3488A8F for ; Thu, 18 Jun 2020 19:43: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 3V2mo-5Q41rV for ; Thu, 18 Jun 2020 19:43:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id E44BB88A89 for ; Thu, 18 Jun 2020 19:43:30 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id j4so2883614plk.3 for ; Thu, 18 Jun 2020 12:43:30 -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=yrGl4qeLGXGbRkgvFURLSMF2iJRJRKQhO6lfgkQqfkQ=; b=EgWIeg9SUwCAg7G5+Cflb/Us5lQePDo9qOuZCD2EhL1GL6LpPysMt1/Hk+XmBs5qbZ HOLEA+eAFhf23O90mTxgcUQ5WpAi4bbzYKnYtVcZagPbRUTdbm0ssB35VAByXpibA0wR xmorel968dBBxepTXIt0M+h7HRwDaLpARd0ceKpsh5puG2C0vwCLbH5zEOqrmfo2xjxw V+Dqa3a+bNPTL0BXHcgUaL9cLZcn60k0g37qJPSTqnfx0p8UPFfn/VK71HBE29Bzugsz Qj+bj0Lc/WAY/tGuc6KTd6DGe5U9dsxuLHEpONqq4+nwtDoPXywbSyt1xxiIz8qL1bUQ r/Rw== 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=yrGl4qeLGXGbRkgvFURLSMF2iJRJRKQhO6lfgkQqfkQ=; b=ffu4N7bY9mkG38oNGfiCkTDfSaLZmdSthsXNh7v/FLXx/QFh/YLuzs/lgvrL/AhAug tmjeuoLofrfjF3tUd7KBdWw0UCI2HDqY26AzMsUx3XwR1G/Onujcu/XGJFz3ILQJHNFc fF6t/5KS/2syYyf0ZLrI/svzagQ8dLaQHJ9kbV8o5f7maIcgHaTgZELxtODvWrkyM4Vh NCydbIfVJaWjdt/PYekbk1fOeL1KKngu7RpBmoUr51amWQH/YPJW9QejAudqpETvfrlj cd/vZPW2HZ23T5aQNVZyCXB45Sc4fQP+AO0/2Og39RRAdmd/+j+ZnworCXKIYir3Z6f5 pfVA== X-Gm-Message-State: AOAM533h9X2A4nVhPCq5RlIvKQvu6lo7K9CT/U/JQmnE4SLjQ34rKI8q Oup3d/rG2YUUd2b9oD31N3FJV8kS X-Google-Smtp-Source: ABdhPJwHf6+/PJ0qw18vAwF0dJaJVfperUAeHaIcA4FQuRlq0HcYUjHj266EFiLIqsHVHS+cuWOU5g== X-Received: by 2002:a17:90a:ff0e:: with SMTP id ce14mr5976252pjb.65.1592509409905; Thu, 18 Jun 2020 12:43:29 -0700 (PDT) Received: from localhost.localdomain ([47.149.8.172]) by smtp.gmail.com with ESMTPSA id n4sm3168581pjt.48.2020.06.18.12.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 12:43:29 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Thu, 18 Jun 2020 12:43:27 -0700 Message-Id: <20200618194327.94076-1-aduskett@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] package/maven-bin: 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: Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting, and documentation from a central piece of information. As Maven requires Maven to build, and the Apache foundation provides a self-encompassing tarball with Maven already compiled, it is much easier to treat this package much like we do with host-openjdk-bin. Traditionally, Maven's installation directory is either usr/share/maven or /usr/lib/maven with the mvn binary symlinked to /usr/bin. This installation method keeps all of the various libraries and conf files provided in the maven tarball separated from the rest of the host directory and prevents any libraries from potentially overwriting previously installed host-package libraries. By default, Maven downloads dependency modules of a given package to ~/.m2, which goes against Buildroot being a sandbox. There are two options to change this path: 1) Hardcode a path in the provided settings.xml file to the desired location. 2) Set the path to a variable and pass the path via to Maven during runtime. Option 2 has the advantage of ensuring all the paths are relocatable. Instead of using sed on the provided settings.xml, which would be very difficult to do, as the default settings file has the localRepository variable commented out, a settings.xml file in package/maven-bin has the localRepository variable pre-set to the MAVEN_REPO_DIR environment variable. Finally, maven-bin.mk provides the MAVEN environment variable helper, which provides all of the needed variables needed to invoke Maven in a single command, making it much easier to integrate packages that need to use Maven. An example of using Maven with a package would be as such: FOO_DEPENDENCIES = host-maven-bin define FOO_BUILD_CMDS cd $(@D) && $(MAVEN) compile endef define FOO_INSTALL_TARGET_CMDS $(INSTALL) -m 755 $(@D)/target/foo.jar $(TARGET_DIR)/usr/bin/foo.jar endef Signed-off-by: Adam Duskett --- DEVELOPERS | 1 + package/maven-bin/Config.in | 13 +++++++ package/maven-bin/maven-bin.hash | 3 ++ package/maven-bin/maven-bin.mk | 36 +++++++++++++++++++ package/maven-bin/settings.xml | 61 ++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 package/maven-bin/Config.in create mode 100644 package/maven-bin/maven-bin.hash create mode 100644 package/maven-bin/maven-bin.mk create mode 100644 package/maven-bin/settings.xml diff --git a/DEVELOPERS b/DEVELOPERS index cbe6bc1856..8227ce4318 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -50,6 +50,7 @@ F: package/libsemanage/ F: package/libsepol/ F: package/libtextstyle/ F: package/libwebsockets/ +F: package/maven-bin/ F: package/mender-grubenv/ F: package/nginx-naxsi/ F: package/openjdk/ diff --git a/package/maven-bin/Config.in b/package/maven-bin/Config.in new file mode 100644 index 0000000000..95deedd371 --- /dev/null +++ b/package/maven-bin/Config.in @@ -0,0 +1,13 @@ +config BR2_PACKAGE_MAVEN_BIN + bool "maven-bin" + depends on BR2_PACKAGE_OPENJDK + help + Apache Maven is a software project management and + comprehension tool. Based on the concept of a project object + model (POM), Maven can manage a project's build, reporting and + documentation from a central piece of information. + + https://github.com/apache/maven + +comment "maven-bin needs openjdk" + depends on !BR2_PACKAGE_OPENJDK diff --git a/package/maven-bin/maven-bin.hash b/package/maven-bin/maven-bin.hash new file mode 100644 index 0000000000..3673b33573 --- /dev/null +++ b/package/maven-bin/maven-bin.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 26ad91d751b3a9a53087aefa743f4e16a17741d3915b219cf74112bf87a438c5 apache-maven-3.6.3-bin.tar.gz +sha256 8b79d3d26bfbfd31fc50b22b149c2ecd2863345abb62d15048157a6f2e774411 LICENSE diff --git a/package/maven-bin/maven-bin.mk b/package/maven-bin/maven-bin.mk new file mode 100644 index 0000000000..1bf40b7d55 --- /dev/null +++ b/package/maven-bin/maven-bin.mk @@ -0,0 +1,36 @@ +################################################################################ +# +# host-maven-bin +# +################################################################################ + +HOST_MAVEN_BIN_VERSION = 3.6.3 +HOST_MAVEN_BIN_SOURCE = apache-maven-$(HOST_MAVEN_BIN_VERSION)-bin.tar.gz +HOST_MAVEN_BIN_SITE = https://www-us.apache.org/dist/maven/maven-3/$(HOST_MAVEN_BIN_VERSION)/binaries +HOST_MAVEN_BIN_LICENSE = Apache-2.0 +HOST_MAVEN_BIN_LICENSE_FILES = LICENSE +HOST_MAVEN_BIN_DEPENDENCIES = host-openjdk-bin + +# Maven is traditionally installed in it's own seperate directory in either +# usr/share/maven or /usr/lib/maven with the mvn binary symlinked to /usr/bin. +define HOST_MAVEN_BIN_INSTALL_CMDS + mkdir -p $(HOST_DIR)/usr/lib/maven + mkdir -p $(HOST_DIR)/bin + cp -dprf $(@D)/* $(HOST_DIR)/usr/lib/maven/ + ln -sf $(HOST_DIR)/usr/lib/maven/bin/mvn $(HOST_DIR)/bin/mvn + +# The settings.xml file sets the localRepository directory to the +# MAVEN_REPO_DIR environment variable. + $(INSTALL) -D -m 755 $(HOST_MAVEN_BIN_PKGDIR)/settings.xml \ + $(HOST_DIR)/usr/lib/maven/conf/settings.xml +endef + +$(eval $(host-generic-package)) + +# variables used by other packages +MAVEN = \ + JAVA_HOME="$(HOST_DIR)/usr/lib/jvm" \ + M2_HOME="$(HOST_DIR)/usr/lib/maven" \ + MAVEN_HOME="$(HOST_DIR)/usr/lib/maven" \ + MAVEN_REPO_DIR="$(BR2_DL_DIR)/maven-repo" \ + $(HOST_DIR)/bin/mvn diff --git a/package/maven-bin/settings.xml b/package/maven-bin/settings.xml new file mode 100644 index 0000000000..950ceab907 --- /dev/null +++ b/package/maven-bin/settings.xml @@ -0,0 +1,61 @@ + + + + + + + + ${MAVEN_REPO_DIR} + + + + + + + + + + +