Skip to content

Commit

Permalink
Support new install options for third-party dirs
Browse files Browse the repository at this point in the history
Other updates:
- Copy latest wscript from bde-tools
- Add missing company name to LICENSE
  • Loading branch information
che2 committed Apr 17, 2015
1 parent 5590722 commit 9de776e
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 132 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions third-party/decnumber/decnumber.pc.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prefix=@prefix@
libdir=${prefix}/@lib_dir@
includedir=${prefix}/include/decnumber
libdir=@libdir@
includedir=@includedir@

Name: DecNumber Library
Description:
Expand Down
73 changes: 30 additions & 43 deletions third-party/decnumber/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions third-party/inteldfp/inteldfp.pc.in
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
64 changes: 25 additions & 39 deletions third-party/inteldfp/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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'))


# ----------------------------------------------------------------------------
Expand Down
57 changes: 12 additions & 45 deletions wscript
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 9de776e

Please sign in to comment.