Skip to contentSkip to conversation

duktape: new package

PATCH Superseded Fabrice Fontaine 3 participants 5 messages Nov 3, 2017 – Dec 3, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 duktape: new package

Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint.

Duktape is easy to integrate into a C/C++ project: add duktape.c, duktape.h, and duk_config.h to your build, and use the Duktape API to call Ecmascript functions from C code and vice versa.

http://www.duktape.org

---
 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 package/duktape/0001-Replace-gcc-by-CC.patch       | 46 +++++++++++++++
 ...0002-Don-t-copy-headers-in-install-target.patch | 28 ++++++++++
 package/duktape/Config.in                          | 11 ++++
 package/duktape/duktape.hash                       |  3 +
 package/duktape/duktape.mk                         | 65 ++++++++++++++++++++++
 7 files changed, 155 insertions(+)
 create mode 100644 package/duktape/0001-Replace-gcc-by-CC.patch
 create mode 100644 package/duktape/0002-Don-t-copy-headers-in-install-target.patch
 create mode 100644 package/duktape/Config.in
 create mode 100644 package/duktape/duktape.hash
 create mode 100644 package/duktape/duktape.mk
DEVELOPERS +1 -0
index 154a3a784..446ec2dc3 100644
@@ -587,6 +587,7 @@ F:	package/alljoyn-base/
 F:	package/alljoyn-tcl/
 F:	package/alljoyn-tcl-base/
 F:	package/boinc/
+F:	package/duktape/
 F:	package/gtksourceview/
 F:	package/gssdp/
 F:	package/gupnp/
package/Config.in +1 -0
index ce389ce6a..421b6635f 100644
@@ -1211,6 +1211,7 @@ menu "External AngularJS plugins"
 endmenu
 endif
 	source "package/bootstrap/Config.in"
+	source "package/duktape/Config.in"
 	source "package/explorercanvas/Config.in"
 	source "package/flot/Config.in"
 	source "package/jquery/Config.in"
package/duktape/0001-Replace-gcc-by-CC.patch new file +46 -0

46 lines not on this page · raw message

package/duktape/0002-Don-t-copy-headers-in-install-target.patch new file +28 -0
new file mode 100644
index 000000000..391a89f6d
@@ -0,0 +1,28 @@
+From e5e839b96332229a860424b451fe3d678ff2d0f2 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Fri, 3 Nov 2017 20:10:41 +0100
+Subject: [PATCH] Don't copy headers in install target
+
+Don't copy headers in install target to be able to use this Makefile to
+install duktape library in staging and target directory
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ Makefile.sharedlibrary | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Makefile.sharedlibrary b/Makefile.sharedlibrary
+index 9a110aa..dfc63f3 100644
+--- a/Makefile.sharedlibrary
++++ b/Makefile.sharedlibrary
+@@ -63,7 +63,6 @@ install: libduktape.so.$(REAL_VERSION) libduktaped.so.$(REAL_VERSION)
+ 	rm -f $(INSTALL_PREFIX)/lib/libduktaped.so $(INSTALL_PREFIX)/lib/libduktaped.so.$(SONAME_VERSION)
+ 	ln -s libduktaped.so.$(REAL_VERSION) $(INSTALL_PREFIX)/lib/libduktaped.so
+ 	ln -s libduktaped.so.$(REAL_VERSION) $(INSTALL_PREFIX)/lib/libduktaped.so.$(SONAME_VERSION)
+-	cp $(DUKTAPE_SRCDIR)/duktape.h $(DUKTAPE_SRCDIR)/duk_config.h $(INSTALL_PREFIX)/include/
+ 
+ # Note: assumes /usr/local/include/ and /usr/local/lib/ are in include/link
+ # path which may not be the case for all distributions.
+-- 
+2.14.1
+
package/duktape/Config.in new file +11 -0
new file mode 100644
index 000000000..b422afb58
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_DUKTAPE
+	bool "duktape"
+	help
+	  Duktape is an embeddable Javascript engine, with a focus on
+	  portability and compact footprint.
+
+	  Duktape is easy to integrate into a C/C++ project: add duktape.c,
+	  duktape.h, and duk_config.h to your build, and use the Duktape API
+	  to call Ecmascript functions from C code and vice versa.
+
+	  http://www.duktape.org
package/duktape/duktape.hash new file +3 -0
new file mode 100644
index 000000000..37eb942e6
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256	794805992a5bf6d47c3f244bb1df41c528f4a1f2d1e2f81dfa33f0920ab016ef	duktape-v2.2.0.tar.gz
+sha256	5358498534dac625c89a69c10becf3dcc40f9af58e6b69ee358ebdf6934f49c6	LICENSE.txt
package/duktape/duktape.mk new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 duktape: new package

Hello,

Thanks for this new contribution!

package/duktape/0002-Don-t-copy-headers-in-install-target.patch line 7

