diff mbox series

package/quickjs: new package

Message ID 20201018111125.899134-1-francois.perrad@gadz.org
State Changes Requested
Headers show
Series package/quickjs: new package | expand

Commit Message

Francois Perrad Oct. 18, 2020, 11:11 a.m. UTC
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/Config.in            |  1 +
 package/quickjs/Config.in    |  9 +++++++++
 package/quickjs/quickjs.hash |  2 ++
 package/quickjs/quickjs.mk   | 37 ++++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+)
 create mode 100644 package/quickjs/Config.in
 create mode 100644 package/quickjs/quickjs.hash
 create mode 100644 package/quickjs/quickjs.mk

Comments

Thomas Petazzoni Oct. 25, 2020, 10:01 a.m. UTC | #1
Hello François,

Thanks for this contribution!

On Sun, 18 Oct 2020 13:11:25 +0200
Francois Perrad <fperrad@gmail.com> wrote:

> +config BR2_PACKAGE_QUICKJS
> +	bool "quickjs"

It really has no dependencies at all on toolchain features ?

For example, here it fails to build with:

quickjs.c:33:18: fatal error: fenv.h: No such file or directory

with the following defconfig:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2020.02.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_QUICKJS=y
# BR2_TARGET_ROOTFS_TAR is not set

I also see it is using fork(), which probably indicates it needs a
BR2_USE_MMU dependency.

> +define QUICKJS_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		CROSS_PREFIX="$(TARGET_CROSS)" \
> +		all
> +endef
> +
> +define QUICKJS_INSTALL_STAGING_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		CROSS_PREFIX="$(TARGET_CROSS)" \
> +		DESTDIR=$(STAGING_DIR) \
> +		STRIP=true \

Please disable stripping here.

> +		prefix=/usr \
> +		install
> +endef
> +
> +define QUICKJS_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		CROSS_PREFIX="$(TARGET_CROSS)" \
> +		DESTDIR=$(TARGET_DIR) \
> +		STRIP=true \

... and here.

Indeed, we want stripping to be done by Buildroot.

Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index d7e79f479..f64b68d38 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1225,6 +1225,7 @@  menu "External python modules"
 	source "package/python-zope-interface/Config.in"
 endmenu
 endif
+	source "package/quickjs/Config.in"
 	source "package/ruby/Config.in"
 	source "package/tcl/Config.in"
 if BR2_PACKAGE_TCL
diff --git a/package/quickjs/Config.in b/package/quickjs/Config.in
new file mode 100644
index 000000000..e5675ad14
--- /dev/null
+++ b/package/quickjs/Config.in
@@ -0,0 +1,9 @@ 
+
+config BR2_PACKAGE_QUICKJS
+	bool "quickjs"
+	help
+	  QuickJS is a small and embeddable Javascript engine.
+	  It supports the ES2020 specification including modules,
+	  asynchronous generators, proxies and BigInt.
+
+	  https://bellard.org/quickjs/
diff --git a/package/quickjs/quickjs.hash b/package/quickjs/quickjs.hash
new file mode 100644
index 000000000..076e4bddb
--- /dev/null
+++ b/package/quickjs/quickjs.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  0021a3e8cdc6b61e225411d05e2841d2437e1ccf4b4cabb9a5f7685ebfb57717  quickjs-2020-09-06.tar.xz
diff --git a/package/quickjs/quickjs.mk b/package/quickjs/quickjs.mk
new file mode 100644
index 000000000..af35dba62
--- /dev/null
+++ b/package/quickjs/quickjs.mk
@@ -0,0 +1,37 @@ 
+################################################################################
+#
+# quickjs
+#
+################################################################################
+
+QUICKJS_VERSION = 2020-09-06
+QUICKJS_SOURCE = quickjs-$(QUICKJS_VERSION).tar.xz
+QUICKJS_SITE = https://bellard.org/quickjs
+QUICKJS_LICENSE = MIT
+QUICKJS_INSTALL_STAGING = YES
+
+define QUICKJS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		CROSS_PREFIX="$(TARGET_CROSS)" \
+		all
+endef
+
+define QUICKJS_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		CROSS_PREFIX="$(TARGET_CROSS)" \
+		DESTDIR=$(STAGING_DIR) \
+		STRIP=true \
+		prefix=/usr \
+		install
+endef
+
+define QUICKJS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		CROSS_PREFIX="$(TARGET_CROSS)" \
+		DESTDIR=$(TARGET_DIR) \
+		STRIP=true \
+		prefix=/usr \
+		install
+endef
+
+$(eval $(generic-package))