Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from 8d40e3f..55aa259
Browse files Browse the repository at this point in the history
55aa259 Merge pull request #94 from mdaus/sync_externals
cc658b9 Merge commit '945288d7ade1b4b8666efaa3056e0bb1c18e89e4' into sync_externals
945288d Squashed 'externals/coda-oss/' changes from 0630826..a78b22c
365ccc7 Merge pull request #93 from mdaus/sync_externals
124a3c4 Squashed 'externals/coda-oss/' changes from 8499ef8..0630826
e528082 Merge commit '124a3c4d82e5950f37837802633ae26304319345' into sync_externals
39ff4cf Merge pull request #92 from mdaus/sync_externals
a4c22ea Squashed 'externals/coda-oss/' changes from 026c665..8499ef8
910785d Merge commit 'a4c22ea646a2234bd26c8a97b5f3b8ff4326aba0' into sync_externals

git-subtree-dir: externals/nitro
git-subtree-split: 55aa259
  • Loading branch information
JonathanMeans committed May 24, 2018
1 parent 8d12742 commit 3a2e7f2
Show file tree
Hide file tree
Showing 7 changed files with 865 additions and 141 deletions.
14 changes: 11 additions & 3 deletions externals/coda-oss/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,9 @@ def configureCompilerOptions(self):
config['cc']['optz_fastest'] = '-xO5'
self.env['CFLAGS_cshlib'] = ['-KPIC', '-DPIC']

self.env.append_value('CFLAGS', '-KPIC'.split())
# C99 is required for Solaris to be compatible with
# macros that openjpeg sets
self.env.append_value('CFLAGS', ['-KPIC', '-xc99=all'])
self.env.append_value('CFLAGS_THREAD', '-mt')

elif re.match(winRegex, sys_platform):
Expand Down Expand Up @@ -1711,7 +1713,10 @@ def getSolarisFlags(compilerName):

def gccHasCpp11():
try:
output = subprocess.check_output("g++ --help=c++", stderr=subprocess.STDOUT, shell=True)
output = subprocess.check_output("g++ --help=c++",
stderr=subprocess.STDOUT,
shell=True,
universal_newlines=True)
except subprocess.CalledProcessError:
# If gcc is too old for --help=, then it is too old for C++11
return False
Expand All @@ -1722,7 +1727,10 @@ def gccHasCpp11():

def iccHasCpp11():
try:
output = subprocess.check_output("icpc -help", stderr=subprocess.STDOUT, shell=True)
output = subprocess.check_output("icpc -help",
stderr=subprocess.STDOUT,
shell=True,
universal_newlines=True)
except subprocess.CalledProcessError:
# If icc is too old for -help, then it is too old for C++11
return False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "xml/lite/XMLReader.h"
#include <mem/ScopedArray.h>

#if defined(USE_XERCES)

Expand All @@ -39,18 +40,16 @@ void xml::lite::XMLReaderXerces::parse(io::InputStream & is, int size)
{
throw xml::lite::XMLParseException(Ctxt("No stream available"));
}
sys::byte* buffer = new sys::byte[available];
oss.read(buffer, available);
mem::ScopedArray<sys::byte> buffer(new sys::byte[available]);
oss.read(buffer.get(), available);

// Adopt my buffer, and delete it for me
MemBufInputSource memBuffer((const unsigned char *)buffer,
// Does not take ownership
MemBufInputSource memBuffer((const unsigned char *)buffer.get(),
available,
XMLReaderXerces::MEM_BUFFER_ID(),
false);

mNative->parse(memBuffer);

delete [] buffer;
}

// This function creates the parser
Expand Down
6 changes: 3 additions & 3 deletions externals/coda-oss/modules/c++/xml.lite/wscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME = 'xml.lite'
MAINTAINER = 'jmrandol@users.sourceforge.net'
VERSION = '1.2'
MODULE_DEPS = 'io mt logging'
MODULE_DEPS = 'io mem mt logging'
USELIB_CHECK = 'XML'
TEST_FILTER = 'MMParserTest1.cpp MinidomParserTest2.cpp'
TEST_DEPS = 'cli'
Expand All @@ -20,8 +20,8 @@ def configure(conf):
conf.define('USE_LIBXML', '', quote=False)
elif Options.options.xml_layer == 'xerces':
conf.define('USE_XERCES', '', quote=False)