Quoted 13 lines · Fabrice Fontaine
package/duktape/0002-Don-t-copy-headers-in-install-target.patch new file +7 -0
new file mode 100644
index 000000000..391a89f6d
@@ -0,0 +1,28 @@
+From e5e839b96332229a860424b451fe3d678ff2d0f2 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Fri, 3 Nov 2017 20:10:41 +0100
+Subject: [PATCH] Don't copy headers in install target
+
+Don't copy headers in install target to be able to use this Makefile to
+install duktape library in staging and target directory

I'm not sure what you're trying to do here. Install headers to $(TARGET_DIR) is perfectly fine, they get cleaned up at the end of the build during the target-finalize step. Essentially all libraries install everything to $(TARGET_DIR): headers, static library, shared library, pkg-config files, documentation, and what is not needed on the target gets cleaned up by the logic in target-finalize.

We don't want to hack each and every package so that it doesn't install its headers or static library to $(TARGET_DIR). We very much prefer to use the existing "make install" logic of packages, and have a common, shared, logic in target-finalize to do the cleanup.

Or did I miss the purpose of this particular patch?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 duktape: new package

Dear Thomas,

Thanks for this quick review.

2017-11-03 22:35 GMT+01:00 Thomas Petazzoni <
[email protected]>:

Quoted 28 lines

Hello,

Thanks for this new contribution!

Review

Quoted 1 line · Fabrice Fontaine
(quoted diff) +0 -0

b/package/duktape/0002-Don-t-copy-headers-in-install-target.patch

package/duktape/0002-Don-t-copy-headers-in-install-target.patch line 7

Quoted 12 lines

new file mode 100644
index 000000000..391a89f6d

package/duktape/0002-Don-t-copy-headers-in-install-target.patch new file +7 -0
@@ -0,0 +1,28 @@
+From e5e839b96332229a860424b451fe3d678ff2d0f2 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Fri, 3 Nov 2017 20:10:41 +0100
+Subject: [PATCH] Don't copy headers in install target
+
+Don't copy headers in install target to be able to use this Makefile to
+install duktape library in staging and target directory

I'm not sure what you're trying to do here. Install headers to $(TARGET_DIR) is perfectly fine, they get cleaned up at the end of the build during the target-finalize step. Essentially all libraries install everything to $(TARGET_DIR): headers, static library, shared library, pkg-config files, documentation, and what is not needed on the target gets cleaned up by the logic in target-finalize.

Quoted 7 lines

We don't want to hack each and every package so that it doesn't install its headers or static library to $(TARGET_DIR). We very much prefer to use the existing "make install" logic of packages, and have a common, shared, logic in target-finalize to do the cleanup.

Or did I miss the purpose of this particular patch?

The issue with the original Makefile is that it tries to copy the two header files in $(TARGET_DIR)/usr/include which does not exist so I had several choices:
- create this directory in duktape.mk
- add "-a" option to the cp in the original Makefile
- remove the cp

I chose the third option but I can go with the first or second one. Which one do you prefer?

Quoted 9 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Best Regards,

Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171103/bde32727/attachment.html>

#3 lore raw

PATCH 1/1 duktape: new package

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Hi,

Quoted 5 lines

The issue with the original Makefile is that it tries to copy the two header files in $(TARGET_DIR)/usr/include which does not exist so I had several choices:
- create this directory in duktape.mk
- add "-a" option to the cp in the original Makefile

But cp -a doesn't create missing directories?

Quoted 4 lines

- remove the cp

I chose the third option but I can go with the first or second one. Which one do you prefer?

I would prefer to see a mkdir -p to ensure the directory exists and/or using install -D to copy the files, as such patches should be acceptable upstream.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 duktape: new package

In reply to Fabrice Fontaine

Hello,

Quoted 10 lines · Fabrice Fontaine

Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint.

Duktape is easy to integrate into a C/C++ project: add duktape.c, duktape.h, and duk_config.h to your build, and use the Duktape API to call Ecmascript functions from C code and vice versa.

http://www.duktape.org

In addition to the comments already made by Peter and me, I have one more comment below.

Quoted 6 lines
package/duktape/duktape.mk new file +6 -0
+# For static library, nothing is provided by duktape so build and install it
+ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
+define DUKTAPE_BUILD_STATIC
+	$(TARGET_CC) $(TARGET_CFLAGS) -c $(@D)/src/duktape.c \
+		-o $(@D)/libduktape.a
+	$(TARGET_CC) $(TARGET_CFLAGS) -g -c $(@D)/src/duktape.c \

package/duktape/duktape.mk line 45

Quoted 10 lines
package/duktape/duktape.mk new file +10 -0
+		-o $(@D)/libduktaped.a
+endef
+
+define DUKTAPE_INSTALL_STATIC
+	$(INSTALL) -m 0644 -D $(@D)/libduktape.a \
+		$(STAGING_DIR)/usr/lib/libduktape.a
+	$(INSTALL) -m 0644 -D $(@D)/libduktaped.a \
+		$(STAGING_DIR)/usr/lib/libduktaped.a
+endef
+endif

Is duktape build system doesn't support building/installing a static library, then just don't support it (or submit a patch upstream to add that support). In the mean time, make the package depends on !BR2_STATIC_LIBS and just don't support static library building.

I'll mark your patch as Changes Requested in patchwork.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com