From OpenSCADAWiki
Jump to: navigation, search

The procedure for creation of a new external module based on the template is largely similar to the previous procedure and includes the following steps:

1. Getting the sources of the OpenSCADA project. For an external module as a source of template you can use any OpenSCADA source files of version more than 0.9 because it is necessary to copy only the "=Tmpl=" directory and several files for build.
2. Copy the template directory with the "NewMod" name of the new module (for example, for the "DB" subsystem). Creating and copying the necessary files for an external module. Further the information files of the project "COPYING", "NEWS", "README", "AUTHORS" and "ChangeLog" must be filled according to the nature of the new module.
$ cp -r OpenSCADA/src/moduls/bd/=Tmpl= NewMod
$ touch NewMod/{NEWS,README,AUTHORS,ChangeLog}
$ cp OpenSCADA/I18N.mk NewMod/
3. Editing the "module.cpp" file, similar to the appropriate item in the previous section.
4. Edit the module's building configuration in the "Makefile.am" file, similar to the appropriate item in the previous section, excepts:
# Instead "db_NewMod_la_LDFLAGS = -module -avoid-version $(top_builddir)/src/liboscada.la"
db_NewMod_la_LDFLAGS = -module -avoid-version
# Instead "include ../../../../I18N.mk"
include I18N.mk 
5. Editing the "configure.ac" configuration file of the build system:
"AC_INIT([DB.Tmpl],[0.0.1],[my@email.org])" — information about the module: name, version and e-mail of the project.
"AM_CONDITIONAL([TmplIncl],[test])" — AM_CONDITIONAL([NewModIncl],[test])
6. Installing the OpenSCADA development package. Because the module is an external one and the OpenSCADA source files are needed only at the first stage of the module's creation, you must install the OpenSCADA development package (openscada-devel), which contains the header files and libraries.
7. Now you can build the new module, after formation of the building system
$ autoreconf -if
$ ./configure
$ make