aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-08-12 16:12:52 +0200
committerDaniel Neus <[email protected]>2016-08-12 16:12:52 +0200
commita56f569a2024a4e13db165308947c8a6aa87859c (patch)
tree9bcf1dc1beadb0fa5620491e41a00db02f120e3a
parent25710f5375edb1af47699d128c04b4de0f2d0547 (diff)
Headers can be marked as external by using `<header:external>` in info.txt.
These headers are copied/linked into build_dir/include/external This has the advantage that external includes can be taken as they are, they haven't to be modified. Fixes amalgamation build with enabled pkcs#11 module
-rwxr-xr-xconfigure.py37
-rw-r--r--src/lib/prov/pkcs11/info.txt5
-rw-r--r--src/lib/prov/pkcs11/p11.h2
-rwxr-xr-xsrc/scripts/install.py6
4 files changed, 41 insertions, 9 deletions
diff --git a/configure.py b/configure.py
index f32edd65a..419c733c9 100755
--- a/configure.py
+++ b/configure.py
@@ -123,10 +123,12 @@ class BuildConfigurationInformation(object):
self.include_dir = os.path.join(self.build_dir, 'include')
self.botan_include_dir = os.path.join(self.include_dir, 'botan')
self.internal_include_dir = os.path.join(self.botan_include_dir, 'internal')
+ self.external_include_dir = os.path.join(self.include_dir, 'external')
self.modules = modules
self.sources = sorted(flatten([mod.sources() for mod in modules]))
self.internal_headers = sorted(flatten([m.internal_headers() for m in modules]))
+ self.external_headers = sorted(flatten([m.external_headers() for m in modules]))
if options.via_amalgamation:
self.build_sources = ['botan_all.cpp']
@@ -180,6 +182,7 @@ class BuildConfigurationInformation(object):
yield self.testobj_dir
yield self.botan_include_dir
yield self.internal_include_dir
+ yield self.external_include_dir
yield os.path.join(self.doc_output_dir, 'manual')
if options.with_doxygen:
@@ -575,9 +578,10 @@ class ModuleInfo(object):
def __init__(self, infofile):
lex_me_harder(infofile, self,
- ['source', 'header:internal', 'header:public',
- 'requires', 'os', 'arch', 'cc', 'libs',
- 'frameworks', 'comment', 'warning'],
+ ['source', 'header:internal', 'header:public',
+ 'header:external', 'requires', 'os', 'arch',
+ 'cc', 'libs', 'frameworks', 'comment',
+ 'warning'],
{
'load_on': 'auto',
'define': [],
@@ -638,8 +642,9 @@ class ModuleInfo(object):
self.source = [add_dir_name(s) for s in self.source]
self.header_internal = [add_dir_name(s) for s in self.header_internal]
self.header_public = [add_dir_name(s) for s in self.header_public]
+ self.header_external = [add_dir_name(s) for s in self.header_external]
- for src in self.source + self.header_internal + self.header_public:
+ for src in self.source + self.header_internal + self.header_public + self.header_external:
if os.access(src, os.R_OK) == False:
logging.error("Missing file %s in %s" % (src, infofile))
@@ -653,10 +658,21 @@ class ModuleInfo(object):
else:
self.warning = None
- intersection = set(self.header_public) & set(self.header_internal)
-
+ intersection = set.intersection(set(self.header_public), set(self.header_internal), set(self.header_external))
if len(intersection) > 0:
- logging.warning('Headers %s marked both public and internal' % (' '.join(intersection)))
+ logging.warning('Headers %s marked public, internal and external' % (' '.join(intersection)))
+ else:
+ intersection = set.intersection(set(self.header_public), set(self.header_internal))
+ if len(intersection) > 0:
+ logging.warning('Headers %s marked both public and internal' % (' '.join(intersection)))
+
+ intersection = set.intersection(set(self.header_public), set(self.header_external))
+ if len(intersection) > 0:
+ logging.warning('Headers %s marked both public and external' % (' '.join(intersection)))
+
+ intersection = set.intersection(set(self.header_external), set(self.header_internal))
+ if len(intersection) > 0:
+ logging.warning('Headers %s marked both external and internal' % (' '.join(intersection)))
def sources(self):
return self.source
@@ -667,6 +683,9 @@ class ModuleInfo(object):
def internal_headers(self):
return self.header_internal
+ def external_headers(self):
+ return self.header_external
+
def defines(self):
return ['HAS_' + d[0] + ' ' + d[1] for d in chunks(self.define, 2)]
@@ -1180,6 +1199,7 @@ def gen_makefile_lists(var, build_config, options, modules, cc, arch, osinfo):
"""
def build_commands(sources, obj_dir, flags):
includes = cc.add_include_dir_option + build_config.include_dir
+ includes+= ' ' + cc.add_include_dir_option + build_config.external_include_dir if build_config.external_headers else ''
includes+= ' ' + cc.add_include_dir_option + options.with_external_includedir if options.with_external_includedir else ''
for (obj_file,src) in zip(objectfile_list(sources, obj_dir), sources):
yield '%s: %s\n\t$(CXX)%s $(%s_FLAGS) %s %s %s %s$@\n' % (
@@ -2083,6 +2103,9 @@ def main(argv = None):
link_headers(build_config.internal_headers, 'internal',
build_config.internal_include_dir)
+ link_headers(build_config.external_headers, 'external',
+ build_config.external_include_dir)
+
with open(os.path.join(build_config.build_dir, 'build_config.py'), 'w') as f:
f.write(str(template_vars))
diff --git a/src/lib/prov/pkcs11/info.txt b/src/lib/prov/pkcs11/info.txt
index 37a7f0d4d..2715c7cda 100644
--- a/src/lib/prov/pkcs11/info.txt
+++ b/src/lib/prov/pkcs11/info.txt
@@ -10,10 +10,13 @@ pk_pad
<header:internal>
p11_mechanism.h
+</header:internal>
+
+<header:external>
pkcs11.h
pkcs11f.h
pkcs11t.h
-</header:internal>
+</header:external>
<header:public>
p11.h
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h
index df077f62b..c18c07d59 100644
--- a/src/lib/prov/pkcs11/p11.h
+++ b/src/lib/prov/pkcs11/p11.h
@@ -50,7 +50,7 @@
#pragma pack(push, cryptoki, 1)
#endif
-#include <botan/internal/pkcs11.h>
+#include "pkcs11.h"
#if defined(_MSC_VER)
#pragma pack(pop, cryptoki)
diff --git a/src/scripts/install.py b/src/scripts/install.py
index 1d4d27b76..d87e69b49 100755
--- a/src/scripts/install.py
+++ b/src/scripts/install.py
@@ -147,6 +147,12 @@ def main(args = None):
copy_file(os.path.join(build_include_dir, include),
os.path.join(target_include_dir, include))
+ build_external_include_dir = os.path.join(options.build_dir, 'include', 'external')
+
+ for include in sorted(os.listdir(build_external_include_dir)):
+ copy_file(os.path.join(build_external_include_dir, include),
+ os.path.join(target_include_dir, include))
+
static_lib = process_template('%{lib_prefix}%{libname}.%{static_suffix}')
copy_file(os.path.join(out_dir, static_lib),
os.path.join(lib_dir, os.path.basename(static_lib)))