Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run configure in gyp file

Suppose I have a node module which is essentially a wrapper around some standard C library using autotools. So the library by itself would be installed using ./configure and make and perhaps make install. The wrapper code is just a few files, and can be handled by gyp. But how can I handle the dependency? How can I instruct gyp that I want to build the autotooled library before I compile my code? Or is that not possible because autotools can't be expected to run on Windows? If I can't run configure, is there some gyp way to do similar things, in particular to detect which functions are availabel and which are not?

like image 306
MvG Avatar asked Dec 03 '14 15:12

MvG


1 Answers

With gyp actions and 'target_type': none it might look like this:

   {
        'target_name': 'FTGL',
        'type': 'none',
        'dependencies': ['FreeType'],
        'actions': [
            {
                'action_name': 'build_ftgl',
                'message': 'Building FTGL...',
                'inputs': ['ftgl/src/FTGL/ftgl.h'],
                'outputs': ['ftgl/src/.libs/libftgl.a'],
                'action': ['eval', 'cd ftgl && ./configure --with-pic && make -C src'],
            },
        ],
  }

Note: using eval in the action allows to run multiple commands

like image 59
pmed Avatar answered Sep 22 '22 06:09

pmed