From 9de776e46756218acb06dc5692012673a9ac4b0c Mon Sep 17 00:00:00 2001 From: Chen He Date: Fri, 17 Apr 2015 19:50:03 -0400 Subject: [PATCH] Support new install options for third-party dirs Other updates: - Copy latest wscript from bde-tools - Add missing company name to LICENSE --- LICENSE | 2 +- third-party/decnumber/decnumber.pc.in | 4 +- third-party/decnumber/wscript | 73 +++++++++++---------------- third-party/inteldfp/inteldfp.pc.in | 4 +- third-party/inteldfp/wscript | 64 +++++++++-------------- wscript | 57 +++++---------------- 6 files changed, 72 insertions(+), 132 deletions(-) diff --git a/LICENSE b/LICENSE index d645695673..bcfb408492 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2015 Bloomberg Finance L.P. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/third-party/decnumber/decnumber.pc.in b/third-party/decnumber/decnumber.pc.in index 41032f3cf9..14bb728918 100644 --- a/third-party/decnumber/decnumber.pc.in +++ b/third-party/decnumber/decnumber.pc.in @@ -1,6 +1,6 @@ prefix=@prefix@ -libdir=${prefix}/@lib_dir@ -includedir=${prefix}/include/decnumber +libdir=@libdir@ +includedir=@includedir@ Name: DecNumber Library Description: diff --git a/third-party/decnumber/wscript b/third-party/decnumber/wscript index 4d2c268a06..163110d298 100644 --- a/third-party/decnumber/wscript +++ b/third-party/decnumber/wscript @@ -33,13 +33,6 @@ def build(bld): 'decimal32.c' ] - if 'BDE_THIRD_PARTY_CFLAGS' in bld.env: - bde_cflags = bld.env['BDE_THIRD_PARTY_CFLAGS'] - is_bde = True - else: - bde_cflags = [] - is_bde = False - if sys.byteorder == 'big': cflags = ["-DDECLITEND=0"] else: @@ -54,62 +47,56 @@ def build(bld): # bug-tracker here: http://llvm.org/bugs/show_bug.cgi?id=5960 # # Without this change clang/linux builds will fail with multiply defined - # symbols. - + # symbols. + if (-1 != bld.env['CXX'][0].find('clang')): cflags += ['-std=gnu89'] prefix = bld.env['PREFIX'] - if 'install_lib_dir' in bld.env: - lib_dir = bld.env['install_lib_dir'] - lib_suffix = bld.env['lib_suffix'] - else: - lib_dir = 'lib' - lib_suffix = '' - - if not bld.targets or 'decnumber' in bld.targets.split(','): - lib_install_path = os.path.join(prefix, lib_dir) - pc_install_path = os.path.join(prefix, lib_dir, 'pkgconfig') + bde_key = 'bde_thirdparty_decnumber_config' + if bde_key in bld.env: + config = bld.env[bde_key] + is_bde = True else: - lib_install_path = None - pc_install_path = None + config = {} + config['c_flags'] = [] + config['target'] = 'decnumber' + config['lib_install_path'] = os.path.join(prefix, 'lib') + config['h_install_path'] = os.path.join(prefix, 'include', 'decnumber') + config['pc_install_path'] = os.path.join(prefix, 'lib', 'pkgconfig') + config['pc_libdir'] = '${prefix}/lib' + config['pc_includedir'] = '${prefix}/include/decnumber' + is_bde = False - bld.stlib(source=source_files, - target='decnumber' + lib_suffix, - export_includes='.', - name='decnumber_lib', - cflags=bde_cflags + cflags, - install_path = lib_install_path - ) + bld(name='decnumber_lib', + target=config['lib_target'], + source=source_files, + export_includes='.', + features = ['c', 'cstlib'], + cflags=config['cflags'] + cflags, + install_path = config['lib_install_path'] + ) bld(name = "decnumber_pc", - target = 'decnumber' + lib_suffix + '.pc', + target = config['lib_target'] + '.pc', source = 'decnumber.pc.in', features = ['subst'], prefix = prefix, - lib_dir = lib_dir, - libs = '-ldecnumber' + lib_suffix, + libdir = config['pc_libdir'], + includedir = config['pc_includedir'], + libs = '-l' + config['lib_target'], cflags = '', - install_path = pc_install_path + install_path = config['pc_install_path'] ) - if is_bde: - from bdewafbuild import install_files - install_files(bld, 'decnumber_inst', - os.path.join(prefix, 'include', 'decnumber'), + bld.install_files(config['h_install_path'], bld.path.ant_glob('*.h')) + if is_bde: depends_on = ['decnumber_lib', 'decnumber_pc'] - if bld.cmd == 'install': - depends_on += ['decnumber_inst'] - bld(name = 'decnumber', depends_on = depends_on) - else: - bld.install_files(os.path.join(prefix, 'include', 'decnumber'), - bld.path.ant_glob('*.h')) - # ---------------------------------------------------------------------------- # Copyright (C) 2014 Bloomberg Finance L.P. diff --git a/third-party/inteldfp/inteldfp.pc.in b/third-party/inteldfp/inteldfp.pc.in index c3a10fb12c..3f9ebc9d09 100644 --- a/third-party/inteldfp/inteldfp.pc.in +++ b/third-party/inteldfp/inteldfp.pc.in @@ -1,6 +1,6 @@ prefix=@prefix@ -libdir=${prefix}/@lib_dir@ -includedir=${prefix}/include/inteldfp +libdir=@libdir@ +includedir=@includedir@ Name: Intel Decimal Floating-Point Math Library Description: diff --git a/third-party/inteldfp/wscript b/third-party/inteldfp/wscript index 8680cb8570..0c57ec2396 100644 --- a/third-party/inteldfp/wscript +++ b/third-party/inteldfp/wscript @@ -259,13 +259,6 @@ def build(bld): 'LIBRARY/float128/sqrt_tab_t.c' ] - if 'BDE_THIRD_PARTY_CFLAGS' in bld.env: - bde_cflags = bld.env['BDE_THIRD_PARTY_CFLAGS'] - is_bde = True - else: - bde_cflags = [] - is_bde = False - cflags = [] platform = Utils.unversioned_sys_platform() if platform != 'win32': @@ -295,56 +288,49 @@ def build(bld): '-DDECIMAL_GLOBAL_EXCEPTION_FLAGS=0'] prefix = bld.env['PREFIX'] - if 'install_lib_dir' in bld.env: - lib_dir = bld.env['install_lib_dir'] - lib_suffix = bld.env['lib_suffix'] - else: - lib_dir = 'lib' - lib_suffix = '' - - if not bld.targets or 'inteldfp' in bld.targets.split(','): - lib_install_path = os.path.join(prefix, lib_dir) - pc_install_path = os.path.join(prefix, lib_dir, 'pkgconfig') + bde_key = 'bde_thirdparty_inteldfp_config' + if bde_key in bld.env: + config = bld.env[bde_key] + is_bde = True else: - lib_install_path = None - pc_install_path = None + config = {} + config['c_flags'] = [] + config['target'] = 'inteldfp' + config['lib_install_path'] = os.path.join(prefix, 'lib') + config['h_install_path'] = os.path.join(prefix, 'include', 'inteldfp') + config['pc_install_path'] = os.path.join(prefix, 'lib', 'pkgconfig') + config['pc_libdir'] = '${prefix}/lib' + config['pc_includedir'] = '${prefix}/include/inteldfp' + is_bde = False bld(name = 'inteldfp_lib', - target = 'inteldfp' + lib_suffix, + target=config['lib_target'], source = source_files, - features = ['c', 'cstlib'], export_includes = 'LIBRARY/src', - libs = '-linteldfp', - cflags = bde_cflags + cflags, - install_path = lib_install_path + features = ['c', 'cstlib'], + cflags=config['cflags'] + cflags, + install_path = config['lib_install_path'] ) bld(name = 'inteldfp_pc', - target = 'inteldfp' + lib_suffix + '.pc', + target = config['lib_target'] + '.pc', source = 'inteldfp.pc.in', features = ['subst'], prefix = prefix, - lib_dir = lib_dir, - libs = '-linteldfp' + lib_suffix, - cflags = ' '.join(cflags), - install_path = pc_install_path + libdir = config['pc_libdir'], + includedir = config['pc_includedir'], + libs = '-l' + config['lib_target'], + cflags = '', + install_path = config['pc_install_path'] ) - if is_bde: - from bdewafbuild import install_files - install_files(bld, 'inteldfp_inst', - os.path.join(prefix, 'include', 'inteldfp'), + bld.install_files(config['h_install_path'], bld.path.ant_glob('LIBRARY/src/*.h')) + if is_bde: depends_on = ['inteldfp_lib', 'inteldfp_pc'] - if bld.cmd == 'install': - depends_on += ['inteldfp_inst'] - bld(name = 'inteldfp', depends_on = depends_on) - else: - bld.install_files(os.path.join(prefix, 'include', 'inteldfp'), - bld.path.ant_glob('LIBRARY/src/*.h')) # ---------------------------------------------------------------------------- diff --git a/wscript b/wscript index ac358bd7c6..ba451f3337 100644 --- a/wscript +++ b/wscript @@ -1,65 +1,32 @@ #!/usr/bin/env python # encoding: utf-8 +# Copy this file to the root directory of a BDE-style source repo to enable +# building it using the waf-based build tool. + import os import sys -from waflib import Logs, Utils -from waflib.Configure import ConfigurationContext - top = '.' out = 'build' + def _get_tools_path(ctx): waf_path = sys.argv[0] - base = os.path.dirname(waf_path) - - if os.path.isdir(os.path.join(base, 'tools', 'waf', 'bde')): - return os.path.join(base, 'tools', 'waf', 'bde'); - - ctx.fatal("BDE waf customizations can not be found under tools/waf/bde in the path of waf.") + if os.path.isdir(os.path.join(base, 'lib', 'bdebld')): + return os.path.join(base, 'lib') + ctx.fatal("BDE waf customizations can not be found under tools/lib in the " + "path to waf.") def options(ctx): - import sys - - ctx.load('bdewscript', tooldir = _get_tools_path(ctx)) - - -class PreConfigure(ConfigurationContext): - cmd = 'configure' - - def __init__(self, **kw): - global out - - build_dir = os.getenv('BDE_WAF_BUILD_DIR') - if build_dir: - out = build_dir - - Logs.debug('config: build dir: ' + out) - - super(PreConfigure, self).__init__(**kw) + ctx.load('bdebld.waf.wscript', tooldir=_get_tools_path(ctx)) def configure(ctx): - ctx.load('bdewscript', tooldir = _get_tools_path(ctx)) + ctx.load('bdebld.waf.wscript', tooldir=_get_tools_path(ctx)) -def build(ctx): - ctx.load('bdewscript', tooldir = _get_tools_path(ctx)) -# ---------------------------------------------------------------------------- -# Copyright (C) 2013-2014 Bloomberg Finance L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------- END-OF-FILE ---------------------------------- +def build(ctx): + ctx.load('bdebld.waf.wscript', tooldir=_get_tools_path(ctx))