diff options
-rw-r--r-- | buildtools/wafsamba/samba_asn1.py | 109 | ||||
-rw-r--r-- | source4/heimdal_build/wscript_build | 134 |
2 files changed, 119 insertions, 124 deletions
diff --git a/buildtools/wafsamba/samba_asn1.py b/buildtools/wafsamba/samba_asn1.py deleted file mode 100644 index eb17f6bfe3..0000000000 --- a/buildtools/wafsamba/samba_asn1.py +++ /dev/null @@ -1,109 +0,0 @@ -# samba ASN1 rules - -import Build, os -from samba_utils import * -from samba_autoconf import * - - -def SAMBA_ASN1(bld, name, source, - options='', - directory='', - option_file=None, - includes=''): - '''Build a ASN1 file using the asn1 compiler. - This will produce 2 output files''' - bname = os.path.basename(source)[0:-5]; - dname = os.path.dirname(source) - asn1name = "%s_asn1" % bname - - if not SET_TARGET_TYPE(bld, name, 'ASN1'): - return - - # for ASN1 compilation, I always put it in build_source, as it doesn't make - # sense elsewhere - bld.SET_BUILD_GROUP('build_source') - - out_files = [] - out_files.append("../heimdal/%s/asn1_%s_asn1.x" % (directory, bname)) - out_files.append("../heimdal/%s/%s_asn1.hx" % (directory, bname)) - out_files.append("../heimdal/%s/%s_asn1-priv.hx" % (directory, bname)) - - # the ${TGT[0].parent.abspath(env)} expression gives us the parent directory of - # the first target in the build directory - # SRC[0].abspath(env) gives the absolute path to the source directory for the first - # source file. Note that in the case of a option_file, we have more than - # one source file - cd_rule = 'cd ${TGT[0].parent.abspath(env)}' - asn1_rule = cd_rule + ' && ${BLDBIN}/asn1_compile ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file ${SRC[0].abspath(env)} ${ASN1NAME}' - - source = TO_LIST(source) - source.append('asn1_compile') - - if option_file is not None: - source.append(option_file) - - t = bld(rule=asn1_rule, - ext_out = '.x', - before = 'cc', - on_results = True, - shell = True, - source = source, - target = out_files, - name=name + '_ASN1') - - t.env.ASN1NAME = asn1name - t.env.ASN1OPTIONS = options - t.env.BLDBIN = os.path.normpath(os.path.join(bld.srcnode.abspath(bld.env), '..')) - if option_file is not None: - t.env.OPTION_FILE = "--option-file=%s" % os.path.normpath(os.path.join(bld.curdir, option_file)) - - cfile = out_files[0][0:-2] + '.c' - hfile = out_files[1][0:-3] + '.h', - hpriv = out_files[2][0:-3] + '.h', - - # now generate a .c file from the .x file - t = bld(rule='''( echo '#include "config.h"' && cat ${SRC} ) > ${TGT}''', - source = out_files[0], - target = cfile, - shell = True, - on_results=True, - ext_out = '.c', - ext_in = '.x', - depends_on = name + '_ASN1', - name = name + '_C') - - # and generate a .h file from the .hx file - t = bld(rule='cp ${SRC} ${TGT}', - source = out_files[1], - ext_out = '.c', - ext_in = '.x', - on_results=True, - target = hfile, - depends_on = name + '_ASN1', - name = name + '_H') - - # and generate a .h file from the .hx file - t = bld(rule='cp ${SRC} ${TGT}', - source = out_files[2], - ext_out = '.c', - ext_in = '.x', - on_results=True, - target = hpriv, - depends_on = name + '_ASN1', - name = name + '_PRIV_H') - - bld.SET_BUILD_GROUP('main') - - includes = TO_LIST(includes) - includes.append(os.path.dirname(out_files[0])) - - t = bld(features = 'cc', - source = cfile, - target = name, - samba_cflags = CURRENT_CFLAGS(bld, name, ''), - depends_on = '', - samba_deps = TO_LIST('HEIMDAL_ROKEN'), - samba_includes = includes, - local_include = True) - -Build.BuildContext.SAMBA_ASN1 = SAMBA_ASN1 diff --git a/source4/heimdal_build/wscript_build b/source4/heimdal_build/wscript_build index 5254b3be3e..1b45fb7a4e 100644 --- a/source4/heimdal_build/wscript_build +++ b/source4/heimdal_build/wscript_build @@ -2,10 +2,114 @@ import Build import os -from samba_utils import SET_TARGET_TYPE +from samba_utils import SET_TARGET_TYPE, TO_LIST +from samba_autoconf import CURRENT_CFLAGS # waf build tool for building .et files with compile_et +def HEIMDAL_ASN1(bld, name, source, + options='', + directory='', + option_file=None, + includes=''): + '''Build a ASN1 file using the asn1 compiler. + This will produce 2 output files''' + bname = os.path.basename(source)[0:-5]; + dname = os.path.dirname(source) + asn1name = "%s_asn1" % bname + + if not SET_TARGET_TYPE(bld, name, 'ASN1'): + return + + # for ASN1 compilation, I always put it in build_source, as it doesn't make + # sense elsewhere + bld.SET_BUILD_GROUP('build_source') + + out_files = [] + out_files.append("../heimdal/%s/asn1_%s_asn1.x" % (directory, bname)) + out_files.append("../heimdal/%s/%s_asn1.hx" % (directory, bname)) + out_files.append("../heimdal/%s/%s_asn1-priv.hx" % (directory, bname)) + + # the ${TGT[0].parent.abspath(env)} expression gives us the parent directory of + # the first target in the build directory + # SRC[0].abspath(env) gives the absolute path to the source directory for the first + # source file. Note that in the case of a option_file, we have more than + # one source file + cd_rule = 'cd ${TGT[0].parent.abspath(env)}' + asn1_rule = cd_rule + ' && ${BLDBIN}/asn1_compile ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file ${SRC[0].abspath(env)} ${ASN1NAME}' + + source = TO_LIST(source) + source.append('asn1_compile') + + if option_file is not None: + source.append(option_file) + + t = bld(rule=asn1_rule, + ext_out = '.x', + before = 'cc', + on_results = True, + shell = True, + source = source, + target = out_files, + name=name + '_ASN1') + + t.env.ASN1NAME = asn1name + t.env.ASN1OPTIONS = options + t.env.BLDBIN = os.path.normpath(os.path.join(bld.srcnode.abspath(bld.env), '..')) + if option_file is not None: + t.env.OPTION_FILE = "--option-file=%s" % os.path.normpath(os.path.join(bld.curdir, option_file)) + + cfile = out_files[0][0:-2] + '.c' + hfile = out_files[1][0:-3] + '.h', + hpriv = out_files[2][0:-3] + '.h', + + # now generate a .c file from the .x file + t = bld(rule='''( echo '#include "config.h"' && cat ${SRC} ) > ${TGT}''', + source = out_files[0], + target = cfile, + shell = True, + on_results=True, + ext_out = '.c', + ext_in = '.x', + depends_on = name + '_ASN1', + name = name + '_C') + + # and generate a .h file from the .hx file + t = bld(rule='cp ${SRC} ${TGT}', + source = out_files[1], + ext_out = '.c', + ext_in = '.x', + on_results=True, + target = hfile, + depends_on = name + '_ASN1', + name = name + '_H') + + # and generate a .h file from the .hx file + t = bld(rule='cp ${SRC} ${TGT}', + source = out_files[2], + ext_out = '.c', + ext_in = '.x', + on_results=True, + target = hpriv, + depends_on = name + '_ASN1', + name = name + '_PRIV_H') + + bld.SET_BUILD_GROUP('main') + + includes = TO_LIST(includes) + includes.append(os.path.dirname(out_files[0])) + + t = bld(features = 'cc', + source = cfile, + target = name, + samba_cflags = CURRENT_CFLAGS(bld, name, ''), + depends_on = '', + samba_deps = TO_LIST('HEIMDAL_ROKEN'), + samba_includes = includes, + local_include = True) + +Build.BuildContext.HEIMDAL_ASN1 = HEIMDAL_ASN1 + def HEIMDAL_ERRTABLE(bld, name, source): '''Build a heimdal errtable from a .et file''' @@ -109,7 +213,7 @@ bld.SAMBA_GENERATOR( ) -bld.SAMBA_ASN1('HEIMDAL_SPNEGO_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_SPNEGO_ASN1', source='../heimdal/lib/gssapi/spnego/spnego.asn1', options='--sequence=MechTypeList', includes='../heimdal/lib/asn1', @@ -117,65 +221,65 @@ bld.SAMBA_ASN1('HEIMDAL_SPNEGO_ASN1', ) -bld.SAMBA_ASN1('HEIMDAL_GSSAPI_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_GSSAPI_ASN1', '../heimdal/lib/gssapi/mech/gssapi.asn1', includes='../heimdal/lib/asn1', directory='lib/gssapi' ) -bld.SAMBA_ASN1('HEIMDAL_KRB5_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_KRB5_ASN1', '../heimdal/lib/asn1/krb5.asn1', option_file='../heimdal/lib/asn1/krb5.opt', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_DIGEST_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_DIGEST_ASN1', '../heimdal/lib/asn1/digest.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_PKCS8_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_PKCS8_ASN1', '../heimdal/lib/asn1/pkcs8.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_PKCS9_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_PKCS9_ASN1', '../heimdal/lib/asn1/pkcs9.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_PKCS12_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_PKCS12_ASN1', '../heimdal/lib/asn1/pkcs12.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_RFC2459_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_RFC2459_ASN1', '../heimdal/lib/asn1/rfc2459.asn1', options='--preserve-binary=TBSCertificate --preserve-binary=TBSCRLCertList --preserve-binary=Name --sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoints', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_PKINIT_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_PKINIT_ASN1', '../heimdal/lib/asn1/pkinit.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_CMS_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_CMS_ASN1', '../heimdal/lib/asn1/cms.asn1', option_file='../heimdal/lib/asn1/cms.opt', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_OCSP_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_OCSP_ASN1', '../heimdal/lib/hx509/ocsp.asn1', options='--preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData', includes='../heimdal/lib/asn1', @@ -183,13 +287,13 @@ bld.SAMBA_ASN1('HEIMDAL_OCSP_ASN1', ) -bld.SAMBA_ASN1('HEIMDAL_KX509_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_KX509_ASN1', '../heimdal/lib/asn1/kx509.asn1', directory='lib/asn1' ) -bld.SAMBA_ASN1('HEIMDAL_PKCS10_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_PKCS10_ASN1', '../heimdal/lib/hx509/pkcs10.asn1', options='--preserve-binary=CertificationRequestInfo', includes='../heimdal/lib/asn1', @@ -197,7 +301,7 @@ bld.SAMBA_ASN1('HEIMDAL_PKCS10_ASN1', ) -bld.SAMBA_ASN1('HEIMDAL_HDB_ASN1', +bld.HEIMDAL_ASN1('HEIMDAL_HDB_ASN1', '../heimdal/lib/hdb/hdb.asn1', includes='../heimdal/lib/asn1') |