Skip to contentSkip to conversation

Add configuration item for custom JavaScript install path

RFC PATCH New spdawson at gmail.com 2 participants 6 messages Jun 19, 2012 – Jun 28, 2012

lore
Share & tools
lore
#0 lore raw

cover Add configuration item for custom JavaScript install path

From: Simon Dawson <[email protected]>

JavaScript files are installed by convention into /var/www in the target filesystem. This is inflexible, and not appropriate to all use cases.

This patch series adds a Buildroot-wide configuration item to allow the JavaScript install path to be customised; the path will be /var/www by default.

Simon Dawson (2):
Add configuration item for custom JavaScript install path Use JavaScript install path from configuration during package
installation

 package/Config.in                              |    1 +
 package/explorercanvas/explorercanvas.mk       |    4 ++--
 package/flot/flot.mk                           |    4 ++--
 package/javascript/Config.in                   |    5 +++++
 package/jquery-sparkline/jquery-sparkline.mk   |    4 ++--
 package/jquery-validation/jquery-validation.mk |    4 ++--
 package/jquery/jquery.mk                       |    4 ++--
 7 files changed, 16 insertions(+), 10 deletions(-)
 create mode 100644 package/javascript/Config.in
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/2 Add configuration item for custom JavaScript install path

From: Simon Dawson <[email protected]>

---
 package/Config.in            |    1 +
 package/javascript/Config.in |    5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 package/javascript/Config.in
package/Config.in +1 -0
index 1044e9f..b60ba2b 100644
@@ -378,6 +378,7 @@ source "package/libv4l/Config.in"
 endmenu
 
 menu "Javascript"
+source "package/javascript/Config.in"
 source "package/explorercanvas/Config.in"
 source "package/flot/Config.in"
 source "package/jquery/Config.in"
package/javascript/Config.in new file +5 -0
new file mode 100644
index 0000000..c837e9e
@@ -0,0 +1,5 @@
+config BR2_JAVASCRIPT_INSTALL_PATH
+	string "Target install path for JavaScript"
+	default "/var/www"
+	help
+	  Specify a target install path for JavaScript files
Signature · 1 line
1.7.9.5
#2 lore raw

RFC PATCH 1/2 Add configuration item for custom JavaScript install path

Quoted 27 lines · spdawson at gmail.com

From: Simon Dawson<[email protected]>

---
  package/Config.in            |    1 +
  package/javascript/Config.in |    5 +++++
  2 files changed, 6 insertions(+)

create mode 100644 package/javascript/Config.in

package/Config.in +1 -0
index 1044e9f..b60ba2b 100644
@@ -378,6 +378,7 @@ source "package/libv4l/Config.in"
  endmenu
 
  menu "Javascript"
+source "package/javascript/Config.in"
  source "package/explorercanvas/Config.in"
  source "package/flot/Config.in"
  source "package/jquery/Config.in"
package/javascript/Config.in new file +0 -0
new file mode 100644
index 0000000..c837e9e

package/javascript/Config.in line 5

Quoted 5 lines
package/javascript/Config.in new file +5 -0
@@ -0,0 +1,5 @@
+config BR2_JAVASCRIPT_INSTALL_PATH
+	string "Target install path for JavaScript"
+	default "/var/www"
+	help
+	  Specify a target install path for JavaScript files

I would instead define a WWW_INSTALL_PATH, which can also be used to set the
wwwroot of the various http servers. We could still have a javascript path to point to a subdirectory of the wwwroot, but I don't think there's much point.

