darrylhodgins / piface-node

Node.js addon for Raspberry Pi & Piface
MIT License
24 stars 11 forks source link

porting gyp-build to libpifacedigital #11

Open h0ru5 opened 9 years ago

h0ru5 commented 9 years ago

@tompreston now maintains the c-lib as standalone as libpifacedigital. It does not have a install yet, I raised it there piface/libpifacedigital#9

would be a smoother experience for installing via npm, if there is a knwon location.

currently hacking the build-gyp accordingly, but it seems I also need to touch up the function names.

darrylhodgins commented 9 years ago

Thanks for contributing! I'll have to take a look at this over the weekend (and I'll update the NPM module). I currently don't have a piface module and need to pick one up on Saturday.

h0ru5 commented 9 years ago

Galdly. I now did install both libs (mcp23s17 and pifacedigital) as shared libs and after that the npm is working out-of-box.

darrylhodgins commented 9 years ago

I picked up a piface module on the weekend, and haven't got it working yet. Mostly because I'm too lazy right now to remember how to install shared libs. :)

darrylhodgins commented 9 years ago

Got it. This looks great, but I think the piface/libpifacedigital#9 problem needs to get resolved so the install process is a lot smoother. Though, these steps aren't too horrible, so unless you have a better idea, I don't mind updating the NPM module with the libpifacedigital. It does seem like it would be an improvement.

What I did:

$ git clone https://github.com/piface/libmcp23s17.git
$ git clone https://github.com/piface/libpifacedigital.git
$ cd libmcp23s17/ && make
$ sudo cp libmcp23s17.a /usr/local/lib/
$ sudo cp src/mcp23s17.h /usr/local/include/
$ cd ..
$ cd libpifacedigital/ && make
$ sudo cp libpifacedigital.a /usr/local/lib/
$ sudo cp src/pifacedigital.h /usr/local/include/
$ cd ..
h0ru5 commented 9 years ago

I know its a bit unsmooth, I was first poking around with vendoring the libs in (adding the c-files to your code), but that is not a way I would suggest. Having the libs as systemwide so is IMHO the only clean solution.

Right, your script above would be the steps, which could of course be part of the build.

I did notice that there is an effort to create a raspbian package for libmcp23s17, which would install into a different locations, /usr/lib and /usr/include/piface (and adds a make install, which could go pretty much unchanged for libpifacedigital).

My suggestion would be to create a feature branch for now, and once @tompreston adds a make install, we can adjust it and you can put it into production.

tompreston commented 9 years ago

Just popping a comment here to say that I am aware of this issue but massively busy at the moment. I'll get around to this as soon as I can -- hopefully within this week. Thanks for all the suggestions.