Changeset e1e10cd in rtems-libbsd for libbsd_waf.py


Ignore:
Timestamp:
Apr 23, 2016, 7:37:27 AM (3 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
fd86c091b97759106da7355ce1dd81ebe030e285, freebsd-9.3, f020f08430150c1656a0ad0a1de13699db9b980b
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.