diff --git a/.bzrignore b/.bzrignore index 14910f8..57a8889 100644 --- a/.bzrignore +++ b/.bzrignore @@ -21,3 +21,4 @@ src/modbus.lo src/test-modbus-master src/test-modbus-slave modbus.pc +_build_ diff --git a/src/wscript b/src/wscript new file mode 100644 index 0000000..fe9c145 --- /dev/null +++ b/src/wscript @@ -0,0 +1,19 @@ +def build(bld): + obj = bld.create_obj('cc', 'shlib') + obj.source = 'modbus.c' + obj.includes = '.' + obj.uselib = 'GLIB' + obj.target = 'modbus' + obj.vnum = '1.2.4' + + obj = bld.create_obj('cc', 'program') + obj.source = 'test-modbus-master.c' + obj.includes = '.' + obj.uselib_local = 'modbus' + obj.target = 'test-modbus-master' + + obj = bld.create_obj('cc', 'program') + obj.source = 'test-modbus-slave.c' + obj.includes = '.' + obj.uselib_local = 'modbus' + obj.target = 'test-modbus-slave' diff --git a/wscript b/wscript new file mode 100644 index 0000000..fa5df44 --- /dev/null +++ b/wscript @@ -0,0 +1,47 @@ +#! /usr/bin/env python +# encoding: utf-8 + +VERSION='1.2.4' +APPNAME='libmodbus' + +# these variables are mandatory ('/' are converted automatically) +srcdir = '.' +blddir = '_build_' + +def init(): + print "A groovy libmodbus for Linux!" + +def set_options(opt): + # options provided by the modules + opt.tool_options('compiler_cc') + +def configure(conf): + conf.check_tool('compiler_cc') + conf.check_pkg('glib-2.0', destvar='GLIB', mandatory=True) + + e = conf.create_header_enumerator() + e.mandatory = 1 + # Add AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termio.h termios.h unistd.h]) + e.name = 'arpa/inet.h' + e.run() + + # Add AC_CHECK_FUNCS([inet_ntoa memset select socket]) + conf.define('VERSION', VERSION) + conf.define('PACKAGE', 'libmodbus') + + conf.write_config_header() + +def build(bld): + bld.add_subdirs('src'); + +# Doesn't work I need some help from the WAF project +# obj = bld.create_obj('subst') +# obj.source = 'modbus.pc.in' +# obj.target = 'modbus.pc' +# obj.dict = {'VERSION' : VERSION } + +def shutdown(): + import UnitTest + unittest = UnitTest.unit_test() + unittest.run() + unittest.print_results()