jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 2 | |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 3 | import os |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 4 | from waflib import Utils |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 5 | |
Davide Pesavento | bfb33ab | 2022-03-12 23:30:23 -0500 | [diff] [blame] | 6 | VERSION = '0.1' |
| 7 | APPNAME = 'ndn-traffic-generator' |
| 8 | |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 9 | def options(opt): |
Alexander Afanasyev | 740812e | 2014-10-30 15:37:45 -0700 | [diff] [blame] | 10 | opt.load(['compiler_cxx', 'gnu_dirs']) |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 11 | opt.load(['default-compiler-flags', 'boost'], |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 12 | tooldir=['.waf-tools']) |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 13 | |
| 14 | def configure(conf): |
Alexander Afanasyev | 740812e | 2014-10-30 15:37:45 -0700 | [diff] [blame] | 15 | conf.load(['compiler_cxx', 'gnu_dirs', |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 16 | 'default-compiler-flags', 'boost']) |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 17 | |
Davide Pesavento | f5006be | 2022-08-19 17:36:36 -0400 | [diff] [blame] | 18 | # Prefer pkgconf if it's installed, because it gives more correct results |
| 19 | # on Fedora/CentOS/RHEL/etc. See https://bugzilla.redhat.com/show_bug.cgi?id=1953348 |
| 20 | # Store the result in env.PKGCONFIG, which is the variable used inside check_cfg() |
| 21 | conf.find_program(['pkgconf', 'pkg-config'], var='PKGCONFIG') |
| 22 | |
Davide Pesavento | bfb33ab | 2022-03-12 23:30:23 -0500 | [diff] [blame] | 23 | pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig') |
Davide Pesavento | 326ec85 | 2023-02-14 16:42:33 -0500 | [diff] [blame] | 24 | conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'], |
Davide Pesavento | bfb33ab | 2022-03-12 23:30:23 -0500 | [diff] [blame] | 25 | uselib_store='NDN_CXX', pkg_config_path=pkg_config_path) |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 26 | |
Davide Pesavento | c2f25b7 | 2024-12-13 19:23:50 -0500 | [diff] [blame] | 27 | conf.check_boost(lib='date_time program_options', mt=True) |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 28 | |
Davide Pesavento | 64cafaa | 2018-05-24 00:50:41 -0400 | [diff] [blame] | 29 | conf.check_compiler_flags() |
| 30 | |
jeraldabraham | 420dbf0 | 2014-04-25 22:58:31 -0700 | [diff] [blame] | 31 | def build(bld): |
Davide Pesavento | 032c980 | 2019-01-25 17:10:26 -0500 | [diff] [blame] | 32 | bld.program(target='ndn-traffic-client', |
Davide Pesavento | 7eaed5c | 2019-01-09 20:03:43 -0500 | [diff] [blame] | 33 | source='src/ndn-traffic-client.cpp', |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 34 | use='NDN_CXX BOOST') |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 35 | |
Davide Pesavento | 7eaed5c | 2019-01-09 20:03:43 -0500 | [diff] [blame] | 36 | bld.program(target='ndn-traffic-server', |
| 37 | source='src/ndn-traffic-server.cpp', |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 38 | use='NDN_CXX BOOST') |
Alexander Afanasyev | fda32a3 | 2014-03-20 10:50:00 -0700 | [diff] [blame] | 39 | |
| 40 | bld.install_files('${SYSCONFDIR}/ndn', ['ndn-traffic-client.conf.sample', |
| 41 | 'ndn-traffic-server.conf.sample']) |
Davide Pesavento | e5a7394 | 2019-01-26 20:54:13 -0500 | [diff] [blame] | 42 | |
| 43 | if Utils.unversioned_sys_platform() == 'linux': |
| 44 | systemd_units = bld.path.ant_glob('systemd/*.in') |
| 45 | bld(features='subst', |
| 46 | name='systemd-units', |
| 47 | source=systemd_units, |
| 48 | target=[u.change_ext('') for u in systemd_units]) |
Davide Pesavento | edd2184 | 2023-09-11 22:24:44 -0400 | [diff] [blame] | 49 | |
| 50 | def dist(ctx): |
| 51 | ctx.algo = 'tar.xz' |
| 52 | |
| 53 | def distcheck(ctx): |
| 54 | ctx.algo = 'tar.xz' |