[Buildroot] [PATCH 3/3] package/composer: new package
carrier.nicolas0 at gmail.com
carrier.nicolas0 at gmail.com
Thu Jan 19 13:28:56 UTC 2023
From: Nicolas Carrier <carrier.nicolas0 at gmail.com>
composer describes itself as a dependency manager for PHP, it is used
by projects such as CakePHP.
Signed-off-by: Nicolas Carrier <carrier.nicolas0 at gmail.com>
---
package/composer/composer.hash | 3 +++
package/composer/composer.mk | 31 +++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 package/composer/composer.hash
create mode 100644 package/composer/composer.mk
diff --git a/package/composer/composer.hash b/package/composer/composer.hash
new file mode 100644
index 0000000000..512f4399a8
--- /dev/null
+++ b/package/composer/composer.hash
@@ -0,0 +1,3 @@
+# Locally computed hashes, not provided by upstream
+sha256 2021f0d52b446e0efe3c548cc058ab5671fa38cdbcf814e7911c7e9d71d61538 composer-2.0.8.phar
+sha256 c8cce4b6b9729f264ffdf9296d505d63432497feeed1f586d1902b942197e024 LICENSE
diff --git a/package/composer/composer.mk b/package/composer/composer.mk
new file mode 100644
index 0000000000..5ff5644d29
--- /dev/null
+++ b/package/composer/composer.mk
@@ -0,0 +1,31 @@
+################################################################################
+#
+# composer
+#
+################################################################################
+
+COMPOSER_VERSION = 2.0.8
+COMPOSER_SOURCE = composer-$(COMPOSER_VERSION).phar
+# Here, we pass a dummy URL parameter in order to control the name the file
+# will have once downloaded.
+# Otherwise, the names will clash ifever we update the version.
+BASE_SITE = https://getcomposer.org/download/$(COMPOSER_VERSION)/composer.phar
+COMPOSER_SITE = $(BASE_SITE)?n=f/$(COMPOSER_SOURCE)
+COMPOSER_LICENSE = MIT
+COMPOSER_LICENSE_FILES = LICENSE
+
+HOST_COMPOSER_DEPENDENCIES = host-php
+
+define HOST_COMPOSER_EXTRACT_CMDS
+ cp $(HOST_COMPOSER_DL_DIR)/$(COMPOSER_SOURCE) $(@D)
+ cd $(@D); $(HOST_DIR)/bin/php <<< '<?php \
+ $$p = new Phar("$(COMPOSER_SOURCE)"); \
+ $$p->extractTo(".", "LICENSE");'
+endef
+
+define HOST_COMPOSER_INSTALL_CMDS
+ mv $(@D)/$(COMPOSER_SOURCE) $(HOST_DIR)/bin/composer
+ chmod +x $(HOST_DIR)/bin/composer
+endef
+
+$(eval $(host-generic-package))
--
2.30.2
More information about the buildroot
mailing list