diff mbox

[1/1] angularjs: new package.

Message ID 1437129876-5158-1-git-send-email-ignacy.gawedzki@green-communications.fr
State Changes Requested
Headers show

Commit Message

Ignacy Gawędzki July 17, 2015, 10:44 a.m. UTC
Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
---
 package/Config.in              |  1 +
 package/angularjs/Config.in    | 60 ++++++++++++++++++++++++++++++++++++++++++
 package/angularjs/angularjs.mk | 41 +++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 package/angularjs/Config.in
 create mode 100644 package/angularjs/angularjs.mk

Comments

Maxime Hadjinlian July 18, 2015, 3:58 p.m. UTC | #1
Hi Ignacy, all

On Fri, Jul 17, 2015 at 12:44 PM, Ignacy Gawędzki
<ignacy.gawedzki@green-communications.fr> wrote:
> Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
> ---
>  package/Config.in              |  1 +
>  package/angularjs/Config.in    | 60 ++++++++++++++++++++++++++++++++++++++++++
>  package/angularjs/angularjs.mk | 41 +++++++++++++++++++++++++++++
>  3 files changed, 102 insertions(+)
>  create mode 100644 package/angularjs/Config.in
>  create mode 100644 package/angularjs/angularjs.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 86a53c8..a8c16ac 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -866,6 +866,7 @@ menu "Hardware handling"
>  endmenu
>
>  menu "Javascript"
> +       source "package/angularjs/Config.in"
>         source "package/bootstrap/Config.in"
>         source "package/explorercanvas/Config.in"
>         source "package/flot/Config.in"
> diff --git a/package/angularjs/Config.in b/package/angularjs/Config.in
> new file mode 100644
> index 0000000..38fb56f
> --- /dev/null
> +++ b/package/angularjs/Config.in
> @@ -0,0 +1,60 @@
> +config BR2_PACKAGE_ANGULARJS
> +       bool "AngularJS"
> +       help
> +         AngularJS web application framework.
> +
> +         http://angularjs.org
> +
> +if BR2_PACKAGE_ANGULARJS
> +
> +menuconfig BR2_ANGULARJS_MODULES
> +       bool "Select AngularJS modules"
> +
> +       help
> +         Select which modules to install, instead of installing all of them.
The phrasing seems a bit wrong to me here, but I'm no english expert.
Maybe stop at "Select modules to install." ?
> +
> +if BR2_ANGULARJS_MODULES
> +
> +config BR2_ANGULARJS_MODULE_animate
> +       bool "animate"
> +       default y
The name of the config should be all in uppercase.
The module should not be at y by default.
A little help text to explain what this modules does and is usefull
for would be nice (no need for a long text, just a few words)
> +
> +config BR2_ANGULARJS_MODULE_aria
> +       bool "aria"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_cookies
> +       bool "cookies"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_loader
> +       bool "loader"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_message-format
> +       bool "message-format"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_messages
> +       bool "messages"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_resource
> +       bool "resource"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_route
> +       bool "route"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_sanitize
> +       bool "sanitize"
> +       default y
ditto
> +
> +config BR2_ANGULARJS_MODULE_touch
> +       bool "touch"
> +       default y
ditto
> +
> +endif
> +
> +endif
> diff --git a/package/angularjs/angularjs.mk b/package/angularjs/angularjs.mk
> new file mode 100644
> index 0000000..c7b587b
> --- /dev/null
> +++ b/package/angularjs/angularjs.mk
> @@ -0,0 +1,41 @@
> +################################################################################
> +#
> +# AngularJS
> +#
> +################################################################################
> +
> +ANGULARJS_VERSION = 1.4.2
It seems there's already a newer version on their website.
> +ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
> +ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
You are missing the LICENSE and LICENSE_FILES information here.
You are also missing the '.hash' file, have a look at:
http://buildroot.org/downloads/manual/manual.html#adding-packages-hash
> +
> +define ANGULARJS_EXTRACT_CMDS
> +       unzip $(DL_DIR)/$(ANGULARJS_SOURCE) -d $(@D)
> +       mv $(@D)/angular-$(ANGULARJS_VERSION)/* $(@D)
> +       rmdir $(@D)/angular-$(ANGULARJS_VERSION)
> +endef
> +
> +ANGULARJS_FILES = angular.min.js
> +
> +ANGULARJS_MODULES = animate aria cookies loader message-format \
> +                   messages resource route sanitize touch
> +
> +ifeq ($(BR2_ANGULARJS_MODULES),y)
> +
> +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),\
> +                  $(if $(filter y,$(BR2_ANGULARJS_MODULE_$(mod))),\
> +                       angular-$(mod).min.js))
> +
> +else
> +
> +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),angular-$(mod).min.js)
> +
> +endif
> +
> +define ANGULARJS_INSTALL_TARGET_CMDS
> +       for f in $(strip $(ANGULARJS_FILES)); do        \
> +               $(INSTALL) -m 0644 -D $(@D)/$$f         \
> +               $(TARGET_DIR)/var/www/$${f%.min.js}.js; \
> +       done
> +endef

Instead of this construct, look at how it's done in
package/nfs-utils/nfs-utils.mk, you can use Make at your own advantage
and define:
ANGULAR_JS_MODULES_$(BR2_PACKAGE_NFS_UTILS_RPCDEBUG) += path/to/the/file

Then install everything and delete $(ANGULAR_JS_MODULES_) which will
contains the modules not selected.
This way, you don't even need a loop.

As mentionned on IRC by Thomas De Schampheleire, you may need to
qstrip instead of strip.

> +
> +$(eval $(generic-package))
> --
> 2.1.4
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Danomi Manchego July 18, 2015, 4:08 p.m. UTC | #2
On Sat, Jul 18, 2015 at 11:58 AM, Maxime Hadjinlian
<maxime.hadjinlian@gmail.com> wrote:
...
>> +menuconfig BR2_ANGULARJS_MODULES
>> +       bool "Select AngularJS modules"
>> +
>> +       help
>> +         Select which modules to install, instead of installing all of them.
> The phrasing seems a bit wrong to me here, but I'm no english expert.
> Maybe stop at "Select modules to install." ?

If the choice is to select modules to install vs installing *all* of
them, as opposed to installing *none* of them, then indicating so is
probably important.  Otherwise, you might be left with the impression
that no modules are installed by default if this option is not
selected.

I don't have a problem with the original wording, but maybe could be:
"All modules are installed by default.  Select 'y' to customize which
modules to install."

Danomi -
Maxime Hadjinlian July 18, 2015, 4:13 p.m. UTC | #3
On Sat, Jul 18, 2015 at 6:08 PM, Danomi Manchego
<danomimanchego123@gmail.com> wrote:
> On Sat, Jul 18, 2015 at 11:58 AM, Maxime Hadjinlian
> <maxime.hadjinlian@gmail.com> wrote:
> ...
>>> +menuconfig BR2_ANGULARJS_MODULES
>>> +       bool "Select AngularJS modules"
>>> +
>>> +       help
>>> +         Select which modules to install, instead of installing all of them.
>> The phrasing seems a bit wrong to me here, but I'm no english expert.
>> Maybe stop at "Select modules to install." ?
>
> If the choice is to select modules to install vs installing *all* of
> them, as opposed to installing *none* of them, then indicating so is
> probably important.  Otherwise, you might be left with the impression
> that no modules are installed by default if this option is not
> selected.
That's why I told Ignacy that the 'default y' as to go. We never
select by default modules of a package, the user has to select them,
otherwise nothing gets installed.
>
> I don't have a problem with the original wording, but maybe could be:
> "All modules are installed by default.  Select 'y' to customize which
> modules to install."
>
> Danomi -
Thomas Petazzoni July 18, 2015, 5:16 p.m. UTC | #4
Maxime, Ignacy,

On Sat, 18 Jul 2015 17:58:48 +0200, Maxime Hadjinlian wrote:

> > +menuconfig BR2_ANGULARJS_MODULES
> > +       bool "Select AngularJS modules"
> > +
> > +       help
> > +         Select which modules to install, instead of installing all of them.
> The phrasing seems a bit wrong to me here, but I'm no english expert.
> Maybe stop at "Select modules to install." ?

No, the original wording is correct, but could be clarified. I think
that what you missed is that this option is a menuconfig, not a menu:
you can enable/disable this option.

So, what happens is that when you have:

	[ ] Select AngularJS modules ---

Then all modules are installed. However, when you have:

	[*] Select AngularJS modules ---
	   [*] animate
	   [ ] aria

Then animate will be installed, but not aria.

This part looks OK to me.

> > +if BR2_ANGULARJS_MODULES
> > +
> > +config BR2_ANGULARJS_MODULE_animate
> > +       bool "animate"
> > +       default y
> The name of the config should be all in uppercase.

Agreed.

> The module should not be at y by default.
> A little help text to explain what this modules does and is usefull
> for would be nice (no need for a long text, just a few words)

Agreed.


> > diff --git a/package/angularjs/angularjs.mk b/package/angularjs/angularjs.mk
> > new file mode 100644
> > index 0000000..c7b587b
> > --- /dev/null
> > +++ b/package/angularjs/angularjs.mk
> > @@ -0,0 +1,41 @@
> > +################################################################################
> > +#
> > +# AngularJS

This should be in lowercase.

> > +#
> > +################################################################################
> > +
> > +ANGULARJS_VERSION = 1.4.2
> It seems there's already a newer version on their website.
> > +ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
> > +ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
> You are missing the LICENSE and LICENSE_FILES information here.
> You are also missing the '.hash' file, have a look at:
> http://buildroot.org/downloads/manual/manual.html#adding-packages-hash
> > +
> > +define ANGULARJS_EXTRACT_CMDS
> > +       unzip $(DL_DIR)/$(ANGULARJS_SOURCE) -d $(@D)
> > +       mv $(@D)/angular-$(ANGULARJS_VERSION)/* $(@D)
> > +       rmdir $(@D)/angular-$(ANGULARJS_VERSION)
> > +endef
> > +
> > +ANGULARJS_FILES = angular.min.js

Change this to just:

ANGULARJS_FILES = angular

(see below why)

> > +
> > +ANGULARJS_MODULES = animate aria cookies loader message-format \
> > +                   messages resource route sanitize touch

One tab for the indentation of the second line.

> > +
> > +ifeq ($(BR2_ANGULARJS_MODULES),y)
> > +

Unneeded newline.

> > +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),\
> > +                  $(if $(filter y,$(BR2_ANGULARJS_MODULE_$(mod))),\

The filter is not needed, and you'll have to use the lowercase function
once the options will be capitalized. So probably something like:

	$(foreach mod,$(ANGULARJS_MODULES),\
		$(if $(BR2_ANGULARJS_MODULE_$(call UPPERCASE,$(mod))),angular-$(mod)))

> > +                       angular-$(mod).min.js))
> > +
> > +else
> > +

Unneeded new line.

> > +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),angular-$(mod).min.js)
> > +
> > +endif
> > +
> > +define ANGULARJS_INSTALL_TARGET_CMDS
> > +       for f in $(strip $(ANGULARJS_FILES)); do        \
> > +               $(INSTALL) -m 0644 -D $(@D)/$$f         \
> > +               $(TARGET_DIR)/var/www/$${f%.min.js}.js; \
> > +       done
> > +endef
> 
> Instead of this construct, look at how it's done in
> package/nfs-utils/nfs-utils.mk, you can use Make at your own advantage
> and define:
> ANGULAR_JS_MODULES_$(BR2_PACKAGE_NFS_UTILS_RPCDEBUG) += path/to/the/file
> 
> Then install everything and delete $(ANGULAR_JS_MODULES_) which will
> contains the modules not selected.
> This way, you don't even need a loop.

I disagree here, I think the original implementation from Ignacy is
pretty good and smart. But using a foreach loop is better for error
handling (it will stop if one install command fails) :

	$(foreach f,$(ANGULARJS_FILES),\
		$(INSTALL) -m 0644 -D $(@D)/$(f).min.js $(TARGET_DIR)/var/www/$(f).js$(sep))

> As mentionned on IRC by Thomas De Schampheleire, you may need to
> qstrip instead of strip.

I don't see why. There are no double quotes anywhere here. qstrip is
used when you get a 'string' option from Config.in, which is not the
case here.

Best regards,

Thomas
Thomas De Schampheleire July 18, 2015, 7:25 p.m. UTC | #5
Ignacy, Thomas,

On Sat, Jul 18, 2015 at 7:16 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Maxime, Ignacy,
>
> On Sat, 18 Jul 2015 17:58:48 +0200, Maxime Hadjinlian wrote:
>
>> > +menuconfig BR2_ANGULARJS_MODULES
>> > +       bool "Select AngularJS modules"
>> > +
>> > +       help
>> > +         Select which modules to install, instead of installing all of them.
>> The phrasing seems a bit wrong to me here, but I'm no english expert.
>> Maybe stop at "Select modules to install." ?
>
> No, the original wording is correct, but could be clarified. I think
> that what you missed is that this option is a menuconfig, not a menu:
> you can enable/disable this option.
>
> So, what happens is that when you have:
>
>         [ ] Select AngularJS modules ---
>
> Then all modules are installed. However, when you have:
>
>         [*] Select AngularJS modules ---
>            [*] animate
>            [ ] aria
>
> Then animate will be installed, but not aria.
>
> This part looks OK to me.
>
>> > +if BR2_ANGULARJS_MODULES
>> > +
>> > +config BR2_ANGULARJS_MODULE_animate
>> > +       bool "animate"
>> > +       default y
>> The name of the config should be all in uppercase.
>
> Agreed.
>
>> The module should not be at y by default.
>> A little help text to explain what this modules does and is usefull
>> for would be nice (no need for a long text, just a few words)
>
> Agreed.
>
>
>> > diff --git a/package/angularjs/angularjs.mk b/package/angularjs/angularjs.mk
>> > new file mode 100644
>> > index 0000000..c7b587b
>> > --- /dev/null
>> > +++ b/package/angularjs/angularjs.mk
>> > @@ -0,0 +1,41 @@
>> > +################################################################################
>> > +#
>> > +# AngularJS
>
> This should be in lowercase.
>
>> > +#
>> > +################################################################################
>> > +
>> > +ANGULARJS_VERSION = 1.4.2
>> It seems there's already a newer version on their website.
>> > +ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
>> > +ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
>> You are missing the LICENSE and LICENSE_FILES information here.
>> You are also missing the '.hash' file, have a look at:
>> http://buildroot.org/downloads/manual/manual.html#adding-packages-hash
>> > +
>> > +define ANGULARJS_EXTRACT_CMDS
>> > +       unzip $(DL_DIR)/$(ANGULARJS_SOURCE) -d $(@D)
>> > +       mv $(@D)/angular-$(ANGULARJS_VERSION)/* $(@D)
>> > +       rmdir $(@D)/angular-$(ANGULARJS_VERSION)
>> > +endef
>> > +
>> > +ANGULARJS_FILES = angular.min.js
>
> Change this to just:
>
> ANGULARJS_FILES = angular
>
> (see below why)
>
>> > +
>> > +ANGULARJS_MODULES = animate aria cookies loader message-format \
>> > +                   messages resource route sanitize touch
>
> One tab for the indentation of the second line.
>
>> > +
>> > +ifeq ($(BR2_ANGULARJS_MODULES),y)
>> > +
>
> Unneeded newline.
>
>> > +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),\
>> > +                  $(if $(filter y,$(BR2_ANGULARJS_MODULE_$(mod))),\
>
> The filter is not needed, and you'll have to use the lowercase function
> once the options will be capitalized. So probably something like:
>
>         $(foreach mod,$(ANGULARJS_MODULES),\
>                 $(if $(BR2_ANGULARJS_MODULE_$(call UPPERCASE,$(mod))),angular-$(mod)))
>
>> > +                       angular-$(mod).min.js))
>> > +
>> > +else
>> > +
>
> Unneeded new line.
>
>> > +ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),angular-$(mod).min.js)
>> > +
>> > +endif
>> > +
>> > +define ANGULARJS_INSTALL_TARGET_CMDS
>> > +       for f in $(strip $(ANGULARJS_FILES)); do        \
>> > +               $(INSTALL) -m 0644 -D $(@D)/$$f         \
>> > +               $(TARGET_DIR)/var/www/$${f%.min.js}.js; \

Here, IIUC, you are installing foo.min.js as foo.js. I think this is
misleading: it is common practice in web development to actually
include minified files as .min.js instead of renaming this, so I don't
see why it should be done here.

>> > +       done
>> > +endef
>>
>> Instead of this construct, look at how it's done in
>> package/nfs-utils/nfs-utils.mk, you can use Make at your own advantage
>> and define:
>> ANGULAR_JS_MODULES_$(BR2_PACKAGE_NFS_UTILS_RPCDEBUG) += path/to/the/file
>>
>> Then install everything and delete $(ANGULAR_JS_MODULES_) which will
>> contains the modules not selected.
>> This way, you don't even need a loop.
>
> I disagree here, I think the original implementation from Ignacy is
> pretty good and smart. But using a foreach loop is better for error
> handling (it will stop if one install command fails) :
>
>         $(foreach f,$(ANGULARJS_FILES),\
>                 $(INSTALL) -m 0644 -D $(@D)/$(f).min.js $(TARGET_DIR)/var/www/$(f).js$(sep))
>
>> As mentionned on IRC by Thomas De Schampheleire, you may need to
>> qstrip instead of strip.
>
> I don't see why. There are no double quotes anywhere here. qstrip is
> used when you get a 'string' option from Config.in, which is not the
> case here.

To clarify: I realize that these are not string options and qstrip
will not make a technical difference over strip. However, for
consistency, I think it makes sense that packages always use qstrip
rather than strip.

/Thomas
Ignacy Gawędzki July 20, 2015, 11:49 a.m. UTC | #6
On Sat, Jul 18, 2015 at 09:25:41PM +0200, thus spake Thomas De Schampheleire:
> >> > +define ANGULARJS_INSTALL_TARGET_CMDS
> >> > +       for f in $(strip $(ANGULARJS_FILES)); do        \
> >> > +               $(INSTALL) -m 0644 -D $(@D)/$$f         \
> >> > +               $(TARGET_DIR)/var/www/$${f%.min.js}.js; \
> 
> Here, IIUC, you are installing foo.min.js as foo.js. I think this is
> misleading: it is common practice in web development to actually
> include minified files as .min.js instead of renaming this, so I don't
> see why it should be done here.

Hi Thomas,

I think it should be up to the web server to decide whether the
version served is minified or not.  Otherwise you'd have to make the
JS application choose the actual version, while it makes no functional
difference.  Therefore, the application includes some .js file and
ignores whether it is minified or not.

I got my inspiration from the jquery package, which installs a
minified version as jquery.js.  Do you think I should install minified
files as .min.js anyway?

Ignacy
Thomas De Schampheleire July 20, 2015, 11:56 a.m. UTC | #7
On Mon, Jul 20, 2015 at 1:49 PM, Ignacy Gawędzki
<ignacy.gawedzki@green-communications.fr> wrote:
> On Sat, Jul 18, 2015 at 09:25:41PM +0200, thus spake Thomas De Schampheleire:
>> >> > +define ANGULARJS_INSTALL_TARGET_CMDS
>> >> > +       for f in $(strip $(ANGULARJS_FILES)); do        \
>> >> > +               $(INSTALL) -m 0644 -D $(@D)/$$f         \
>> >> > +               $(TARGET_DIR)/var/www/$${f%.min.js}.js; \
>>
>> Here, IIUC, you are installing foo.min.js as foo.js. I think this is
>> misleading: it is common practice in web development to actually
>> include minified files as .min.js instead of renaming this, so I don't
>> see why it should be done here.
>
> Hi Thomas,
>
> I think it should be up to the web server to decide whether the
> version served is minified or not.  Otherwise you'd have to make the
> JS application choose the actual version, while it makes no functional
> difference.  Therefore, the application includes some .js file and
> ignores whether it is minified or not.
>
> I got my inspiration from the jquery package, which installs a
> minified version as jquery.js.  Do you think I should install minified
> files as .min.js anyway?

Hmm, ok, then it makes sense to be consistent.

I wonder if anyone ever would like to have the unminified files on
target, and how we'd call them if the minified is installed as .js.
But that's probably a problem to be solved then...

/Thomas
Ignacy Gawędzki July 20, 2015, 1 p.m. UTC | #8
On Sat, Jul 18, 2015 at 05:58:48PM +0200, thus spake Maxime Hadjinlian:
> > +ANGULARJS_VERSION = 1.4.2
> It seems there's already a newer version on their website.

You're right, I'm updating that.

> > +ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
> > +ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
> You are missing the LICENSE and LICENSE_FILES information here.

Okay, the license is MIT, but there's no license file included in the
archive.  Should I specify angular.js as the LICENSE_FILES instead?

If so, I have a small problem.  It appears that I need to specify a
file path relative to $(@D), in that case it is simply "angular.js".
Then the file is included as such in legal-info/license.txt during
make angularjs-legal-info.  Meanwhile, the legal-info/manifest.csv
file is indicating that the license file is "angular.js" to be found
at the root of the zip archive, which is not right, since that file is
in the angular-$(ANGULARJS_VERSION)/ subdirectory.

What is the best way to go?  I'm thinking about not moving files to
$(@D) in ANGULARJS_EXTRACT_CMDS, but that would make me use a
subdirectory instead of $(@D) everywhere else.

Thanks for your help.

Ignacy
Maxime Hadjinlian July 20, 2015, 2:22 p.m. UTC | #9
Hi Ignacy, all

On Mon, Jul 20, 2015 at 3:00 PM, Ignacy Gawędzki
<ignacy.gawedzki@green-communications.fr> wrote:
> On Sat, Jul 18, 2015 at 05:58:48PM +0200, thus spake Maxime Hadjinlian:
>> > +ANGULARJS_VERSION = 1.4.2
>> It seems there's already a newer version on their website.
>
> You're right, I'm updating that.
>
>> > +ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
>> > +ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
>> You are missing the LICENSE and LICENSE_FILES information here.
>
> Okay, the license is MIT, but there's no license file included in the
> archive.  Should I specify angular.js as the LICENSE_FILES instead?
Yes I think it's the way to go, that's what we do in other packages.
>
> If so, I have a small problem.  It appears that I need to specify a
> file path relative to $(@D), in that case it is simply "angular.js".
> Then the file is included as such in legal-info/license.txt during
> make angularjs-legal-info.  Meanwhile, the legal-info/manifest.csv
> file is indicating that the license file is "angular.js" to be found
> at the root of the zip archive, which is not right, since that file is
> in the angular-$(ANGULARJS_VERSION)/ subdirectory.
>
> What is the best way to go?  I'm thinking about not moving files to
> $(@D) in ANGULARJS_EXTRACT_CMDS, but that would make me use a
> subdirectory instead of $(@D) everywhere else.
I would opt for having the subdirectory everywhere.

And also, I don't know what the community think about that, but
FOO_SUBDIR could be generalized to pkg-generic instead of only
pkg-autotools ?
>
> Thanks for your help.
>
> Ignacy
>
> --
> Ignacy Gawędzki
> R&D Engineer
> Green Communications
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 86a53c8..a8c16ac 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -866,6 +866,7 @@  menu "Hardware handling"
 endmenu
 
 menu "Javascript"
+	source "package/angularjs/Config.in"
 	source "package/bootstrap/Config.in"
 	source "package/explorercanvas/Config.in"
 	source "package/flot/Config.in"
diff --git a/package/angularjs/Config.in b/package/angularjs/Config.in
new file mode 100644
index 0000000..38fb56f
--- /dev/null
+++ b/package/angularjs/Config.in
@@ -0,0 +1,60 @@ 
+config BR2_PACKAGE_ANGULARJS
+	bool "AngularJS"
+	help
+	  AngularJS web application framework.
+
+	  http://angularjs.org
+
+if BR2_PACKAGE_ANGULARJS
+
+menuconfig BR2_ANGULARJS_MODULES
+	bool "Select AngularJS modules"
+
+	help
+	  Select which modules to install, instead of installing all of them.
+
+if BR2_ANGULARJS_MODULES
+
+config BR2_ANGULARJS_MODULE_animate
+	bool "animate"
+	default y
+
+config BR2_ANGULARJS_MODULE_aria
+	bool "aria"
+	default y
+
+config BR2_ANGULARJS_MODULE_cookies
+	bool "cookies"
+	default y
+
+config BR2_ANGULARJS_MODULE_loader
+	bool "loader"
+	default y
+
+config BR2_ANGULARJS_MODULE_message-format
+	bool "message-format"
+	default y
+
+config BR2_ANGULARJS_MODULE_messages
+	bool "messages"
+	default y
+
+config BR2_ANGULARJS_MODULE_resource
+	bool "resource"
+	default y
+
+config BR2_ANGULARJS_MODULE_route
+	bool "route"
+	default y
+
+config BR2_ANGULARJS_MODULE_sanitize
+	bool "sanitize"
+	default y
+
+config BR2_ANGULARJS_MODULE_touch
+	bool "touch"
+	default y
+
+endif
+
+endif
diff --git a/package/angularjs/angularjs.mk b/package/angularjs/angularjs.mk
new file mode 100644
index 0000000..c7b587b
--- /dev/null
+++ b/package/angularjs/angularjs.mk
@@ -0,0 +1,41 @@ 
+################################################################################
+#
+# AngularJS
+#
+################################################################################
+
+ANGULARJS_VERSION = 1.4.2
+ANGULARJS_SOURCE = angular-$(ANGULARJS_VERSION).zip
+ANGULARJS_SITE = https://code.angularjs.org/$(ANGULARJS_VERSION)/
+
+define ANGULARJS_EXTRACT_CMDS
+	unzip $(DL_DIR)/$(ANGULARJS_SOURCE) -d $(@D)
+	mv $(@D)/angular-$(ANGULARJS_VERSION)/* $(@D)
+	rmdir $(@D)/angular-$(ANGULARJS_VERSION)
+endef
+
+ANGULARJS_FILES = angular.min.js
+
+ANGULARJS_MODULES = animate aria cookies loader message-format \
+		    messages resource route sanitize touch
+
+ifeq ($(BR2_ANGULARJS_MODULES),y)
+
+ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),\
+		   $(if $(filter y,$(BR2_ANGULARJS_MODULE_$(mod))),\
+			angular-$(mod).min.js))
+
+else
+
+ANGULARJS_FILES += $(foreach mod,$(ANGULARJS_MODULES),angular-$(mod).min.js)
+
+endif
+
+define ANGULARJS_INSTALL_TARGET_CMDS
+	for f in $(strip $(ANGULARJS_FILES)); do	\
+		$(INSTALL) -m 0644 -D $(@D)/$$f		\
+		$(TARGET_DIR)/var/www/$${f%.min.js}.js;	\
+	done
+endef
+
+$(eval $(generic-package))