All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] new host-composer package patches series
@ 2023-01-19 13:28 carrier.nicolas0
  2023-01-19 13:28 ` [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package carrier.nicolas0
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: carrier.nicolas0 @ 2023-01-19 13:28 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Nicolas Carrier, Fabrice Fontaine, Thomas Petazzoni

From: Nicolas Carrier <carrier.nicolas0@gmail.com>

This patch series introduces a new host package for composer.
This package requires the creation of a host-php package, which in turn, needs
a host-oniguruma package.

Composer is a tool used to deploy and handle dependencies of php web sites and
is used in particular, by the CakePHP framework.

In order to test this patch series up to the creation of a working minimal
system, able to serve a test CakePHP website, a hello-world can be created this
way:


################################################################################
#
# hello-world
#
################################################################################

HELLO_WORLD_DEPENDENCIES += \
	php \
	host-php \
	host-composer

define HELLO_WORLD_INSTALL_TARGET_CMDS
	cd $(@D) && rm -rf hello-world && \
		$(HOST_DIR)/bin/php $(HOST_DIR)/bin/composer create-project \
		--ignore-platform-reqs \
		--no-interaction \
		--no-dev \
		--prefer-dist cakephp/app:4.* hello-world
	mkdir -p $(TARGET_DIR)/srv/www2/
	rsync --exclude resources \
		--exclude composer.json \
		--exclude composer.lock \
		-a $(@D)/hello-world/ \
		$(TARGET_DIR)/srv/www2/hello-world/
# we disable the loading of DebugKit which isn't available and disabling the
# debug instead just won't work with such a minimal application
	sed -i "s/.*'DebugKit');//g" \
		$(TARGET_DIR)/srv/www2/hello-world/src/Application.php
endef

$(eval $(generic-package))


Then select the qemu_x86 default config:
make qemu_x86_defconfig

And the following configurations must be set:

BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_HELLO_WORLD=y
BR2_PACKAGE_PHP_SAPI_CGI=y
BR2_PACKAGE_PHP_EXT_PDO=y
BR2_PACKAGE_PHP_EXT_INTL=y
BR2_PACKAGE_PHP_EXT_MBSTRING=y
BR2_PACKAGE_PHP_EXT_FILTER=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"


Then build the image, execute it with:
qemu-system-i386 -M pc -kernel output/images/bzImage \
	-drive file=output/images/rootfs.ext2,if=virtio,format=raw \
	-append "rootwait root=/dev/vda console=tty1 console=ttyS0" \
	-serial stdio -net nic,model=virtio -net user

Once booted in the system, enter 'root' as the password and then:

cd /srv/www2/hello-world/
bin/cake server &
wget -O - http://localhost:8765

wget should be able to dump the landing page of the test web site.

Nicolas Carrier (3):
  package/oniguruma/oniguruma.mk: add a host package
  package/php/php.mk: add host-php
  package/composer: new package

 package/composer/composer.hash |  3 +++
 package/composer/composer.mk   | 31 +++++++++++++++++++++++++++++++
 package/oniguruma/oniguruma.mk |  1 +
 package/php/php.mk             | 19 +++++++++++++++++++
 4 files changed, 54 insertions(+)
 create mode 100644 package/composer/composer.hash
 create mode 100644 package/composer/composer.mk

-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package
  2023-01-19 13:28 [Buildroot] [PATCH 0/3] new host-composer package patches series carrier.nicolas0
@ 2023-01-19 13:28 ` carrier.nicolas0
  2023-08-01 21:05   ` Thomas Petazzoni via buildroot
  2023-01-19 13:28 ` [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php carrier.nicolas0
  2023-01-19 13:28 ` [Buildroot] [PATCH 3/3] package/composer: new package carrier.nicolas0
  2 siblings, 1 reply; 7+ messages in thread
From: carrier.nicolas0 @ 2023-01-19 13:28 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Nicolas Carrier, Fabrice Fontaine, Thomas Petazzoni

From: Nicolas Carrier <carrier.nicolas0@gmail.com>

This is needed for the creation of an host-php package

Signed-off-by: Nicolas Carrier <carrier.nicolas0@gmail.com>
---
 package/oniguruma/oniguruma.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/oniguruma/oniguruma.mk b/package/oniguruma/oniguruma.mk
index f5ac810c10..e81190c0c6 100644
--- a/package/oniguruma/oniguruma.mk
+++ b/package/oniguruma/oniguruma.mk
@@ -14,3 +14,4 @@ ONIGURUMA_CPE_ID_VENDOR = oniguruma_project
 ONIGURUMA_INSTALL_STAGING = YES
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php
  2023-01-19 13:28 [Buildroot] [PATCH 0/3] new host-composer package patches series carrier.nicolas0
  2023-01-19 13:28 ` [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package carrier.nicolas0
@ 2023-01-19 13:28 ` carrier.nicolas0
  2023-08-01 21:09   ` Thomas Petazzoni via buildroot
  2023-01-19 13:28 ` [Buildroot] [PATCH 3/3] package/composer: new package carrier.nicolas0
  2 siblings, 1 reply; 7+ messages in thread
From: carrier.nicolas0 @ 2023-01-19 13:28 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Nicolas Carrier, Fabrice Fontaine, Thomas Petazzoni

From: Nicolas Carrier <carrier.nicolas0@gmail.com>

having a working PHP with the correct version, is mandatory for executing
some PHP tools, such as composer, when building packages.

Signed-off-by: Nicolas Carrier <carrier.nicolas0@gmail.com>
---
 package/php/php.mk | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/package/php/php.mk b/package/php/php.mk
index 23dd4ba96f..bd301254d4 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -14,6 +14,24 @@ PHP_DEPENDENCIES = host-pkgconf pcre2
 PHP_LICENSE = PHP-3.01
 PHP_LICENSE_FILES = LICENSE
 PHP_CPE_ID_VENDOR = php
+
+# This host php is installed in $(HOST_DIR), as it is needed
+# to use composer.
+
+HOST_PHP_CONF_OPTS += \
+	--disable-all \
+	--without-pear \
+	--with-config-file-path=/etc \
+	--disable-phpdbg \
+	--enable-phar \
+	--enable-json \
+	--enable-filter \
+	--enable-mbstring \
+	--enable-tokenizer \
+	--with-openssl=$(HOST_DIR)/usr
+
+HOST_PHP_DEPENDENCIES += host-oniguruma host-openssl host-pkgconf
+
 PHP_CONF_OPTS = \
 	--mandir=/usr/share/man \
 	--infodir=/usr/share/info \
@@ -344,3 +362,4 @@ PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP
 PHP_CONF_ENV += CFLAGS="$(PHP_CFLAGS)" CXXFLAGS="$(PHP_CXXFLAGS)"
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] package/composer: new package
  2023-01-19 13:28 [Buildroot] [PATCH 0/3] new host-composer package patches series carrier.nicolas0
  2023-01-19 13:28 ` [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package carrier.nicolas0
  2023-01-19 13:28 ` [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php carrier.nicolas0
@ 2023-01-19 13:28 ` carrier.nicolas0
  2023-08-01 21:11   ` Thomas Petazzoni via buildroot
  2 siblings, 1 reply; 7+ messages in thread
From: carrier.nicolas0 @ 2023-01-19 13:28 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Nicolas Carrier, Fabrice Fontaine, Thomas Petazzoni

From: Nicolas Carrier <carrier.nicolas0@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@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

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package
  2023-01-19 13:28 ` [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package carrier.nicolas0
@ 2023-08-01 21:05   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-01 21:05 UTC (permalink / raw)
  To: carrier.nicolas0; +Cc: Bernd Kuhls, Fabrice Fontaine, buildroot

On Thu, 19 Jan 2023 14:28:54 +0100
carrier.nicolas0@gmail.com wrote:

> From: Nicolas Carrier <carrier.nicolas0@gmail.com>
> 
> This is needed for the creation of an host-php package
> 
> Signed-off-by: Nicolas Carrier <carrier.nicolas0@gmail.com>

Tweaked commit title as:

	package/oniguruma: add a host variant

and applied. Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php
  2023-01-19 13:28 ` [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php carrier.nicolas0
@ 2023-08-01 21:09   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-01 21:09 UTC (permalink / raw)
  To: carrier.nicolas0; +Cc: Bernd Kuhls, Fabrice Fontaine, buildroot

Hello,

On Thu, 19 Jan 2023 14:28:55 +0100
carrier.nicolas0@gmail.com wrote:

> From: Nicolas Carrier <carrier.nicolas0@gmail.com>
> 
> having a working PHP with the correct version, is mandatory for executing
> some PHP tools, such as composer, when building packages.
> 
> Signed-off-by: Nicolas Carrier <carrier.nicolas0@gmail.com>

Tweaked commit title as:

	package/php/php: add a host variant

and it should have been:

	package/php: add a host variant

but I messed up.

> diff --git a/package/php/php.mk b/package/php/php.mk
> index 23dd4ba96f..bd301254d4 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -14,6 +14,24 @@ PHP_DEPENDENCIES = host-pkgconf pcre2
>  PHP_LICENSE = PHP-3.01
>  PHP_LICENSE_FILES = LICENSE
>  PHP_CPE_ID_VENDOR = php
> +
> +# This host php is installed in $(HOST_DIR), as it is needed
> +# to use composer.

This comment was not really useful: all host packages are installed in
$(HOST_DIR). So I dropped this comment.

> +
> +HOST_PHP_CONF_OPTS += \
> +	--disable-all \
> +	--without-pear \
> +	--with-config-file-path=/etc \
> +	--disable-phpdbg \
> +	--enable-phar \
> +	--enable-json \
> +	--enable-filter \
> +	--enable-mbstring \
> +	--enable-tokenizer \
> +	--with-openssl=$(HOST_DIR)/usr
> +
> +HOST_PHP_DEPENDENCIES += host-oniguruma host-openssl host-pkgconf

I moved both of these to the bottom of the file, to have first all the
stuff related to target PHP, and the all the stuff related to host PHP.

I replaced the += by = signs, since these assignments are not within
conditions.

I was also puzzled by the discrepancy in dependencies between target
and host PHP:

- target PHP depends on host-pkgconf and pcre2
- your host PHP proposal depends on host-onigurama host-openssl and host-pkgconf

So I added host-pcre2 in the dependencies, and added the option
--with-external-pcre to be on par with what we're doing for the target
PHP. host-onigurama is needed for --enable-mbstring, and host-openssl
for --with-openssl.

--with-openssl=$(HOST_DIR)/usr had to be changed to
--with-openssl=$(HOST_DIR) (we no longer used a usr/ subdir, and this
line was causing a check-package warning).

--with-config-file-path=/etc was changed to
--with-config-file-path=$(HOST_DIR)/etc.

Applied with those changes. Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/composer: new package
  2023-01-19 13:28 ` [Buildroot] [PATCH 3/3] package/composer: new package carrier.nicolas0
@ 2023-08-01 21:11   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-01 21:11 UTC (permalink / raw)
  To: carrier.nicolas0; +Cc: Bernd Kuhls, Fabrice Fontaine, buildroot

Hello Nicolas,

On Thu, 19 Jan 2023 14:28:56 +0100
carrier.nicolas0@gmail.com wrote:

> From: Nicolas Carrier <carrier.nicolas0@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@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

Actually hashes are available at https://getcomposer.org/download/.

> +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

I have bumped to 2.5.8, because at runtime 2.0.8 was spitting out a few
warnings about usage of PHP features that are deprecated/obsolete.

I've added a Config.in.host file so that this package can be enabled as
a host package from menuconfig.

And I now realize that I forgot to add a DEVELOPERS entry, so I will do
that now.

Applied with those changes!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-01 21:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 13:28 [Buildroot] [PATCH 0/3] new host-composer package patches series carrier.nicolas0
2023-01-19 13:28 ` [Buildroot] [PATCH 1/3] package/oniguruma/oniguruma.mk: add a host package carrier.nicolas0
2023-08-01 21:05   ` Thomas Petazzoni via buildroot
2023-01-19 13:28 ` [Buildroot] [PATCH 2/3] package/php/php.mk: add host-php carrier.nicolas0
2023-08-01 21:09   ` Thomas Petazzoni via buildroot
2023-01-19 13:28 ` [Buildroot] [PATCH 3/3] package/composer: new package carrier.nicolas0
2023-08-01 21:11   ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.