To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Compiling modules: Difference between revisions

From ZNC
Jump to navigation Jump to search
Created page with "{{Languages}} == Compiling a module == If you have the source code for a module, there are multiple ways to compile it. === make === If you still have ZNC's source aroun..."
 
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
== Compiling a module ==
== Compiling a module ==
If you have the source code for a module, there are multiple ways to compile it.
If you have the source code for a module, there are multiple ways to compile it.
Please note: If you have installed ZNC from your distro's repository you also need to install the dev package of ZNC (usually <code>znc-dev</code> or <code>znc-devel</code>) for building your own modules.


=== make ===
=== make ===
Line 20: Line 22:


<code>znc-buildmod</code> is installed to the same directory to which <code>znc</code> is installed, so you might have to change into that directory and use <code>./znc-buildmod <modulename>.cpp</code>.
<code>znc-buildmod</code> is installed to the same directory to which <code>znc</code> is installed, so you might have to change into that directory and use <code>./znc-buildmod <modulename>.cpp</code>.
=== znc-config ===
If you really want to use znc-config directly, do this:
PATH=$PATH:~/<ZNC's prefix>/bin g++ `znc-config --cflags` `znc-config --include` `znc-config --libs` -shared -o <modulename>.so <modulename>.cpp
You need the full path to znc-config again, or you can add that path to your $PATH environment variable.
You now have <modulename>.so and can proceed.


== Installing a module ==
== Installing a module ==

Latest revision as of 15:27, 19 March 2013

Compiling a module

If you have the source code for a module, there are multiple ways to compile it.

Please note: If you have installed ZNC from your distro's repository you also need to install the dev package of ZNC (usually znc-dev or znc-devel) for building your own modules.

make

If you still have ZNC's source around, compiling a new module is a really simple thing to do.

  1. Save the module in the module dir in your ZNC source tree. The filename should be <modulename>.cpp. You can choose pretty much any name for the module.
  2. Run make (or gmake). The new module will be found and built.
    1. If you installed ZNC using (g)make install, you can just run that command again and you are done.
    2. Else you now have <modulename>.so in your modules directory. This is the module

znc-buildmod

If you don't have ZNC's source around, but installed it (or installed from your distribution's package manager), you don't have to worry. There is a tool called znc-buildmod.

  1. Save the module's source somewhere. Use <modulename>.cpp as the file name.
  2. Run
    znc-buildmod <modulename>.cpp
  3. Now you have <modulename>.so in your current directory. This is the module.

znc-buildmod is installed to the same directory to which znc is installed, so you might have to change into that directory and use ./znc-buildmod <modulename>.cpp.

Installing a module

So once you got <modulename>.so, what should you do with this file? The easiest solution is moving or copying that file to ~/.znc/modules. If you use a different datadir than ~/.znc, move it there in the modules directory. If you don't know what a datadir is, just use ~/.znc/modules.

If you upgrade your ZNC version you must recompile all your modules.