Question is where this config option should go then. We could put it next to
the webservers, but it is possible that you use some javascript libraries without webserver (e.g. because it's custom-written in another application). We could also put it in target/generic/Config.in, but there's currently nothing similar there...

BTW personally, I'm in favour of defaulting to /www for this path instead of
/var/www. However, the Linux Foundation's draft Filesystem Hierarchy Standard [1] puts it at /srv/www. Sounds even better to me, but it's a big change from our current layout.

Regards,
Arnout

[1] http://bzr.linuxfoundation.org/loggerhead/lsb/devel/fhs-spec/annotate/head:/root-filesystem.xml#L1700

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

RFC PATCH 1/2 Add configuration item for custom JavaScript install path

Thanks for the feedback Arnout.

Quoted 2 lines · Arnout Vandecappelle

?I would instead define a WWW_INSTALL_PATH, which can also be used to set the wwwroot of the various http servers.

It's a good idea, but I don't know quite how it would be achieved cleanly. A quick grep through Buildroot reveals the following potential problem files.

* package/boa/boa.conf
* package/tinyhttpd/S85tinyhttpd
* package/tinyhttpd/tinyhttpd.patch

The configuration files could be fixed up during installation of the relevant packages, but the httpd patch is more of a problem.

Does anyone have a suggestion for how to deal with this?

Simon.

#4 lore raw

RFC PATCH 1/2 Add configuration item for custom JavaScript install path

Quoted 10 lines · Simon Dawson

Thanks for the feedback Arnout.

Quoted 2 lines · Arnout Vandecappelle

I would instead define a WWW_INSTALL_PATH, which can also be used to set
the wwwroot of the various http servers.

It's a good idea, but I don't know quite how it would be achieved cleanly. A quick grep through Buildroot reveals the following potential problem files.

Quoted 8 lines

* package/boa/boa.conf
* package/tinyhttpd/S85tinyhttpd
* package/tinyhttpd/tinyhttpd.patch

The configuration files could be fixed up during installation of the relevant packages, but the httpd patch is more of a problem.

Does anyone have a suggestion for how to deal with this?

  Add -DWWW_INSTALL_PATH='"$(WWW_INSTALL_PATH)"' to CFLAGS.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

RFC PATCH 2/2 Use JavaScript install path from configuration during package installation

In reply to spdawson at gmail.com

From: Simon Dawson <[email protected]>

---
 package/explorercanvas/explorercanvas.mk       |    4 ++--
 package/flot/flot.mk                           |    4 ++--
 package/jquery-sparkline/jquery-sparkline.mk   |    4 ++--
 package/jquery-validation/jquery-validation.mk |    4 ++--
 package/jquery/jquery.mk                       |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
package/explorercanvas/explorercanvas.mk +2 -2
index 93dcb1f..e099faa 100644
@@ -8,11 +8,11 @@ endef
 
 define EXPLORERCANVAS_INSTALL_TARGET_CMDS
 	$(INSTALL) -D $(@D)/excanvas.compiled.js \
-		$(TARGET_DIR)/var/www/excanvas.js
+		$(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/excanvas.js
 endef
 
 define EXPLORERCANVAS_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/excanvas.js
+	rm -f $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/excanvas.js
 endef
 
 $(eval $(call GENTARGETS))
package/flot/flot.mk +2 -2
index 8b51b55..3d6987e 100644
@@ -12,12 +12,12 @@ FLOT_FILES = jquery.flot $(addprefix jquery.flot.,\
 
 define FLOT_INSTALL_TARGET_CMDS
 	for i in $(FLOT_FILES); do \
-		$(INSTALL) -m 0644 -D $(@D)/$$i.min.js $(TARGET_DIR)/var/www/$$i.js; \
+		$(INSTALL) -m 0644 -D $(@D)/$$i.min.js $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/$$i.js; \
 	done
 endef
 
 define FLOT_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/jquery.flot*
+	rm -f $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.flot*
 endef
 
 $(eval $(call GENTARGETS))
package/jquery-sparkline/jquery-sparkline.mk +2 -2
index d0b478a..3ef1dc7 100644
@@ -8,11 +8,11 @@ endef
 
 define JQUERY_SPARKLINE_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0644 -D $(@D)/$(JQUERY_SPARKLINE_SOURCE) \
-		$(TARGET_DIR)/var/www/jquery.sparkline.js
+		$(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.sparkline.js
 endef
 
 define JQUERY_SPARKLINE_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/jquery.sparkline.js
+	rm -f $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.sparkline.js
 endef
 
 $(eval $(call GENTARGETS))
package/jquery-validation/jquery-validation.mk +2 -2
index 5fee4c1..ccf1155 100644
@@ -8,11 +8,11 @@ endef
 
 define JQUERY_VALIDATION_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0644 -D $(@D)/jquery.validate.min.js \
-		$(TARGET_DIR)/var/www/jquery.validate.js
+		$(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.validate.js
 endef
 
 define JQUERY_VALIDATION_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/jquery.validate.js
+	rm -f $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.validate.js
 endef
 
 $(eval $(call GENTARGETS))
package/jquery/jquery.mk +2 -2
index 08dd4a3..93d8eab 100644
@@ -8,11 +8,11 @@ endef
 
 define JQUERY_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0644 -D $(@D)/$(JQUERY_SOURCE) \
-		$(TARGET_DIR)/var/www/jquery.js
+		$(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.js
 endef
 
 define JQUERY_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/jquery.js
+	rm -f $(TARGET_DIR)/$(BR2_JAVASCRIPT_INSTALL_PATH)/jquery.js
 endef
 
 $(eval $(call GENTARGETS))
Signature · 1 line
1.7.9.5