writeConfig(conf, xml_lite_callback, NAME)

def build(bld):
bld.module(**globals())
254 changes: 135 additions & 119 deletions externals/coda-oss/modules/drivers/j2k/openjpeg/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,128 +16,144 @@ def options(opt):
def configure(conf):
j2kLayer = Options.options.j2k_layer
j2kHome = Options.options.j2k_home
if j2kLayer == 'openjpeg' and not j2kHome:

# callback function to check for #defines used by the openjpg module
def opj_callback(conf):

# check functionality
conf.check_cc(header_name='stdint.h', define_name='OPJ_HAVE_STDINT_H',
mandatory=False)

conf.define('OPJ_VERSION_MAJOR', '2', quote=False)
conf.define('OPJ_VERSION_MINOR', '3', quote=False)
conf.define('OPJ_VERSION_BUILD', '0', quote=False)

# check for the source tarball
if not exists(join(conf.path.abspath(), SOURCE + '.tar')):
conf.fatal('Missing OpenJPEG tarfile')

# untar and setup env
# This must be understood with relation to the following files:
# modules/drivers/j2k/wscript (Referred to as 'J2K wscript')
# modules/drivers/j2k/jasper/wscript (Referred to as 'Jasper wscript')
# And in the NITRO repo
# modules/c/j2k/wscript (Referred to as 'J2K wrapper wscript')
#
# The J2K wscript uses MAKE_J2K to determine whether to build a J2K library
# This will be false if the user has a pre-built J2K library to use.
# (i.e. j2kHome is set)
#
# The J2K wrapper wscript uses MAKE_OPENJPEG to determine -which- J2K lib
# to link to. If MAKE_OPENJPEG is set, it will link to openjpeg.
# If MAKE_JASPER is set, it will link to jasper. This wsciprt and the Jasper
# wscript also use this as a sanity check when building. I.e., if
# build() is called in this wscript, but HAVE_OPENJPEG is not set, nothing
# will happen.
if j2kLayer == 'openjpeg':
conf.env['MAKE_OPENJPEG'] = True
conf.env['MAKE_J2K'] = True
conf.env['HAVE_J2K'] = True
conf.msg('Building local lib', j2kLayer)
untarFile(path=conf.path, fname=SOURCE + '.tar')

# make opj_config.h
openjpegNode = conf.path.make_node(
join(SOURCE, 'src', 'lib', 'openjp2'))

writeConfig(conf, opj_callback, 'opj', infile=None,
outfile='opj_config.h', path=openjpegNode,
feature='makeHeader')

# callback function to check for #defines used by the openjpg module
def opj_private_callback(conf):

# check functionality
if conf.check_cc(function_name='fseeko', header_name='stdio.h',
define_name='OPJ_HAVE_FSEEKO', mandatory=False):
conf.define('OPJ_HAVE_FSEEKO', '', quote=False)

if conf.check_cc(header_name='sys/stat.h', mandatory=False):
conf.define('HAVE_SYS_STAT_H', '', quote=False)
if conf.check_cc(header_name='sys/types.h', mandatory=False):
conf.define('HAVE_SYS_TYPES_H', '', quote=False)
if conf.check_cc(header_name='memory.h', mandatory=False):
conf.define('HAVE_MEMORY_H', '', quote=False)

conf.check_cc(header_name='inttypes.h',
define_name='OPJ_HAVE_INTTYPES_H',
mandatory=False)

if conf.check_cc(header_name='unistd.h', mandatory=False):
conf.define('HAVE_UNISTD_H', '', quote=False)

if conf.check_cc(header_name='fcntl.h', mandatory=False):
conf.define('HAVE_FCNTL_H', '', quote=False)

if conf.check_cc(function_name='mmap', header_name='sys/mman.h',
mandatory=False):
conf.define('HAVE_MMAP', '', quote=False)

if conf.check_cc(header_name='stdbool.h', mandatory=False):
conf.define('HAVE_STDBOOL_H', '', quote=False)

