Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Erlang-plugin and NIF

Help
Anonymous
2012-03-09
2013-04-26

  • Anonymous
    2012-03-09

    Hi,

    I'm evaluating the maven plugin and I'd like to know if someone has already use it the build NIFs or erlang drivers.

    Thanks,
    charpi

     
  • Hi,

    unfortunately there's no direct support for native code in the maven-erlang-plugin.

    But you can put non-erlang dependencies into the POM. These artifacts will be put into the priv-directory of your application during the build. The path can then easily be retrieved with code:priv_dir/1 at runtime. This is what we are currently using. It works but I have to admit that it doesn't really make me happy.

    Regards
    Tobias

     

  • Anonymous
    2012-03-14

    So, how would you like to have this support ?

    I'm new to maven but I can try to write the mojo for that.

    The thing that I don't understand (or figure) yet is how the artefact would have to be named to support several platforms.

     
  • Hi,

    thanks for the offer to contribute, contributions are always welcome.

    Unfortunately, I don't think this kind of native code support is a problem of the maven-erlang-plugin. It's rather a problem of maven and the idea to have compiled artifacts. This makes it hard or even impossible to build platform dependent code with it.

    Therefore, building native code would actually require a maven-plugin itself. There already are some plugins that try to add native code support to maven like the http://mojo.codehaus.org/maven-native/native-maven-plugin/ or the http://mojo.codehaus.org/cbuild-parent/cbuild-plugin-parent/make-maven-plugin/. I tried the native-maven-plugin myself but couldn't get it to work even on a trivial project :(

    Of course there could be a plugin mojo that calls make in the application's priv directory (like rebar does) but this would only work on compatible platforms having the correct dependencies installed.

    If you have a setup as described above you could also build the native code manually and deploy it along with the erlang project in binary form. Another possibilty would be to have the native sources in the priv directory and compile it during application startup on the target platform.

    I would really like to hear your opinion on this topic, what does your current build process look like?

    Regards
    Tobias

     

  • Anonymous
    2012-03-16

    Hi,

    Basically, I need to be able to build erlang_driver for linux (ubuntu, redhat) and Solaris.

    I don't really care if some pre-requisites have to be installed in order to be able to build the driver.

    Of course, I can package my erlang release and those drivers separately and rely on the distribution/installation procedure  to ensure that the drivers are correctly installed. The deployement/upgrade is therefore more complex but it should work.
    One benefit of that is the fact that the erlang release package will be platform independent

    The idea behind the mojo, was to "mask" all C configuration needed to compile a driver (location of the erlang include file for exemple).

    I don't know Maven, but I guess/hope that the name of one artifact can be configurable to include the architecture type.