Changeset e1e10cd in rtems-libbsd


Ignore:
Timestamp:
Apr 23, 2016, 7:37:27 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
Children:
7d0050d
Parents:
051ef30
Message:

waf: Add the ability to set FreeBSD options on the configure command line.

Add --freebsd-options to add specific FreeBSD compile time options to
the build. This is a developer tool.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • README.waf

    r051ef30 re1e10cd  
    107107    between them safe in the knowledge that one build will not infect another.
    108108
    109 
    110109Updating RTEMS Waf Support
    111110~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    137136 $ cd ..
    138137 $ git commit -m "Update rtems_waf" rtems_waf
     138
     139FreeBSD Developer Support
     140~~~~~~~~~~~~~~~~~~~~~~~~~
     141
     142The --freebsd-option provides a tool you can set special kernel options. This
     143is a developer tool and should only be used if you are familiar with the
     144internals of the FreeBSD kernel and what these options do.
     145
     146The options are listed in:
     147
     148 https://github.com/freebsd/freebsd/blob/master/sys/conf/NOTES
     149
     150An example to turn on a verbose kernel boot, verbose sysinit and bus debugging
     151configure with:
     152
     153 --freebsd-options=bootverbose,verbose_sysinit,bus_debug
     154
     155The LibBSD waf support splits the options and converts them to uppercase and
     156adds them -D options on the compiler command line.
  • freebsd/sys/kern/init_main.c

    r051ef30 re1e10cd  
    162162}
    163163#else /* __rtems__ */
     164#ifdef BOOTVERBOSE
     165int     bootverbose = 1;
     166SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0,
     167        "Control the output of verbose kernel messages");
     168#endif
    164169RWSET_DECLARE(sysinit_set, struct sysinit);
    165170#endif /* __rtems__ */
  • freebsd/sys/sys/systm.h

    r051ef30 re1e10cd  
    7474extern int bootverbose;         /* nonzero to print verbose messages */
    7575#else /* __rtems__ */
    76 #define bootverbose    0        /* XXX RTEMS doesn't support verbose */
     76#ifdef BOOTVERBOSE
     77extern int bootverbose;         /* nonzero to print verbose messages */
     78#else
     79#define bootverbose    0        /* Remove all verbose code for the standard RTEMS build */
     80#endif /* BOOTVERBOSE */
    7781#endif /* __rtems__ */
    7882
  • libbsd_waf.py

    r051ef30 re1e10cd  
    3939    cflags = ['-std=gnu11'] + common_flags
    4040    cxxflags = ['-std=gnu++11'] + common_flags
     41
     42    # Defines
     43    defines = []
     44    for o in bld.env.FREEBSD_OPTIONS.split(","):
     45        defines += ["%s=1" % (o.strip().upper())]
    4146
    4247    # Include paths
     
    137142    # Lex
    138143    if bld.env.AUTO_REGEN:
     144        bld(target = "freebsd/contrib/libpcap/scanner.c",
     145            source = "freebsd/contrib/libpcap/scanner.l",
     146            rule = "${LEX} -P pcap -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}")
     147    bld.objects(target = "lex_pcap",
     148                features = "c",
     149                cflags = cflags,
     150                includes = [] + includes,
     151                defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'],
     152                source = "freebsd/contrib/libpcap/scanner.c")
     153    libbsd_use += ["lex_pcap"]
     154
     155    if bld.env.AUTO_REGEN:
    139156        bld(target = "freebsd/lib/libc/net/nslexer.c",
    140157            source = "freebsd/lib/libc/net/nslexer.l",
     
    144161                cflags = cflags,
    145162                includes = [] + includes,
    146                 defines = [],
     163                defines = defines + [],
    147164                source = "freebsd/lib/libc/net/nslexer.c")
    148165    libbsd_use += ["lex__nsyy"]
    149 
    150     if bld.env.AUTO_REGEN:
    151         bld(target = "freebsd/contrib/libpcap/scanner.c",
    152             source = "freebsd/contrib/libpcap/scanner.l",
    153             rule = "${LEX} -P pcap -t ${SRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' > ${TGT}")
    154     bld.objects(target = "lex_pcap",
    155                 features = "c",
    156                 cflags = cflags,
    157                 includes = [] + includes,
    158                 defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'],
    159                 source = "freebsd/contrib/libpcap/scanner.c")
    160     libbsd_use += ["lex_pcap"]
    161166
    162167    if bld.env.AUTO_REGEN:
     
    168173                cflags = cflags,
    169174                includes = [] + includes,
    170                 defines = [],
     175                defines = defines + [],
    171176                source = "freebsd/lib/libipsec/policy_token.c")
    172177    libbsd_use += ["lex___libipsecyy"]
     
    181186                cflags = cflags,
    182187                includes = [] + includes,
    183                 defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'],
     188                defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1', 'NEED_YYPARSE_WRAPPER=1', 'yylval=pcap_lval'],
    184189                source = "freebsd/contrib/libpcap/grammar.c")
    185190    libbsd_use += ["yacc_pcap"]
     191    if bld.env.AUTO_REGEN:
     192        bld(target = "freebsd/lib/libc/net/nsparser.c",
     193            source = "freebsd/lib/libc/net/nsparser.y",
     194            rule = "${YACC} -b _nsyy -d -p _nsyy ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < _nsyy.tab.c > ${TGT} && rm -f _nsyy.tab.c && mv _nsyy.tab.h freebsd/lib/libc/net/nsparser.h")
     195    bld.objects(target = "yacc__nsyy",
     196                features = "c",
     197                cflags = cflags,
     198                includes = [] + includes,
     199                defines = defines + [],
     200                source = "freebsd/lib/libc/net/nsparser.c")
     201    libbsd_use += ["yacc__nsyy"]
    186202    if bld.env.AUTO_REGEN:
    187203        bld(target = "freebsd/lib/libipsec/policy_parse.c",
     
    192208                cflags = cflags,
    193209                includes = [] + includes,
    194                 defines = [],
     210                defines = defines + [],
    195211                source = "freebsd/lib/libipsec/policy_parse.c")
    196212    libbsd_use += ["yacc___libipsecyy"]
    197     if bld.env.AUTO_REGEN:
    198         bld(target = "freebsd/lib/libc/net/nsparser.c",
    199             source = "freebsd/lib/libc/net/nsparser.y",
    200             rule = "${YACC} -b _nsyy -d -p _nsyy ${SRC} && sed -e '/YY_BUF_SIZE/s/16384/1024/' < _nsyy.tab.c > ${TGT} && rm -f _nsyy.tab.c && mv _nsyy.tab.h freebsd/lib/libc/net/nsparser.h")
    201     bld.objects(target = "yacc__nsyy",
    202                 features = "c",
    203                 cflags = cflags,
    204                 includes = [] + includes,
    205                 defines = [],
    206                 source = "freebsd/lib/libc/net/nsparser.c")
    207     libbsd_use += ["yacc__nsyy"]
    208213
    209214    # Objects built with different CFLAGS
     
    350355                cflags = cflags,
    351356                includes = [] + includes,
    352                 defines = ['INET6'],
     357                defines = defines + ['INET6'],
    353358                source = objs01_source)
    354359    libbsd_use += ["objs01"]
     
    359364                cflags = cflags,
    360365                includes = [] + includes,
    361                 defines = ['NO_SSL', 'NO_POPEN', 'NO_CGI', 'USE_WEBSOCKET'],
     366                defines = defines + ['NO_SSL', 'NO_POPEN', 'NO_CGI', 'USE_WEBSOCKET'],
    362367                source = objs02_source)
    363368    libbsd_use += ["objs02"]
     
    391396                cflags = cflags,
    392397                includes = [] + includes,
    393                 defines = ['__DBINTERFACE_PRIVATE', 'INET6'],
     398                defines = defines + ['__DBINTERFACE_PRIVATE', 'INET6'],
    394399                source = objs03_source)
    395400    libbsd_use += ["objs03"]
     
    421426                cflags = cflags,
    422427                includes = [] + includes,
    423                 defines = ['__FreeBSD__', 'THERE_IS_NO_FORK', 'MASTER_ONLY', 'INET', 'INET6'],
     428                defines = defines + ['__FreeBSD__', 'THERE_IS_NO_FORK', 'MASTER_ONLY', 'INET', 'INET6'],
    424429                source = objs04_source)
    425430    libbsd_use += ["objs04"]
     
    442447                cflags = cflags,
    443448                includes = [] + includes,
    444                 defines = ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1'],
     449                defines = defines + ['__FreeBSD__=1', 'BSD=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_LIMITS_H=1', 'HAVE_INTTYPES=1', 'HAVE_STDINT=1', 'HAVE_STRERROR=1', 'HAVE_STRLCPY=1', 'HAVE_SNPRINTF=1', 'HAVE_VSNPRINTF=1', 'HAVE_SOCKADDR_SA_LEN=1', 'HAVE_NET_IF_MEDIA_H=1', 'HAVE_SYS_IOCCOM_H=1'],
    445450                source = objs05_source)
    446451    libbsd_use += ["objs05"]
     
    593598                cflags = cflags,
    594599                includes = ['freebsd/contrib/tcpdump', 'freebsd/usr.sbin/tcpdump/tcpdump'] + includes,
    595                 defines = ['__FreeBSD__=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_CONFIG_H=1', 'HAVE_NET_PFVAR_H=1'],
     600                defines = defines + ['__FreeBSD__=1', 'INET6', '_U_=__attribute__((unused))', 'HAVE_CONFIG_H=1', 'HAVE_NET_PFVAR_H=1'],
    596601                source = objs06_source)
    597602    libbsd_use += ["objs06"]
     
    10671072              cxxflags = cxxflags,
    10681073              includes = includes,
     1074              defines = defines,
    10691075              source = source,
    10701076              use = libbsd_use)
  • waf_generator.py

    r051ef30 re1e10cd  
    294294        self.add('    cflags = %r + common_flags' % (builder.cflags()))
    295295        self.add('    cxxflags = %r + common_flags' % (builder.cxxflags()))
     296        self.add('')
     297        self.add('    # Defines')
     298        self.add('    defines = []')
     299        self.add('    for o in bld.env.FREEBSD_OPTIONS.split(","):')
     300        self.add('        defines += ["%s=1" % (o.strip().upper())]')
    296301        self.add('')
    297302        self.add('    # Include paths')
     
    410415            lexes = data['lex']
    411416            self.add('    # Lex')
    412             for l in lexes:
     417            for l in sorted(lexes.keys()):
    413418                lex = lexes[l]['all']
    414419                if 'cflags' in lex:
     
    429434                self.add('                cflags = cflags,')
    430435                self.add('                includes = %r + includes,' % (lex_includes))
    431                 self.add('                defines = %r,' % (lex_defines))
     436                self.add('                defines = defines + %r,' % (lex_defines))
    432437                self.add('                source = "%s.c")' % (lex['file'][:-2]))
    433438                self.add('    libbsd_use += ["lex_%s"]' % (lex['sym']))
     
    437442            yaccs = data['yacc']
    438443            self.add('    # Yacc')
    439             for y in yaccs:
     444            for y in sorted(yaccs.keys()):
    440445                yacc = yaccs[y]['all']
    441446                yacc_file = yacc['file']
     
    463468                self.add('                cflags = cflags,')
    464469                self.add('                includes = %r + includes,' % (yacc_includes))
    465                 self.add('                defines = %r,' % (yacc_defines))
     470                self.add('                defines = defines + %r,' % (yacc_defines))
    466471                self.add('                source = "%s.c")' % (yacc_file[:-2]))
    467472                self.add('    libbsd_use += ["yacc_%s"]' % (yacc_sym))
     
    497502                self.add('                cflags = cflags,')
    498503                self.add('                includes = %r + includes,' % (includes))
    499                 self.add('                defines = %r,' % (defines))
     504                self.add('                defines = defines + %r,' % (defines))
    500505                self.add('                source = objs%02d_source)' % objs)
    501506                self.add('    libbsd_use += ["objs%02d"]' % (objs))
     
    519524        self.add('              cxxflags = cxxflags,')
    520525        self.add('              includes = includes,')
     526        self.add('              defines = defines,')
    521527        self.add('              source = source,')
    522528        self.add('              use = libbsd_use)')
  • wscript

    r051ef30 re1e10cd  
    6464                   dest = "net_config",
    6565                   help = "Network test configuration.")
     66    opt.add_option("--freebsd-options",
     67                   action = "store",
     68                   default = "",
     69                   dest = "freebsd_options",
     70                   help = "Set FreeBSD options (developer option).")
    6671    libbsd_waf.options(opt)
    6772
     
    8388    conf.env.WARNINGS = conf.options.warnings
    8489    conf.env.NET_CONFIG = conf.options.net_config
     90    conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
    8591    rtems.configure(conf, bsp_configure)
    86     libbsd_waf.configure(conf, arch_bsp)
     92    libbsd_waf.configure(conf)
    8793
    8894def build(bld):
Note: See TracChangeset for help on using the changeset viewer.