if conf.check_cc(header_name='malloc.h',
define_name='OPJ_HAVE_MALLOC_H', mandatory=False):
conf.define('OPJ_HAVE_MALLOC_H', '', quote=False)

if conf.check_cc(function_name='memalign', header_name='malloc.h',
define_name='OPJ_HAVE_MEMALIGN', mandatory=False):
conf.define('OPJ_HAVE_MEMALIGN', '', quote=False)

if conf.check_cc(function_name='_aligned_malloc',
header_name='malloc.h',
define_name='OPJ_HAVE__ALIGNED_MALLOC',
mandatory=False):
conf.define('OPJ_HAVE__ALIGNED_MALLOC', '', quote=False)

if conf.check_cc(function_name='aligned_alloc',
header_name='malloc.h',
define_name='OPJ_HAVE_ALIGNED_ALLOC',
mandatory=False):
conf.define('OPJ_HAVE_ALIGNED_ALLOC', '', quote=False)

if conf.check_cc(function_name='posix_memalign',
header_name='stdlib.h',
define_name='OPJ_HAVE_POSIX_MEMALIGN',
mandatory=False):
conf.define('OPJ_HAVE_POSIX_MEMALIGN', '', quote=False)

if '_LARGEFILE_SOURCE' in conf.env['DEFINES']:
conf.define('_LARGEFILE_SOURCE', ' ', quote=False)
if '_LARGE_FILES' in conf.env['DEFINES']:
conf.define('_LARGE_FILES', ' ', quote=False)
if '_FILE_OFFSET_BITS=64' in conf.env['DEFINES']:
conf.define('_FILE_OFFSET_BITS', '64', quote=False)

if '_POSIX_C_SOURCE' not in conf.env['DEFINES']:
if 'OPJ_HAVE_FSEEKO=' in conf.env['DEFINES'] or \
'OPJ_HAVE_POSIX_MEMALIGN=' in conf.env['DEFINES']:
conf.define('_POSIX_C_SOURCE', '200112L', quote=False)

conf.define('OPJ_PACKAGE_VERSION', '"2.3.0"', quote=False)
if sys.byteorder != 'little':
conf.define('OPJ_BIG_ENDIAN', ' ', quote=False)

# make opj_config_private.h
writeConfig(conf, opj_private_callback, 'opj_private', infile=None,
outfile='opj_config_private.h', path=openjpegNode,
feature='makeHeader')

if j2kLayer == 'openjpeg' and j2kHome:
conf.env['MAKE_J2K'] = False
conf.env['HAVE_J2K'] = True
conf.check(lib='openjp2', header_name='openjpeg.h',
uselib_store='J2K',
libpath=os.path.join(j2kHome, 'lib'),
includes=os.path.join(j2kHome, 'include'),
function_name='opj_start_compress',
msg='Check for for openjpeg',
okmsg=j2kHome,
mandatory=True)
conf.env['MAKE_J2K'] = not j2kHome

if j2kHome:
conf.check(lib='openjp2 pthread', header_name='openjpeg.h',
uselib_store='J2K',
libpath=os.path.join(j2kHome, 'lib'),
includes=os.path.join(j2kHome, 'include'),
function_name='opj_start_compress',
msg='Check for for openjpeg',
okmsg=j2kHome,
mandatory=True)

else:
# callback function to check for #defines used by the openjpg module
def opj_callback(conf):
# check functionality
conf.check_cc(header_name='stdint.h',
define_name='OPJ_HAVE_STDINT_H',
mandatory=False)

conf.define('OPJ_VERSION_MAJOR', '2', quote=False)
conf.define('OPJ_VERSION_MINOR', '3', quote=False)
conf.define('OPJ_VERSION_BUILD', '0', quote=False)

# check for the source tarball
if not exists(join(conf.path.abspath(), SOURCE + '.tar')):
conf.fatal('Missing OpenJPEG tarfile')

# untar and setup env
conf.msg('Building local lib', j2kLayer)
untarFile(path=conf.path, fname=SOURCE + '.tar')

# make opj_config.h
openjpegNode = conf.path.make_node(
join(SOURCE, 'src', 'lib', 'openjp2'))

