build: Use bison at build time rather than lexyacc.sh to build the embedded heimdal
[cs/samba-autobuild/.git] / source4 / heimdal_build / wscript_build
1 #!/usr/bin/env python
2
3 import os
4 from waflib import Context
5 from samba_utils import SET_TARGET_TYPE
6 from samba_autoconf import CURRENT_CFLAGS
7 from samba_utils import LOAD_ENVIRONMENT, TO_LIST
8
9 def heimdal_path(p, absolute=False):
10     hpath = os.path.join("../heimdal", p)
11     if not absolute:
12         return hpath
13     return os.path.normpath(os.path.join(bld.path.abspath(), hpath))
14
15 def heimdal_paths(ps):
16     return [heimdal_path(p) for p in TO_LIST(ps)]
17
18 # waf build tool for building .et files with compile_et
19 def HEIMDAL_ASN1(name, source,
20                options='',
21                directory='',
22                option_file=None,
23                includes=''):
24     '''Build a ASN1 file using the asn1 compiler.
25        This will produce 2 output files'''
26     source = heimdal_path(source)
27     bname = os.path.basename(source)[0:-5];
28     dname = os.path.dirname(source)
29     asn1name = "%s_asn1" % bname
30
31     if option_file:
32         option_file = heimdal_path(option_file)
33
34     if not SET_TARGET_TYPE(bld, name, 'ASN1'):
35         return
36
37     # for ASN1 compilation, I always put it in build_source, as it doesn't make
38     # sense elsewhere
39     bld.set_group('build_source')
40
41     out_files = heimdal_paths([
42         "%s/asn1_%s_asn1.x" % (directory, bname),
43         "%s/%s_asn1.hx" % (directory, bname),
44         "%s/%s_asn1-priv.hx" % (directory, bname),
45         ])
46
47     # the ${TGT[0].parent.abspath(env)} expression gives us the parent directory of
48     # the first target in the build directory
49     # SRC[0].abspath(env) gives the absolute path to the source directory for the first
50     # source file. Note that in the case of a option_file, we have more than
51     # one source file
52     cd_rule = 'cd "${TGT[0].parent.abspath(env)}" &&'
53     env = LOAD_ENVIRONMENT()
54     if env.ADDRESS_SANITIZER:
55         # If address sanitizer is enabled, we need to suppress leak checking
56         # in the asn1 tool.
57         no_leak_check = " ASAN_OPTIONS=detect_leaks=0"
58     else:
59         no_leak_check = ""
60
61     asn1_rule = cd_rule + no_leak_check + ' "${ASN1_COMPILE}" ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file "${SRC[0].abspath(env)}" ${ASN1NAME}'
62
63     source = TO_LIST(source)
64
65     if option_file is not None:
66         source.append(option_file)
67
68     deps = ''
69     if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
70         deps = 'asn1_compile'
71
72     t = bld(rule=asn1_rule,
73             ext_out = '.x',
74             before = 'c',
75             update_outputs = True,
76             shell = True,
77             source = source,
78             target = out_files,
79             depends_on = deps,
80             name=name + '_ASN1')
81
82     t.env.ASN1NAME     = asn1name
83     t.env.ASN1OPTIONS  = options
84     t.env.BLDBIN       = os.path.normpath(os.path.join(bld.srcnode.abspath(bld.env), '..'))
85     if option_file is not None:
86         t.env.OPTION_FILE = "--option-file='%s'" % \
87             os.path.normpath(os.path.join(bld.path.abspath(), option_file))
88
89     cfile = out_files[0][0:-2] + '.c'
90     hfile = out_files[1][0:-3] + '.h'
91     hpriv = out_files[2][0:-3] + '.h'
92
93     # now generate a .c file from the .x file
94     t = bld(rule='''( echo '#include "config.h"' && cat ${SRC} ) > ${TGT}''',
95             source = out_files[0],
96             target = cfile,
97             shell = True,
98             update_outputs=True,
99             ext_out = '.c',
100             ext_in = '.x',
101             depends_on = name + '_ASN1',
102             name = name + '_C')
103
104     # and generate a .h file from the .hx file
105     t = bld(rule='cp ${SRC} ${TGT}',
106             source = out_files[1],
107             ext_out = '.c',
108             ext_in = '.x',
109             update_outputs=True,
110             target = hfile,
111             depends_on = name + '_ASN1',
112             name = name + '_H')
113
114     # and generate a .h file from the .hx file
115     t = bld(rule='cp ${SRC} ${TGT}',
116             source = out_files[2],
117             ext_out = '.c',
118             ext_in = '.x',
119             update_outputs=True,
120             target = hpriv,
121             depends_on = name + '_ASN1',
122             name = name + '_PRIV_H')
123
124     bld.set_group('main')
125
126     includes = TO_LIST(includes)
127     includes.append(os.path.dirname(out_files[0]))
128
129     t = bld(features       = 'c',
130             source         = cfile,
131             target         = name,
132             samba_cflags   = CURRENT_CFLAGS(bld, name, ''),
133             depends_on     = '',
134             samba_deps     = TO_LIST('roken replace'),
135             samba_includes = includes,
136             local_include  = True)
137
138
139 def HEIMDAL_ERRTABLE(name, source):
140     '''Build a heimdal errtable from a .et file'''
141
142     source = heimdal_path(source)
143
144     bname = source[0:-3]; # strip off the .et suffix
145
146     if not SET_TARGET_TYPE(bld, name, 'ET'):
147         return
148
149     bld.set_group('build_source')
150
151     out_files = []
152     out_files.append('%s.c' % bname)
153     out_files.append('%s.h' % bname)
154
155     sources = [source, 'et_compile_wrapper.sh']
156
157     deps = ''
158     if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
159         deps = 'compile_et'
160
161     t = bld(rule='"${SRC[1].abspath(env)}" "${TGT[0].parent.abspath(env)}" "${COMPILE_ET}" "${SRC[0].abspath(env)}" ${TGT[0].bldpath(env)}',
162             ext_out = '.c',
163             before  = 'c',
164             update_outputs = True,
165             shell   = True,
166             source  = sources,
167             target  = out_files,
168             depends_on = deps,
169             name    = name)
170
171 def HEIMDAL_AUTOPROTO(header, source, options=None, group='prototypes'):
172     '''rule for heimdal prototype generation'''
173     header = heimdal_path(header)
174     bld.set_group(group)
175     if options is None:
176         options='-q -P comment -o'
177     SET_TARGET_TYPE(bld, header, 'PROTOTYPE')
178     source = heimdal_paths(source)
179     t = bld(rule='${PERL} "${HEIMDAL}/cf/make-proto.pl" ${OPTIONS} "${TGT[0].abspath(env)}" ${SRC}',
180             source=source,
181             target=header,
182             update_outputs=True,
183             ext_out='.c',
184             before='c')
185     t.env.HEIMDAL = os.path.join(bld.srcnode.abspath(), 'source4/heimdal')
186     t.env.OPTIONS = options
187
188
189 def HEIMDAL_AUTOPROTO_PRIVATE(header, source):
190     '''rule for private heimdal prototype generation'''
191     HEIMDAL_AUTOPROTO(header, source, options='-q -P comment -p')
192
193
194 def HEIMDAL_GENERATOR(name, rule, source='', target='',
195                       group='generators'):
196     '''A generic source generator target'''
197
198     if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
199         return
200
201     bld.set_group(group)
202     return bld(
203         rule=rule,
204         source=source,
205         target=target,
206         shell=isinstance(rule, str),
207         update_outputs=True,
208         before='c',
209         ext_out='.c',
210         vars=[rule],
211         samba_type='GENERATOR',
212         name=name)
213
214
215 def HEIMDAL_LIBRARY(libname, source, deps, vnum, version_script, includes=''):
216     '''define a Heimdal library'''
217
218     obj_target = libname + '.objlist'
219
220     # first create a target for building the object files for this library
221     # by separating in this way, we avoid recompiling the C files
222     # separately for the install library and the build library
223     HEIMDAL_SUBSYSTEM(obj_target,
224                         source         = source,
225                         deps           = deps,
226                         includes       = includes,
227                         group          = 'main')
228
229     if not SET_TARGET_TYPE(bld, libname, "LIBRARY"):
230         return
231
232     # the library itself will depend on that object target
233     deps = TO_LIST(deps)
234     deps.append(obj_target)
235
236     ldflags = []
237
238     # FIXME: When building upstream heimdal, we should not be adding this
239     # suffix.
240     bundled_build = True
241     if bundled_build:
242         bundled_name = libname + '-samba4'
243     else:
244         bundled_name = libname
245     version = "%s_%s" % (Context.g_module.APPNAME, Context.g_module.VERSION)
246
247     features = 'c cshlib symlink_lib install_lib'
248
249     bld.set_group('main')
250     t = bld(
251         features        = features,
252         source          = [],
253         target          = bundled_name,
254         samba_deps      = deps,
255         samba_includes  = includes,
256         vnum            = vnum,
257         install_path    = None,
258         name            = libname,
259         ldflags         = ldflags,
260         vars            = [version],
261         private_library = bundled_build,
262         version_script  = heimdal_path(version_script, absolute=True),
263         )
264
265
266 def HEIMDAL_SUBSYSTEM(modname, source,
267                     deps='',
268                     includes='',
269                     cflags='',
270                     group='main',
271                     use_hostcc=False,
272                     use_global_deps=True):
273     '''define a Heimdal subsystem'''
274
275     if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
276         return
277
278     source = heimdal_paths(source)
279
280     bld.set_group(group)
281
282     # If we found the -Wno-error options we need then build without
283     # allowing warnings, otherwise permit them
284     if bld.env.enable_heimdal_warnings:
285         samba_cflags = CURRENT_CFLAGS(bld, modname, cflags) + \
286                        bld.env.HEIMDAL_PICKY_CFLAGS
287     else:
288         samba_cflags = CURRENT_CFLAGS(bld, modname, cflags,
289                                       allow_warnings=True) + \
290                        bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS
291
292     return bld(
293         features       = 'c',
294         source         = source,
295         target         = modname,
296         samba_cflags   = samba_cflags,
297         depends_on     = '',
298         samba_deps     = TO_LIST(deps),
299         samba_includes = includes,
300         local_include  = True,
301         local_include_first  = True,
302         samba_use_hostcc = use_hostcc,
303         samba_use_global_deps = use_global_deps
304         )
305
306
307 def HEIMDAL_BINARY(binname, source,
308                  deps='',
309                  includes='',
310                  cflags='',
311                  use_hostcc=False,
312                  use_global_deps=True,
313                  compiler=None,
314                  group='main',
315                  install=True,
316                  install_path=None):
317     '''define a Samba binary'''
318
319     source = heimdal_paths(source)
320
321     obj_target = binname + '.heimdal.objlist'
322
323     HEIMDAL_SUBSYSTEM(obj_target,
324                       source         = source,
325                       deps           = deps,
326                       includes       = includes,
327                       cflags         = cflags,
328                       group          = group,
329                       use_hostcc     = use_hostcc,
330                       use_global_deps= use_global_deps)
331
332     bld.SAMBA_BINARY(binname,
333                      source         = '',
334                      deps           = obj_target,
335                      includes       = includes,
336                      cflags         = cflags,
337                      group          = group,
338                      use_hostcc     = use_hostcc,
339                      use_global_deps= use_global_deps,
340                      install_path   = None,
341                      install        = install)
342
343
344 if not bld.CONFIG_SET('USING_SYSTEM_ROKEN'):
345
346     if not bld.CONFIG_SET('HAVE_IFADDRS_H'):
347         HEIMDAL_GENERATOR(
348             name="HEIMDAL_IFADDRS_H",
349             rule="rm -f ${TGT} && ln ${SRC} ${TGT}",
350             source = 'ifaddrs.hin',
351             target = 'ifaddrs.h',
352             )
353
354     if not bld.CONFIG_SET('HAVE_ERR_H'):
355         HEIMDAL_GENERATOR(
356             group='build_compiler_source',
357             name="HEIMDAL_ERR_H",
358             rule="rm -f ${TGT} && ln ${SRC} ${TGT}",
359             source = '../heimdal/lib/roken/err.hin',
360             target = '../heimdal/lib/roken/err.h',
361             )
362
363     ROKEN_COMMON_SOURCE = '''
364         lib/roken/base64.c
365         lib/roken/ct.c
366         lib/roken/hex.c
367         lib/roken/bswap.c
368         lib/roken/dumpdata.c
369         lib/roken/emalloc.c
370         lib/roken/ecalloc.c
371         lib/roken/getarg.c
372         lib/roken/get_window_size.c
373         lib/roken/getdtablesize.c
374         lib/roken/h_errno.c
375         lib/roken/issuid.c
376         lib/roken/net_read.c
377         lib/roken/net_write.c
378         lib/roken/parse_time.c
379         lib/roken/parse_units.c
380         lib/roken/vis.c
381         lib/roken/strlwr.c
382         lib/roken/strsep_copy.c
383         lib/roken/strsep.c
384         lib/roken/strupr.c
385         lib/roken/strpool.c
386         lib/roken/estrdup.c
387         lib/roken/erealloc.c
388         lib/roken/simple_exec.c
389         lib/roken/strcollect.c
390         lib/roken/rtbl.c
391         lib/roken/rand.c
392         lib/roken/cloexec.c
393         lib/roken/xfree.c
394         ../heimdal_build/replace.c
395     '''
396
397     ROKEN_HOSTCC_SOURCE = ROKEN_COMMON_SOURCE
398
399     ROKEN_SOURCE = ROKEN_COMMON_SOURCE + '''
400         lib/roken/resolve.c
401         lib/roken/socket.c
402         lib/roken/roken_gethostby.c
403     '''
404
405     HEIMDAL_LIBRARY('roken',
406         ROKEN_SOURCE,
407         includes='../heimdal/lib/roken ../heimdal/include ../heimdal_build/include',
408         deps='resolv util replace',
409         vnum='19.0.1',
410         version_script='lib/roken/version-script.map',
411         )
412
413     HEIMDAL_SUBSYSTEM('ROKEN_HOSTCC',
414         ROKEN_HOSTCC_SOURCE,
415         use_hostcc=True,
416         use_global_deps=False,
417         includes='../heimdal/lib/roken ../heimdal/include ../heimdal_build/include',
418         group='compiler_libraries',
419         deps='LIBREPLACE_HOSTCC',
420         )
421
422 if not bld.CONFIG_SET("USING_SYSTEM_KDC"):
423     HEIMDAL_ASN1('HEIMDAL_KX509_ASN1',
424         'lib/asn1/kx509.asn1',
425         directory='lib/asn1'
426         )
427     HEIMDAL_ASN1('HEIMDAL_DIGEST_ASN1',
428         'lib/asn1/digest.asn1',
429         directory='lib/asn1'
430         )
431
432     KDC_SOURCE='kdc/default_config.c kdc/kerberos5.c kdc/krb5tgs.c kdc/pkinit.c kdc/log.c kdc/misc.c kdc/digest.c kdc/process.c kdc/windc.c kdc/kx509.c'
433
434     HEIMDAL_LIBRARY('kdc', source=KDC_SOURCE,
435                         includes='../heimdal/kdc',
436                         deps='roken krb5 hdb asn1 HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1 heimntlm hcrypto com_err wind heimbase',
437                         vnum='2.0.0',
438                         version_script='kdc/version-script.map')
439     HEIMDAL_AUTOPROTO('kdc/kdc-protos.h', KDC_SOURCE)
440     HEIMDAL_AUTOPROTO_PRIVATE('kdc/kdc-private.h', KDC_SOURCE)
441
442 if not bld.CONFIG_SET("USING_SYSTEM_HEIMNTLM"):
443     HEIMDAL_ERRTABLE('HEIMNTLM_ET',
444                      'lib/ntlm/ntlm_err.et')
445
446     HEIMNTLM_SOURCE = 'lib/ntlm/ntlm.c'
447     HEIMDAL_LIBRARY('heimntlm',
448                         source=HEIMNTLM_SOURCE,
449                         includes='../heimdal/lib/ntlm',
450                         deps='roken hcrypto krb5',
451                         vnum='1.0.1',
452                         version_script='lib/ntlm/version-script.map',
453         )
454     HEIMDAL_AUTOPROTO('lib/ntlm/heimntlm-protos.h', HEIMNTLM_SOURCE)
455
456 if not bld.CONFIG_SET("USING_SYSTEM_HDB"):
457     HEIMDAL_ASN1('HEIMDAL_HDB_ASN1', 'lib/hdb/hdb.asn1',
458         directory='lib/asn1',
459         options="--sequence=HDB-Ext-KeySet --sequence=Keys",
460         includes='../heimdal/lib/asn1')
461
462     HDB_KEYS_SOURCE = 'lib/hdb/keys.c'
463
464     HEIMDAL_SUBSYSTEM('HEIMDAL_HDB_KEYS',
465         HDB_KEYS_SOURCE,
466         includes='../heimdal/lib/hdb',
467         deps='roken hcrypto krb5 HEIMDAL_HDB_ASN1',
468         )
469
470     HEIMDAL_ERRTABLE('HEIMDAL_HDB_ERR_ET', 'lib/hdb/hdb_err.et')
471
472     HDB_SOURCE = '''lib/hdb/db.c lib/hdb/dbinfo.c lib/hdb/hdb.c
473                                   lib/hdb/ext.c lib/hdb/keytab.c lib/hdb/hdb-keytab.c
474                                   lib/hdb/mkey.c lib/hdb/ndbm.c lib/hdb/hdb_err.c
475                                   ../heimdal_build/hdb-glue.c'''
476
477     HEIMDAL_LIBRARY('hdb',
478         version_script='lib/hdb/version-script.map',
479         source=HDB_SOURCE,
480         includes='../heimdal/lib/hdb',
481         deps='krb5 HEIMDAL_HDB_KEYS roken hcrypto com_err HEIMDAL_HDB_ASN1 wind',
482         vnum='11.0.2',
483         )
484     HEIMDAL_AUTOPROTO('lib/hdb/hdb-protos.h', HDB_SOURCE + " " + HDB_KEYS_SOURCE)
485     HEIMDAL_AUTOPROTO_PRIVATE('lib/hdb/hdb-private.h', HDB_SOURCE + " " + HDB_KEYS_SOURCE)
486
487
488 if not bld.CONFIG_SET("USING_SYSTEM_GSSAPI"):
489     HEIMDAL_ERRTABLE('HEIMDAL_GKRB5_ERR_ET', 'lib/gssapi/krb5/gkrb5_err.et')
490
491     HEIMDAL_ASN1('HEIMDAL_GSSAPI_ASN1',
492         'lib/gssapi/mech/gssapi.asn1',
493         includes='../heimdal/lib/asn1',
494         directory='lib/gssapi'
495         )
496
497     HEIMDAL_ASN1('HEIMDAL_SPNEGO_ASN1',
498         source='lib/gssapi/spnego/spnego.asn1',
499         options='--sequence=MechTypeList',
500         includes='../heimdal/lib/asn1',
501         directory='lib/gssapi'
502         )
503
504     HEIMDAL_GSSAPI_SPNEGO_SOURCE = '''
505         lib/gssapi/spnego/init_sec_context.c
506         lib/gssapi/spnego/external.c
507         lib/gssapi/spnego/compat.c
508         lib/gssapi/spnego/context_stubs.c
509         lib/gssapi/spnego/cred_stubs.c
510         lib/gssapi/spnego/accept_sec_context.c
511     '''
512
513     HEIMDAL_AUTOPROTO_PRIVATE('lib/gssapi/spnego/spnego-private.h',
514                               HEIMDAL_GSSAPI_SPNEGO_SOURCE)
515
516     HEIMDAL_GSSAPI_KRB5_SOURCE = '''
517         lib/gssapi/krb5/copy_ccache.c
518         lib/gssapi/krb5/delete_sec_context.c
519         lib/gssapi/krb5/init_sec_context.c
520         lib/gssapi/krb5/context_time.c
521         lib/gssapi/krb5/init.c
522         lib/gssapi/krb5/address_to_krb5addr.c
523         lib/gssapi/krb5/get_mic.c
524         lib/gssapi/krb5/inquire_context.c
525         lib/gssapi/krb5/add_cred.c
526         lib/gssapi/krb5/inquire_cred.c
527         lib/gssapi/krb5/inquire_cred_by_oid.c
528         lib/gssapi/krb5/inquire_cred_by_mech.c
529         lib/gssapi/krb5/inquire_mechs_for_name.c
530         lib/gssapi/krb5/inquire_names_for_mech.c
531         lib/gssapi/krb5/indicate_mechs.c
532         lib/gssapi/krb5/inquire_sec_context_by_oid.c
533         lib/gssapi/krb5/export_sec_context.c
534         lib/gssapi/krb5/import_sec_context.c
535         lib/gssapi/krb5/duplicate_name.c
536         lib/gssapi/krb5/import_name.c
537         lib/gssapi/krb5/compare_name.c
538         lib/gssapi/krb5/export_name.c
539         lib/gssapi/krb5/canonicalize_name.c
540         lib/gssapi/krb5/unwrap.c
541         lib/gssapi/krb5/wrap.c
542         lib/gssapi/krb5/release_name.c
543         lib/gssapi/krb5/cfx.c
544         lib/gssapi/krb5/8003.c
545         lib/gssapi/krb5/arcfour.c
546         lib/gssapi/krb5/encapsulate.c
547         lib/gssapi/krb5/display_name.c
548         lib/gssapi/krb5/sequence.c
549         lib/gssapi/krb5/display_status.c
550         lib/gssapi/krb5/release_buffer.c
551         lib/gssapi/krb5/external.c
552         lib/gssapi/krb5/compat.c
553         lib/gssapi/krb5/creds.c
554         lib/gssapi/krb5/acquire_cred.c
555         lib/gssapi/krb5/release_cred.c
556         lib/gssapi/krb5/store_cred.c
557         lib/gssapi/krb5/set_cred_option.c
558         lib/gssapi/krb5/decapsulate.c
559         lib/gssapi/krb5/verify_mic.c
560         lib/gssapi/krb5/accept_sec_context.c
561         lib/gssapi/krb5/set_sec_context_option.c
562         lib/gssapi/krb5/process_context_token.c
563         lib/gssapi/krb5/prf.c
564         lib/gssapi/krb5/aeap.c
565         lib/gssapi/krb5/pname_to_uid.c
566         lib/gssapi/krb5/authorize_localname.c
567     '''
568
569     HEIMDAL_AUTOPROTO_PRIVATE('lib/gssapi/krb5/gsskrb5-private.h',
570                               HEIMDAL_GSSAPI_KRB5_SOURCE)
571
572     HEIMDAL_LIBRARY('gssapi',
573                     HEIMDAL_GSSAPI_SPNEGO_SOURCE + HEIMDAL_GSSAPI_KRB5_SOURCE + '''
574     lib/gssapi/mech/context.c lib/gssapi/mech/gss_krb5.c lib/gssapi/mech/gss_mech_switch.c
575     lib/gssapi/mech/gss_process_context_token.c lib/gssapi/mech/gss_buffer_set.c
576     lib/gssapi/mech/gss_aeap.c lib/gssapi/mech/gss_add_cred.c lib/gssapi/mech/gss_cred.c
577     lib/gssapi/mech/gss_add_oid_set_member.c lib/gssapi/mech/gss_compare_name.c lib/gssapi/mech/gss_release_oid_set.c
578     lib/gssapi/mech/gss_create_empty_oid_set.c lib/gssapi/mech/gss_decapsulate_token.c lib/gssapi/mech/gss_inquire_cred_by_oid.c
579     lib/gssapi/mech/gss_canonicalize_name.c lib/gssapi/mech/gss_inquire_sec_context_by_oid.c lib/gssapi/mech/gss_inquire_names_for_mech.c
580     lib/gssapi/mech/gss_inquire_mechs_for_name.c lib/gssapi/mech/gss_wrap_size_limit.c lib/gssapi/mech/gss_names.c
581     lib/gssapi/mech/gss_verify.c lib/gssapi/mech/gss_display_name.c
582     lib/gssapi/mech/gss_duplicate_oid.c lib/gssapi/mech/gss_display_status.c lib/gssapi/mech/gss_release_buffer.c
583     lib/gssapi/mech/gss_release_oid.c lib/gssapi/mech/gss_test_oid_set_member.c
584     lib/gssapi/mech/gss_release_cred.c
585     lib/gssapi/mech/gss_set_sec_context_option.c lib/gssapi/mech/gss_export_name.c lib/gssapi/mech/gss_seal.c
586     lib/gssapi/mech/gss_acquire_cred.c lib/gssapi/mech/gss_unseal.c lib/gssapi/mech/gss_verify_mic.c
587     lib/gssapi/mech/gss_accept_sec_context.c lib/gssapi/mech/gss_inquire_cred_by_mech.c lib/gssapi/mech/gss_indicate_mechs.c
588     lib/gssapi/mech/gss_delete_sec_context.c lib/gssapi/mech/gss_sign.c lib/gssapi/mech/gss_utils.c
589     lib/gssapi/mech/gss_init_sec_context.c lib/gssapi/mech/gss_oid_equal.c lib/gssapi/mech/gss_oid.c
590     lib/gssapi/mech/gss_oid_to_str.c lib/gssapi/mech/gss_mo.c
591     lib/gssapi/mech/gss_context_time.c lib/gssapi/mech/gss_encapsulate_token.c lib/gssapi/mech/gss_get_mic.c
592     lib/gssapi/mech/gss_import_sec_context.c lib/gssapi/mech/gss_inquire_cred.c lib/gssapi/mech/gss_wrap.c
593     lib/gssapi/mech/gss_import_name.c lib/gssapi/mech/gss_duplicate_name.c lib/gssapi/mech/gss_unwrap.c
594     lib/gssapi/mech/gss_export_sec_context.c lib/gssapi/mech/gss_inquire_context.c lib/gssapi/mech/gss_release_name.c
595     lib/gssapi/mech/gss_set_cred_option.c  lib/gssapi/mech/gss_pseudo_random.c ../heimdal_build/gssapi-glue.c''',
596         includes='../heimdal/lib/gssapi ../heimdal/lib/gssapi/gssapi ../heimdal/lib/gssapi/spnego ../heimdal/lib/gssapi/krb5 ../heimdal/lib/gssapi/mech',
597         deps='hcrypto asn1 HEIMDAL_SPNEGO_ASN1 HEIMDAL_GSSAPI_ASN1 roken krb5 com_err wind heimbase',
598         vnum='2.0.0',
599         version_script='lib/gssapi/version-script.map',
600         )
601
602 if not bld.CONFIG_SET("USING_SYSTEM_KRB5"):
603     # expand_path.c needs some of the install paths
604     HEIMDAL_SUBSYSTEM('HEIMDAL_CONFIG',
605                       'lib/krb5/expand_path.c lib/krb5/plugin.c lib/krb5/context.c',
606                       includes='../heimdal/lib/krb5 ../heimdal/lib/asn1 ../heimdal/include',
607                       cflags=bld.dynconfig_cflags('LIBDIR BINDIR LIBEXECDIR SBINDIR'),
608                       deps='hcrypto heimbase wind hx509 com_err'
609                       )
610
611     HEIMDAL_ERRTABLE('HEIMDAL_KRB5_ERR_ET', 'lib/krb5/krb5_err.et')
612
613     HEIMDAL_ERRTABLE('HEIMDAL_KRB_ERR_ET', 'lib/krb5/krb_err.et')
614
615     HEIMDAL_ERRTABLE('HEIMDAL_K524_ERR_ET', 'lib/krb5/k524_err.et')
616
617     HEIMDAL_ERRTABLE('HEIMDAL_HEIM_ERR_ET', 'lib/krb5/heim_err.et')
618
619     KRB5_SOURCE = [os.path.join('lib/krb5/', x) for x in TO_LIST(
620                                    '''acache.c add_et_list.c
621                                    addr_families.c appdefault.c
622                                    asn1_glue.c auth_context.c
623                                    build_ap_req.c build_auth.c cache.c
624                                    changepw.c codec.c config_file.c
625                                    constants.c convert_creds.c
626                                    copy_host_realm.c crc.c creds.c
627                                    crypto.c crypto-aes.c crypto-algs.c
628                                    crypto-arcfour.c crypto-des3.c crypto-des.c
629                                    crypto-des-common.c crypto-evp.c
630                                    crypto-null.c crypto-pk.c crypto-rand.c
631                                    data.c eai_to_heim_errno.c
632                                    error_string.c expand_hostname.c
633                                    fcache.c free.c free_host_realm.c
634                                    generate_seq_number.c generate_subkey.c
635                                    get_addrs.c get_cred.c
636                                    get_default_principal.c
637                                    get_default_realm.c get_for_creds.c
638                                    get_host_realm.c get_in_tkt.c
639                                    get_port.c init_creds.c init_creds_pw.c
640                                    kcm.c keyblock.c keytab.c keytab_any.c
641                                    keytab_file.c keytab_memory.c
642                                    keytab_keyfile.c krbhst.c log.c
643                                    mcache.c misc.c mk_error.c mk_priv.c
644                                    mk_rep.c mk_req.c mk_req_ext.c
645                                    mit_glue.c n-fold.c padata.c pkinit.c
646                                    principal.c prog_setup.c pac.c
647                                    pcache.c prompter_posix.c rd_cred.c rd_error.c
648                                    rd_priv.c rd_rep.c rd_req.c replay.c
649                                    salt.c salt-aes.c salt-arcfour.c salt-des3.c salt-des.c
650                                    send_to_kdc.c set_default_realm.c
651                                    store.c store-int.c store_emem.c store_fd.c
652                                    store_mem.c ticket.c time.c transited.c
653                                    version.c warn.c krb5_err.c
654                                    aname_to_localname.c kuserok.c
655                                    heim_err.c k524_err.c krb_err.c''')]  + ["../heimdal_build/krb5-glue.c"]
656
657     HEIMDAL_LIBRARY('krb5', KRB5_SOURCE,
658         version_script='lib/krb5/version-script.map',
659                         includes='../heimdal/lib/krb5 ../heimdal/lib/asn1 ../heimdal/include',
660                 deps='roken wind asn1 hx509 hcrypto com_err HEIMDAL_CONFIG heimbase execinfo samba_intl',
661                 vnum='26.0.0',
662                         )
663     KRB5_PROTO_SOURCE = KRB5_SOURCE + ['lib/krb5/expand_path.c', 'lib/krb5/plugin.c', 'lib/krb5/context.c']
664
665     HEIMDAL_AUTOPROTO_PRIVATE('lib/krb5/krb5-private.h', KRB5_PROTO_SOURCE)
666     HEIMDAL_AUTOPROTO('lib/krb5/krb5-protos.h', KRB5_PROTO_SOURCE,
667         options='-E KRB5_LIB -q -P comment -o')
668
669 if not bld.CONFIG_SET("USING_SYSTEM_ASN1"):
670     HEIMDAL_HEIM_ASN1_DER_SOURCE = '''
671         lib/asn1/der_get.c
672         lib/asn1/der_put.c
673         lib/asn1/der_free.c
674         lib/asn1/der_format.c
675         lib/asn1/der_length.c
676         lib/asn1/der_copy.c
677         lib/asn1/der_cmp.c
678     '''
679
680     HEIMDAL_AUTOPROTO('lib/asn1/der-protos.h',
681                           HEIMDAL_HEIM_ASN1_DER_SOURCE,
682                           group = 'compiler_prototypes',
683                           options="-q -P comment -o")
684
685
686     HEIMDAL_AUTOPROTO('lib/asn1/der-private.h',
687                           HEIMDAL_HEIM_ASN1_DER_SOURCE,
688                           group = 'compiler_prototypes',
689                           options="-q -P comment -p")
690
691     HEIMDAL_ERRTABLE('HEIMDAL_ASN1_ERR_ET', 'lib/asn1/asn1_err.et')
692
693     heimdal_heim_asn1_cflags = ''
694     if bld.CONFIG_SET('HAVE_WNO_FORMAT_TRUNCATION'):
695         heimdal_heim_asn1_cflags = '-Wno-format-truncation'
696
697     HEIMDAL_SUBSYSTEM('HEIMDAL_HEIM_ASN1',
698         HEIMDAL_HEIM_ASN1_DER_SOURCE + 'lib/asn1/extra.c lib/asn1/timegm.c lib/asn1/asn1_err.c',
699         includes='../heimdal/lib/asn1',
700         cflags=heimdal_heim_asn1_cflags,
701         deps='roken com_err'
702         )
703
704     HEIMDAL_ASN1('HEIMDAL_RFC2459_ASN1',
705         'lib/asn1/rfc2459.asn1',
706         options='--preserve-binary=TBSCertificate --preserve-binary=TBSCRLCertList --preserve-binary=Name --sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoints',
707         directory='lib/asn1'
708         )
709
710     HEIMDAL_ASN1('HEIMDAL_KRB5_ASN1',
711         'lib/asn1/krb5.asn1',
712         option_file='lib/asn1/krb5.opt',
713         directory='lib/asn1'
714         )
715
716     HEIMDAL_ASN1('HEIMDAL_PKINIT_ASN1',
717         'lib/asn1/pkinit.asn1',
718         directory='lib/asn1'
719         )
720
721     HEIMDAL_ASN1('HEIMDAL_CMS_ASN1',
722         'lib/asn1/cms.asn1',
723         option_file='lib/asn1/cms.opt',
724         directory='lib/asn1'
725         )
726
727     HEIMDAL_LIBRARY('asn1',
728             version_script='lib/asn1/version-script.map',
729             deps="HEIMDAL_HEIM_ASN1 HEIMDAL_RFC2459_ASN1 HEIMDAL_KRB5_ASN1 HEIMDAL_PKINIT_ASN1 HEIMDAL_CMS_ASN1",
730             source='',
731             vnum='8.0.0')
732
733 if not bld.CONFIG_SET('USING_SYSTEM_HCRYPTO'):
734     if not bld.CONFIG_SET("USING_SYSTEM_TOMMATH"):
735         HEIMDAL_SUBSYSTEM('tommath',
736         'lib/hcrypto/libtommath/bncore.c lib/hcrypto/libtommath/bn_mp_init.c lib/hcrypto/libtommath/bn_mp_clear.c lib/hcrypto/libtommath/bn_mp_exch.c lib/hcrypto/libtommath/bn_mp_grow.c lib/hcrypto/libtommath/bn_mp_shrink.c lib/hcrypto/libtommath/bn_mp_clamp.c lib/hcrypto/libtommath/bn_mp_zero.c lib/hcrypto/libtommath/bn_mp_zero_multi.c lib/hcrypto/libtommath/bn_mp_set.c lib/hcrypto/libtommath/bn_mp_set_int.c lib/hcrypto/libtommath/bn_mp_init_size.c lib/hcrypto/libtommath/bn_mp_copy.c lib/hcrypto/libtommath/bn_mp_init_copy.c lib/hcrypto/libtommath/bn_mp_abs.c lib/hcrypto/libtommath/bn_mp_neg.c lib/hcrypto/libtommath/bn_mp_cmp_mag.c lib/hcrypto/libtommath/bn_mp_cmp.c lib/hcrypto/libtommath/bn_mp_cmp_d.c lib/hcrypto/libtommath/bn_mp_rshd.c lib/hcrypto/libtommath/bn_mp_lshd.c lib/hcrypto/libtommath/bn_mp_mod_2d.c lib/hcrypto/libtommath/bn_mp_div_2d.c lib/hcrypto/libtommath/bn_mp_mul_2d.c lib/hcrypto/libtommath/bn_mp_div_2.c lib/hcrypto/libtommath/bn_mp_mul_2.c lib/hcrypto/libtommath/bn_s_mp_add.c lib/hcrypto/libtommath/bn_s_mp_sub.c lib/hcrypto/libtommath/bn_fast_s_mp_mul_digs.c lib/hcrypto/libtommath/bn_s_mp_mul_digs.c lib/hcrypto/libtommath/bn_fast_s_mp_mul_high_digs.c lib/hcrypto/libtommath/bn_s_mp_mul_high_digs.c lib/hcrypto/libtommath/bn_fast_s_mp_sqr.c lib/hcrypto/libtommath/bn_s_mp_sqr.c lib/hcrypto/libtommath/bn_mp_add.c lib/hcrypto/libtommath/bn_mp_sub.c lib/hcrypto/libtommath/bn_mp_karatsuba_mul.c lib/hcrypto/libtommath/bn_mp_mul.c lib/hcrypto/libtommath/bn_mp_karatsuba_sqr.c lib/hcrypto/libtommath/bn_mp_sqr.c lib/hcrypto/libtommath/bn_mp_div.c lib/hcrypto/libtommath/bn_mp_mod.c lib/hcrypto/libtommath/bn_mp_add_d.c lib/hcrypto/libtommath/bn_mp_sub_d.c lib/hcrypto/libtommath/bn_mp_mul_d.c lib/hcrypto/libtommath/bn_mp_div_d.c lib/hcrypto/libtommath/bn_mp_mod_d.c lib/hcrypto/libtommath/bn_mp_expt_d.c lib/hcrypto/libtommath/bn_mp_addmod.c lib/hcrypto/libtommath/bn_mp_submod.c lib/hcrypto/libtommath/bn_mp_mulmod.c lib/hcrypto/libtommath/bn_mp_sqrmod.c lib/hcrypto/libtommath/bn_mp_gcd.c lib/hcrypto/libtommath/bn_mp_lcm.c lib/hcrypto/libtommath/bn_fast_mp_invmod.c lib/hcrypto/libtommath/bn_mp_invmod.c lib/hcrypto/libtommath/bn_mp_reduce.c lib/hcrypto/libtommath/bn_mp_montgomery_setup.c lib/hcrypto/libtommath/bn_fast_mp_montgomery_reduce.c lib/hcrypto/libtommath/bn_mp_montgomery_reduce.c lib/hcrypto/libtommath/bn_mp_exptmod_fast.c lib/hcrypto/libtommath/bn_mp_exptmod.c lib/hcrypto/libtommath/bn_mp_2expt.c lib/hcrypto/libtommath/bn_mp_n_root.c lib/hcrypto/libtommath/bn_mp_jacobi.c lib/hcrypto/libtommath/bn_reverse.c lib/hcrypto/libtommath/bn_mp_count_bits.c lib/hcrypto/libtommath/bn_mp_read_unsigned_bin.c lib/hcrypto/libtommath/bn_mp_read_signed_bin.c lib/hcrypto/libtommath/bn_mp_to_unsigned_bin.c lib/hcrypto/libtommath/bn_mp_to_signed_bin.c lib/hcrypto/libtommath/bn_mp_unsigned_bin_size.c lib/hcrypto/libtommath/bn_mp_signed_bin_size.c lib/hcrypto/libtommath/bn_mp_xor.c lib/hcrypto/libtommath/bn_mp_and.c lib/hcrypto/libtommath/bn_mp_or.c lib/hcrypto/libtommath/bn_mp_rand.c lib/hcrypto/libtommath/bn_mp_montgomery_calc_normalization.c lib/hcrypto/libtommath/bn_mp_prime_is_divisible.c lib/hcrypto/libtommath/bn_prime_tab.c lib/hcrypto/libtommath/bn_mp_prime_fermat.c lib/hcrypto/libtommath/bn_mp_prime_miller_rabin.c lib/hcrypto/libtommath/bn_mp_prime_is_prime.c lib/hcrypto/libtommath/bn_mp_prime_next_prime.c lib/hcrypto/libtommath/bn_mp_find_prime.c lib/hcrypto/libtommath/bn_mp_isprime.c lib/hcrypto/libtommath/bn_mp_dr_reduce.c lib/hcrypto/libtommath/bn_mp_dr_is_modulus.c lib/hcrypto/libtommath/bn_mp_dr_setup.c lib/hcrypto/libtommath/bn_mp_reduce_setup.c lib/hcrypto/libtommath/bn_mp_toom_mul.c lib/hcrypto/libtommath/bn_mp_toom_sqr.c lib/hcrypto/libtommath/bn_mp_div_3.c lib/hcrypto/libtommath/bn_s_mp_exptmod.c lib/hcrypto/libtommath/bn_mp_reduce_2k.c lib/hcrypto/libtommath/bn_mp_reduce_is_2k.c lib/hcrypto/libtommath/bn_mp_reduce_2k_setup.c lib/hcrypto/libtommath/bn_mp_reduce_2k_l.c lib/hcrypto/libtommath/bn_mp_reduce_is_2k_l.c lib/hcrypto/libtommath/bn_mp_reduce_2k_setup_l.c lib/hcrypto/libtommath/bn_mp_radix_smap.c lib/hcrypto/libtommath/bn_mp_read_radix.c lib/hcrypto/libtommath/bn_mp_toradix.c lib/hcrypto/libtommath/bn_mp_radix_size.c lib/hcrypto/libtommath/bn_mp_fread.c lib/hcrypto/libtommath/bn_mp_fwrite.c lib/hcrypto/libtommath/bn_mp_cnt_lsb.c lib/hcrypto/libtommath/bn_error.c lib/hcrypto/libtommath/bn_mp_init_multi.c lib/hcrypto/libtommath/bn_mp_clear_multi.c lib/hcrypto/libtommath/bn_mp_exteuclid.c lib/hcrypto/libtommath/bn_mp_toradix_n.c lib/hcrypto/libtommath/bn_mp_prime_random_ex.c lib/hcrypto/libtommath/bn_mp_get_int.c lib/hcrypto/libtommath/bn_mp_sqrt.c lib/hcrypto/libtommath/bn_mp_is_square.c lib/hcrypto/libtommath/bn_mp_init_set.c lib/hcrypto/libtommath/bn_mp_init_set_int.c lib/hcrypto/libtommath/bn_mp_invmod_slow.c lib/hcrypto/libtommath/bn_mp_prime_rabin_miller_trials.c lib/hcrypto/libtommath/bn_mp_to_signed_bin_n.c lib/hcrypto/libtommath/bn_mp_to_unsigned_bin_n.c',
737             includes='../heimdal/lib/hcrypto/libtommath'
738             )
739
740     HEIMDAL_LIBRARY('hcrypto',
741         'lib/hcrypto/aes.c lib/hcrypto/bn.c lib/hcrypto/dh.c lib/hcrypto/dh-ltm.c lib/hcrypto/des.c lib/hcrypto/dsa.c lib/hcrypto/engine.c lib/hcrypto/md2.c lib/hcrypto/md4.c lib/hcrypto/md5.c lib/hcrypto/rsa.c lib/hcrypto/rsa-ltm.c lib/hcrypto/rc2.c lib/hcrypto/rc4.c lib/hcrypto/rijndael-alg-fst.c lib/hcrypto/rnd_keys.c lib/hcrypto/sha.c lib/hcrypto/sha256.c lib/hcrypto/sha512.c lib/hcrypto/ui.c lib/hcrypto/evp.c lib/hcrypto/evp-hcrypto.c lib/hcrypto/pkcs5.c lib/hcrypto/pkcs12.c lib/hcrypto/rand.c lib/hcrypto/rand-egd.c lib/hcrypto/rand-unix.c lib/hcrypto/rand-fortuna.c lib/hcrypto/rand-timer.c lib/hcrypto/hmac.c lib/hcrypto/camellia.c lib/hcrypto/camellia-ntt.c lib/hcrypto/common.c lib/hcrypto/validate.c',
742         includes='../heimdal/lib/hcrypto ../heimdal/lib ../heimdal/include',
743         deps='roken asn1 tommath replace',
744         version_script='lib/hcrypto/version-script.map',
745         vnum='5.0.1',
746         )
747
748 if not bld.CONFIG_SET('USING_SYSTEM_HEIMBASE'):
749     HEIMDAL_LIBRARY('heimbase',
750         'base/array.c base/bool.c base/dict.c base/heimbase.c base/string.c base/number.c base/null.c',
751         includes='../heimdal/base ../heimdal/include',
752         deps='roken replace',
753         version_script='base/version-script.map',
754         vnum='1.0.0',
755         )
756
757
758 if not bld.CONFIG_SET("USING_SYSTEM_HX509"):
759     HEIMDAL_ASN1('HEIMDAL_OCSP_ASN1',
760         'lib/hx509/ocsp.asn1',
761         options='--preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData',
762         includes='../heimdal/lib/asn1',
763         directory='lib/hx509'
764         )
765
766     HEIMDAL_ASN1('HEIMDAL_PKCS8_ASN1',
767         'lib/asn1/pkcs8.asn1',
768         directory='lib/asn1'
769         )
770
771
772     HEIMDAL_ASN1('HEIMDAL_PKCS9_ASN1',
773         'lib/asn1/pkcs9.asn1',
774         directory='lib/asn1'
775         )
776
777
778     HEIMDAL_ASN1('HEIMDAL_PKCS12_ASN1',
779         'lib/asn1/pkcs12.asn1',
780         directory='lib/asn1'
781         )
782
783     HEIMDAL_ASN1('HEIMDAL_PKCS10_ASN1',
784         'lib/hx509/pkcs10.asn1',
785         options='--preserve-binary=CertificationRequestInfo',
786         includes='../heimdal/lib/asn1',
787         directory='lib/hx509'
788         )
789
790     HEIMDAL_ERRTABLE('HEIMDAL_HX509_ERR_ET',
791         'lib/hx509/hx509_err.et')
792
793     HEIMDAL_HX509_OBJH_SOURCE = '''
794         lib/hx509/ca.c
795         lib/hx509/cert.c
796         lib/hx509/cms.c
797         lib/hx509/collector.c
798         lib/hx509/crypto.c
799         lib/hx509/error.c
800         lib/hx509/env.c
801         lib/hx509/file.c
802         lib/hx509/keyset.c
803         lib/hx509/ks_dir.c
804         lib/hx509/ks_file.c
805         lib/hx509/ks_keychain.c
806         lib/hx509/ks_mem.c
807         lib/hx509/ks_null.c
808         lib/hx509/ks_p11.c
809         lib/hx509/ks_p12.c
810         lib/hx509/lock.c
811         lib/hx509/name.c
812         lib/hx509/peer.c
813         lib/hx509/print.c
814         lib/hx509/req.c
815         lib/hx509/revoke.c
816         lib/hx509/sel.c
817         lib/hx509/hx509_err.c
818     '''
819
820     HEIMDAL_AUTOPROTO('lib/hx509/hx509-protos.h',
821                           HEIMDAL_HX509_OBJH_SOURCE,
822                           options="-R '^(_|^C)' -E HX509_LIB -q -P comment -o")
823
824     HEIMDAL_AUTOPROTO('lib/hx509/hx509-private.h',
825                           HEIMDAL_HX509_OBJH_SOURCE,
826                           options="-q -P comment -p")
827
828     HEIMDAL_LIBRARY('hx509',
829         'lib/hx509/ca.c lib/hx509/cert.c lib/hx509/cms.c lib/hx509/collector.c lib/hx509/crypto.c lib/hx509/error.c lib/hx509/env.c lib/hx509/file.c lib/hx509/keyset.c lib/hx509/ks_dir.c lib/hx509/ks_file.c lib/hx509/ks_keychain.c lib/hx509/ks_mem.c lib/hx509/ks_null.c lib/hx509/ks_p11.c lib/hx509/ks_p12.c lib/hx509/lock.c lib/hx509/name.c lib/hx509/peer.c lib/hx509/print.c lib/hx509/req.c lib/hx509/revoke.c lib/hx509/sel.c lib/hx509/hx509_err.c lib/hx509/sel-lex.l lib/hx509/sel-gram.y',
830         includes='../heimdal/lib/hx509',
831         deps='roken com_err asn1 hcrypto asn1 HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 HEIMDAL_PKCS10_ASN1 wind',
832         vnum='5.0.0',
833         version_script='lib/hx509/version-script.map',
834         )
835
836 if not bld.CONFIG_SET('USING_SYSTEM_WIND'):
837     HEIMDAL_ERRTABLE('WIND_ERR_ET',
838         'lib/wind/wind_err.et')
839
840     HEIMDAL_GENERATOR(
841         name="HEIMDAL_ERRORLIST",
842         rule="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
843         source = '../heimdal/lib/wind/gen-errorlist.py ../heimdal/lib/wind/rfc3454.txt ../heimdal/lib/wind/stringprep.py',
844         target = '../heimdal/lib/wind/errorlist_table.c ../heimdal/lib/wind/errorlist_table.h'
845         )
846
847
848     HEIMDAL_GENERATOR(
849         name = 'HEIMDAL_NORMALIZE_TABLE',
850         rule="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[2].abspath()}' '${SRC[1].parent.abspath(env)}'",
851         source = '../heimdal/lib/wind/gen-normalize.py ../heimdal/lib/wind/UnicodeData.txt ../heimdal/lib/wind/CompositionExclusions-3.2.0.txt',
852         target = '../heimdal/lib/wind/normalize_table.h ../heimdal/lib/wind/normalize_table.c'
853     )
854
855     HEIMDAL_GENERATOR(
856         name = 'HEIMDAL_COMBINING_TABLE',
857         rule="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
858         source = '../heimdal/lib/wind/gen-combining.py ../heimdal/lib/wind/UnicodeData.txt',
859         target = '../heimdal/lib/wind/combining_table.h ../heimdal/lib/wind/combining_table.c'
860     )
861
862     HEIMDAL_GENERATOR(
863         name = 'HEIMDAL_BIDI_TABLE',
864         rule="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
865         source = '../heimdal/lib/wind/gen-bidi.py ../heimdal/lib/wind/rfc3454.txt',
866         target = '../heimdal/lib/wind/bidi_table.h ../heimdal/lib/wind/bidi_table.c'
867     )
868
869
870     HEIMDAL_GENERATOR(
871         name = 'HEIMDAL_MAP_TABLE',
872         rule="${PYTHON} '${SRC[0].abspath()}' '${SRC[2].abspath()}' '${SRC[2].parent.abspath(env)}'",
873         source = '../heimdal/lib/wind/gen-map.py ../heimdal/lib/wind/stringprep.py ../heimdal/lib/wind/rfc3454.txt',
874         target = '../heimdal/lib/wind/map_table.h ../heimdal/lib/wind/map_table.c'
875     )
876
877     HEIMDAL_LIBRARY('wind',
878           'lib/wind/wind_err.c lib/wind/stringprep.c lib/wind/errorlist.c lib/wind/errorlist_table.c lib/wind/normalize.c lib/wind/normalize_table.c lib/wind/combining.c lib/wind/combining_table.c lib/wind/utf8.c lib/wind/bidi.c lib/wind/bidi_table.c lib/wind/ldap.c lib/wind/map.c lib/wind/map_table.c',
879           includes='../heimdal/lib/wind',
880           deps='roken com_err',
881           vnum='0.0.0',
882           version_script='lib/wind/version-script.map',
883           )
884
885 if not bld.CONFIG_SET('USING_SYSTEM_COM_ERR'):
886     HEIMDAL_LIBRARY('com_err',
887         'lib/com_err/com_err.c lib/com_err/error.c',
888         includes='../heimdal/lib/com_err',
889         deps='roken samba_intl',
890         vnum='0.25',
891         version_script='lib/com_err/version-script.map',
892         )
893
894 HEIMDAL_SUBSYSTEM('HEIMDAL_VERS_HOSTCC',
895        'lib/vers/print_version.c ../heimdal_build/version.c',
896         group='build_compilers',
897        deps='LIBREPLACE_HOSTCC ROKEN_HOSTCC',
898        use_global_deps=False,
899        use_hostcc=True)
900
901 HEIMDAL_SUBSYSTEM('HEIMDAL_VERS',
902        'lib/vers/print_version.c ../heimdal_build/version.c',
903         group='build_compilers',
904         deps='roken replace')
905
906
907 if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
908     # here is the asn1 compiler build rule
909     HEIMDAL_BINARY('asn1_compile',
910         'lib/asn1/gen.c lib/asn1/gen_copy.c '
911         'lib/asn1/gen_decode.c lib/asn1/gen_encode.c lib/asn1/gen_free.c '
912         'lib/asn1/gen_glue.c lib/asn1/gen_length.c lib/asn1/gen_seq.c '
913         'lib/asn1/gen_template.c lib/asn1/hash.c lib/asn1/symbol.c '
914         'lib/asn1/asn1parse.y lib/asn1/lex.l lib/asn1/main.c',
915         use_hostcc=True,
916         use_global_deps=False,
917         includes='../heimdal/lib/asn1',
918         group='build_compilers',
919         deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
920         install=False
921     )
922     bld.env['ASN1_COMPILE'] = os.path.join(bld.bldnode.parent.abspath(), 'asn1_compile')
923
924
925 if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
926     HEIMDAL_BINARY('compile_et',
927         'lib/com_err/parse.y lib/com_err/lex.l lib/com_err/compile_et.c',
928         use_hostcc=True,
929         use_global_deps=False,
930         includes='../heimdal/lib/com_err',
931         group='build_compilers',
932         deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
933         install=False
934         )
935     bld.env['COMPILE_ET'] = os.path.join(bld.bldnode.parent.abspath(), 'compile_et')
936
937 HEIMDAL_BINARY('samba4kinit',
938     'kuser/kinit.c',
939     deps='krb5 heimntlm roken HEIMDAL_VERS hcrypto',
940     install=False
941     )
942
943 HEIMDAL_BINARY('samba4kgetcred',
944     'kuser/kgetcred.c',
945     deps='krb5 heimntlm roken HEIMDAL_VERS hcrypto asn1',
946     install=False
947     )
948
949 HEIMDAL_BINARY('samba4kpasswd',
950     'kpasswd/kpasswd.c',
951     deps='krb5 heimntlm roken HEIMDAL_VERS hcrypto',
952     install=False
953     )
954
955 # Alias subsystem to allow common kerberos code that will
956 # otherwise link against MIT's gssapi_krb5 and k5crypto
957 #
958 # Note: that we also need this if we use system heimdal libraries
959 HEIMDAL_SUBSYSTEM('gssapi_krb5', '', deps='gssapi')
960 HEIMDAL_SUBSYSTEM('k5crypto', '', deps='krb5')