diff mbox

jquery: allow custom install location

Message ID 1339681388-13133-1-git-send-email-spdawson@gmail.com
State Rejected
Headers show

Commit Message

Simon Dawson June 14, 2012, 1:43 p.m. UTC
From: Simon Dawson <spdawson@gmail.com>

Allow the JavaScript install path to be customised. By default, JavaScript files
are installed to /var/www under the target root directory.

Signed-off-by: Simon Dawson <spdawson@gmail.com>
---
 package/jquery/Config.in |    7 +++++++
 package/jquery/jquery.mk |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Peter Korsgaard June 17, 2012, 5:47 p.m. UTC | #1
>>>>> "spdawson" == spdawson  <spdawson@gmail.com> writes:

 spdawson> From: Simon Dawson <spdawson@gmail.com>

 spdawson> Allow the JavaScript install path to be customised. By
 spdawson> default, JavaScript files are installed to /var/www under the
 spdawson> target root directory.

What's the use case for this? If we need it, wouldn't it then make more
sense to have a BR-wide setting for this instead of for each webrelated
package?
Simon Dawson June 17, 2012, 6:15 p.m. UTC | #2
> What's the use case for this? If we need it, wouldn't it then make more
> sense to have a BR-wide setting for this instead of for each webrelated
> package?

Installing JavaScript files into the hard-coded /var/www directory
isn't always appropriate. For example, I am working on a project at
the moment where /var is mounted as tmpfs, and I don't want any
persistent data there. It's also not uncommon to structure things so
that JavaScript files are in a subdirectory of the main /www or
/var/www "web root" directory.

Does that make sense?

I totally agree with you about adding a Buildroot-wide configuration
item for this, and probably also a similar configuration item to allow
for a custom css install path.
diff mbox

Patch

diff --git a/package/jquery/Config.in b/package/jquery/Config.in
index 92f5604..e811d48 100644
--- a/package/jquery/Config.in
+++ b/package/jquery/Config.in
@@ -6,3 +6,10 @@  config BR2_PACKAGE_JQUERY
 	  animating, and Ajax interactions for rapid web development.
 
 	  http://jquery.com
+
+config BR2_PACKAGE_JQUERY_JAVASCRIPT_PATH
+	string "Target install path for JavaScript"
+	default "/var/www"
+	depends on BR2_PACKAGE_JQUERY
+	help
+	  Specify a target install path for JavaScript files
diff --git a/package/jquery/jquery.mk b/package/jquery/jquery.mk
index 08dd4a3..a4c31a8 100644
--- a/package/jquery/jquery.mk
+++ b/package/jquery/jquery.mk
@@ -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_PACKAGE_JQUERY_JAVASCRIPT_PATH)/jquery.js
 endef
 
 define JQUERY_UNINSTALL_TARGET_CMDS
-	rm -f $(TARGET_DIR)/var/www/jquery.js
+	rm -f $(TARGET_DIR)/$(BR2_PACKAGE_JQUERY_JAVASCRIPT_PATH)/jquery.js
 endef
 
 $(eval $(call GENTARGETS))