writeConfig(conf, opj_callback, 'opj', infile=None,
outfile='opj_config.h', path=openjpegNode,
feature='makeHeader')

# callback function to check for #defines used by the openjpg module
def opj_private_callback(conf):

# check functionality
if conf.check_cc(function_name='fseeko', header_name='stdio.h',
define_name='OPJ_HAVE_FSEEKO', mandatory=False):
conf.define('OPJ_HAVE_FSEEKO', '', quote=False)

if conf.check_cc(header_name='sys/stat.h', mandatory=False):
conf.define('HAVE_SYS_STAT_H', '', quote=False)
if conf.check_cc(header_name='sys/types.h', mandatory=False):
conf.define('HAVE_SYS_TYPES_H', '', quote=False)
if conf.check_cc(header_name='memory.h', mandatory=False):
conf.define('HAVE_MEMORY_H', '', quote=False)

conf.check_cc(header_name='inttypes.h',
define_name='OPJ_HAVE_INTTYPES_H',
mandatory=False)

if conf.check_cc(header_name='unistd.h', mandatory=False):
conf.define('HAVE_UNISTD_H', '', quote=False)

if conf.check_cc(header_name='fcntl.h', mandatory=False):
conf.define('HAVE_FCNTL_H', '', quote=False)

if conf.check_cc(function_name='mmap', header_name='sys/mman.h',
mandatory=False):
conf.define('HAVE_MMAP', '', quote=False)

if conf.check_cc(header_name='stdbool.h', mandatory=False):
conf.define('HAVE_STDBOOL_H', '', quote=False)

if conf.check_cc(header_name='malloc.h',
define_name='OPJ_HAVE_MALLOC_H', mandatory=False):
conf.define('OPJ_HAVE_MALLOC_H', '', quote=False)

if conf.check_cc(function_name='memalign', header_name='malloc.h',
define_name='OPJ_HAVE_MEMALIGN', mandatory=False):
conf.define('OPJ_HAVE_MEMALIGN', '', quote=False)

if conf.check_cc(function_name='_aligned_malloc',
header_name='malloc.h',
define_name='OPJ_HAVE__ALIGNED_MALLOC',
mandatory=False):
conf.define('OPJ_HAVE__ALIGNED_MALLOC', '', quote=False)

if conf.check_cc(function_name='aligned_alloc',
header_name='malloc.h',
define_name='OPJ_HAVE_ALIGNED_ALLOC',
mandatory=False):
conf.define('OPJ_HAVE_ALIGNED_ALLOC', '', quote=False)

if conf.check_cc(function_name='posix_memalign',
header_name='stdlib.h',
define_name='OPJ_HAVE_POSIX_MEMALIGN',
mandatory=False):
conf.define('OPJ_HAVE_POSIX_MEMALIGN', '', quote=False)

if '_LARGEFILE_SOURCE' in conf.env['DEFINES']:
conf.define('_LARGEFILE_SOURCE', ' ', quote=False)
if '_LARGE_FILES' in conf.env['DEFINES']:
conf.define('_LARGE_FILES', ' ', quote=False)
if '_FILE_OFFSET_BITS=64' in conf.env['DEFINES']:
conf.define('_FILE_OFFSET_BITS', '64', quote=False)

if '_POSIX_C_SOURCE' not in conf.env['DEFINES']:
if 'OPJ_HAVE_FSEEKO=' in conf.env['DEFINES'] or \
'OPJ_HAVE_POSIX_MEMALIGN=' in conf.env['DEFINES']:
conf.define('_POSIX_C_SOURCE', '200112L', quote=False)

conf.define('OPJ_PACKAGE_VERSION', '"2.3.0"', quote=False)
if sys.byteorder != 'little':
conf.define('OPJ_BIG_ENDIAN', ' ', quote=False)

# make opj_config_private.h
writeConfig(conf, opj_private_callback, 'opj_private', infile=None,
outfile='opj_config_private.h', path=openjpegNode,
feature='makeHeader')


def build(bld):
Expand Down
Loading

0 comments on commit 3a2e7f2

Please sign in to comment.