0

I'm new to Ubuntu developpement and searching for information regarding building apps through launchpad (using recipes).

I have a project of building a Qt5/c++ webkit app and wanted to ask: how to use external tools in the build process? Let's say I wanted to use grunt to concatenate and minify js and css files prior of building the app. How to proceed?

Thank you.

David Planella
  • 15,420
  • 11
  • 77
  • 141
pr.nizar
  • 780
  • 2
  • 6
  • 17

1 Answers1

1

Since grunt comes from npm, and since npm gets grunt from online, you won't be able to use grunt in a Launchpad build. You can either copy grunt and all of its dependencies into your package (which is likely to make your package cumbersome), or use something else that does the equivalent functionality, like the libcss-minifier-perl and libjavascript-minifier-perl packages, which use Perl.

saiarcot895
  • 10,727
  • 2
  • 35
  • 39
  • How can I add grunt as a build dependency? It's installed through npm and not available in the ubuntu repositories. I'm using actually using it through a makefile as in [here](http://oxy.fi/2013/02/03/how-to-use-makefiles-in-your-web-projects/). – pr.nizar Aug 19 '14 at 17:55
  • 1
    That complicates things. `npm` can be installed, but it won't be able to install packages from the internet. I would recommend you to use a package that provides minification of CSS and JS files. Doing a quick search, I found `libcss-minifier-perl` and `libjavascript-minifier-perl`, to be used in Perl. – saiarcot895 Aug 19 '14 at 18:23
  • How can I use npm in launchpad? And can I use the npm's version that's in [Chris Lea's ppa](https://launchpad.net/~chris-lea/+ppa-packages)? I can put grunt's source along with dependencies as in [here](http://stackoverflow.com/questions/19118992/is-there-an-offline-installer-for-gruntjs) in my code.. – pr.nizar Aug 19 '14 at 20:01
  • To use `npm` itself, just add it to the build dependencies and call the npm commands as normal in `debian/rules`; that being said, if any of those commands require internet access, they will not work. You could also have grunt and its dependencies in your package, but note that it could be a long list. Are you sure you don't want to use the Perl alternatives? – saiarcot895 Aug 20 '14 at 11:17
  • As for using the `npm` version in Chris Lea's PPA...are you sure he has a newer version of `npm`? I see he has node.js, but not the `npm` package. – saiarcot895 Aug 20 '14 at 11:20
  • Yes in that ppa there is an updated version of npm that is not the same as in the official repo. I'll try that today and see the outcome. Many thanks! – pr.nizar Aug 20 '14 at 12:08
  • 1
    In that case, you can either copy the package into your own PPA or click on "Edit PPA Dependencies" on the right side of your PPA page and add that PPA. – saiarcot895 Aug 20 '14 at 12:09
  • I was unable to make it work: several dependencies.. I'll stick to the solution you gave using other packages.. Thank you! – pr.nizar Aug 21 '14 at 23:24
  • 1
    I updated my answer to reflect the discussion here. – saiarcot895 Aug 22 '14 at 00:46