From 424ad6722daa505cb0c02283ce4eb2411e73b6fc Mon Sep 17 00:00:00 2001 From: Christian Henning Date: Sun, 7 Apr 2013 20:21:11 +0000 Subject: [PATCH] Some image formats jam files supported by gil:io tests. [SVN r83800] --- src/tools/jpeg.jam | 233 +++++++++++++++++++++++++++++++++++++++++++++ src/tools/png.jam | 226 +++++++++++++++++++++++++++++++++++++++++++ src/tools/tiff.jam | 230 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 689 insertions(+) create mode 100644 src/tools/jpeg.jam create mode 100644 src/tools/png.jam create mode 100644 src/tools/tiff.jam diff --git a/src/tools/jpeg.jam b/src/tools/jpeg.jam new file mode 100644 index 000000000..128ab6353 --- /dev/null +++ b/src/tools/jpeg.jam @@ -0,0 +1,233 @@ +# Copyright (c) 2010 Vladimir Prus. +# Copyright (c) 2013 Steven Watanabe +# +# Use, modification and distribution is subject to the Boost Software +# License Version 1.0. (See accompanying file LICENSE_1_0.txt or +# http://www.boost.org/LICENSE_1_0.txt) + +# Supports the libjpeg library +# +# After 'using libjpeg', the following targets are available: +# +# /libjpeg//libjpeg -- The libjpeg library + +import project ; +import ac ; +import errors ; +import "class" : new ; +import targets ; +import path ; +import modules ; +import errors ; +import indirect ; +import property ; +import property-set ; + +header = jconfig.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h jpeglib.h + jversion.h ; + +names = libjpeg ; + +sources = jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c + jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c + jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c + jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c + jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c + jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c + jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c ; + +library-id = 0 ; + +if --debug-configuration in [ modules.peek : ARGV ] +{ + .debug = true ; +} + +# Initializes the libjpeg library. +# +# libjpeg can be configured either to use pre-existing binaries +# or to build the library from source. +# +# Options for configuring a prebuilt libjpeg:: +# +# +# The directory containing the libjpeg binaries. +# +# Overrides the default library name. +# +# The directory containing the libjpeg headers. +# +# If none of these options is specified, then the environmental +# variables LIBJPEG_LIBRARY_PATH, LIBJPEG_NAME, and LIBJPEG_INCLUDE will +# be used instead. +# +# Options for building libjpeg from source:: +# +# +# The libjpeg source directory. Defaults to the environmental variable +# LIBJPEG_SOURCE. +# +# A rule which computes the actual name of the compiled +# libraries based on the build properties. Ignored +# when using precompiled binaries. +# +# The base name to use for the compiled library. Ignored +# when using precompiled binaries. +# +# Examples:: +# +# # Find libjpeg in the default system location +# using libjpeg ; +# # Build libjpeg from source +# using libjpeg : 8c : /home/steven/libjpeg-8c ; +# # Find libjpeg in /usr/local +# using libjpeg : 8c +# : /usr/local/include /usr/local/lib ; +# # Build libjpeg from source for msvc and find +# # prebuilt binaries for gcc. +# using libjpeg : 8c : C:/Devel/src/libjpeg-8c : msvc ; +# using libjpeg : 8c : : gcc ; +# +rule init ( + version ? + # The libjpeg version (currently ignored) + + : options * + # A list of the options to use + + : requirements * + # The requirements for the libjpeg target + + : is-default ? + # Default configurations are only used when libjpeg + # has not yet been configured. + ) +{ + local caller = [ project.current ] ; + + if ! $(.initialized) + { + .initialized = true ; + + project.initialize $(__name__) ; + .project = [ project.current ] ; + project libjpeg ; + } + + local library-path = [ property.select : $(options) ] ; + library-path = $(library-path:G=) ; + local include-path = [ property.select : $(options) ] ; + include-path = $(include-path:G=) ; + local source-path = [ property.select : $(options) ] ; + source-path = $(source-path:G=) ; + local library-name = [ property.select : $(options) ] ; + library-name = $(library-name:G=) ; + local tag = [ property.select : $(options) ] ; + tag = $(tag:G=) ; + local build-name = [ property.select : $(options) ] ; + build-name = $(build-name:G=) ; + + condition = [ property-set.create $(requirements) ] ; + condition = [ property-set.create [ $(condition).base ] ] ; + + local no-build-from-source ; + # Ignore environmental ZLIB_SOURCE if this initialization + # requested to search for a specific pre-built library. + if $(library-path) || $(include-path) || $(library-name) + { + if $(source-path) || $(tag) || $(build-name) + { + errors.user-error "incompatible options for libjpeg:" + [ property.select : $(options) ] "and" + [ property.select : $(options) ] ; + } + else + { + no-build-from-source = true ; + } + } + + source-path ?= [ modules.peek : ZLIB_SOURCE ] ; + + if $(.configured.$(condition)) + { + if $(is-default) + { + if $(.debug) + { + ECHO "notice: [libjpeg] libjpeg is already configured" ; + } + } + else + { + errors.user-error "libjpeg is already configured" ; + } + return ; + } + else if $(source-path) && ! $(no-build-from-source) + { + build-name ?= z ; + library-id = [ CALC $(library-id) + 1 ] ; + tag = [ MATCH ^@?(.*)$ : $(tag) ] ; + if $(tag) && ! [ MATCH ^([^%]*)%([^%]+)$ : $(tag) ] + { + tag = [ indirect.make $(tag) : [ $(caller).project-module ] ] ; + } + sources = [ path.glob $(source-path) : $(sources) ] ; + if $(.debug) + { + ECHO "notice: [libjpeg] Building libjpeg from source as $(build-name)" ; + if $(condition) + { + ECHO "notice: [libjpeg] Condition" [ $(condition).raw ] ; + } + if $(sources) + { + ECHO "notice: [libjpeg] found libjpeg source in $(source-path)" ; + } + else + { + ECHO "warning: [libjpeg] could not find libjpeg source in $(source-path)" ; + } + } + local target ; + if $(sources) { + target = [ targets.create-typed-target LIB : $(.project) + : $(build-name).$(library-id) + : $(sources) + : $(requirements) + @$(tag) + $(source-path) + msvc:_CRT_SECURE_NO_DEPRECATE + msvc:_SCL_SECURE_NO_DEPRECATE + shared:ZLIB_DLL + : + : $(source-path) ] ; + } + + local mt = [ new ac-library libjpeg : $(.project) : $(condition) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + if $(target) + { + $(mt).set-target $(target) ; + } + targets.main-target-alternative $(mt) ; + } else { + if $(.debug) + { + ECHO "notice: [libjpeg] Using pre-installed library" ; + if $(condition) + { + ECHO "notice: [libjpeg] Condition" [ $(condition).raw ] ; + } + } + + local mt = [ new ac-library libjpeg : $(.project) : $(condition) : + $(include-path) : $(library-path) : $(library-name) : $(root) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + targets.main-target-alternative $(mt) ; + } + .configured.$(condition) = true ; +} diff --git a/src/tools/png.jam b/src/tools/png.jam new file mode 100644 index 000000000..0544fe905 --- /dev/null +++ b/src/tools/png.jam @@ -0,0 +1,226 @@ +# Copyright (c) 2010 Vladimir Prus. +# Copyright (c) 2013 Steven Watanabe +# +# Use, modification and distribution is subject to the Boost Software +# License Version 1.0. (See accompanying file LICENSE_1_0.txt or +# http://www.boost.org/LICENSE_1_0.txt) + +# Supports the libpng library +# +# After 'using libpng', the following targets are available: +# +# /libpng//libpng -- The libpng library + +import project ; +import ac ; +import errors ; +import "class" : new ; +import targets ; +import path ; +import modules ; +import errors ; +import indirect ; +import property ; +import property-set ; + +header = png.h ; +names = libpng ; + +sources = png.c pngerror.c pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c + pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c ; + +library-id = 0 ; + +if --debug-configuration in [ modules.peek : ARGV ] +{ + .debug = true ; +} + +# Initializes the libpng library. +# +# libpng can be configured either to use pre-existing binaries +# or to build the library from source. +# +# Options for configuring a prebuilt libpng:: +# +# +# The directory containing the libpng binaries. +# +# Overrides the default library name. +# +# The directory containing the libpng headers. +# +# If none of these options is specified, then the environmental +# variables LIBPNG_LIBRARY_PATH, LIBPNG_NAME, and LIBPNG_INCLUDE will +# be used instead. +# +# Options for building libpng from source:: +# +# +# The libpng source directory. Defaults to the environmental variable +# LIBPNG_SOURCE. +# +# A rule which computes the actual name of the compiled +# libraries based on the build properties. Ignored +# when using precompiled binaries. +# +# The base name to use for the compiled library. Ignored +# when using precompiled binaries. +# +# Examples:: +# +# # Find libpng in the default system location +# using libpng ; +# # Build libpng from source +# using libpng : 1.5.4 : /home/steven/libpng-1.5.4 ; +# # Find libpng in /usr/local +# using libpng : 1.5.4 +# : /usr/local/include /usr/local/lib ; +# # Build libpng from source for msvc and find +# # prebuilt binaries for gcc. +# using libpng : 1.5.4 : C:/Devel/src/libpng-1.5.4 : msvc ; +# using libpng : 1.5.4 : : gcc ; +# +rule init ( + version ? + # The libpng version (currently ignored) + + : options * + # A list of the options to use + + : requirements * + # The requirements for the libpng target + + : is-default ? + # Default configurations are only used when libpng + # has not yet been configured. + ) +{ + local caller = [ project.current ] ; + + if ! $(.initialized) + { + .initialized = true ; + + project.initialize $(__name__) ; + .project = [ project.current ] ; + project libpng ; + } + + local library-path = [ property.select : $(options) ] ; + library-path = $(library-path:G=) ; + local include-path = [ property.select : $(options) ] ; + include-path = $(include-path:G=) ; + local source-path = [ property.select : $(options) ] ; + source-path = $(source-path:G=) ; + local library-name = [ property.select : $(options) ] ; + library-name = $(library-name:G=) ; + local tag = [ property.select : $(options) ] ; + tag = $(tag:G=) ; + local build-name = [ property.select : $(options) ] ; + build-name = $(build-name:G=) ; + + condition = [ property-set.create $(requirements) ] ; + condition = [ property-set.create [ $(condition).base ] ] ; + + local no-build-from-source ; + # Ignore environmental ZLIB_SOURCE if this initialization + # requested to search for a specific pre-built library. + if $(library-path) || $(include-path) || $(library-name) + { + if $(source-path) || $(tag) || $(build-name) + { + errors.user-error "incompatible options for libpng:" + [ property.select : $(options) ] "and" + [ property.select : $(options) ] ; + } + else + { + no-build-from-source = true ; + } + } + + source-path ?= [ modules.peek : ZLIB_SOURCE ] ; + + if $(.configured.$(condition)) + { + if $(is-default) + { + if $(.debug) + { + ECHO "notice: [libpng] libpng is already configured" ; + } + } + else + { + errors.user-error "libpng is already configured" ; + } + return ; + } + else if $(source-path) && ! $(no-build-from-source) + { + build-name ?= z ; + library-id = [ CALC $(library-id) + 1 ] ; + tag = [ MATCH ^@?(.*)$ : $(tag) ] ; + if $(tag) && ! [ MATCH ^([^%]*)%([^%]+)$ : $(tag) ] + { + tag = [ indirect.make $(tag) : [ $(caller).project-module ] ] ; + } + sources = [ path.glob $(source-path) : $(sources) ] ; + if $(.debug) + { + ECHO "notice: [libpng] Building libpng from source as $(build-name)" ; + if $(condition) + { + ECHO "notice: [libpng] Condition" [ $(condition).raw ] ; + } + if $(sources) + { + ECHO "notice: [libpng] found libpng source in $(source-path)" ; + } + else + { + ECHO "warning: [libpng] could not find libpng source in $(source-path)" ; + } + } + local target ; + if $(sources) { + target = [ targets.create-typed-target LIB : $(.project) + : $(build-name).$(library-id) + : $(sources) + : $(requirements) + @$(tag) + $(source-path) + msvc:_CRT_SECURE_NO_DEPRECATE + msvc:_SCL_SECURE_NO_DEPRECATE + shared:ZLIB_DLL + : + : $(source-path) ] ; + } + + local mt = [ new ac-library libpng : $(.project) : $(condition) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + if $(target) + { + $(mt).set-target $(target) ; + } + targets.main-target-alternative $(mt) ; + } else { + if $(.debug) + { + ECHO "notice: [libpng] Using pre-installed library" ; + if $(condition) + { + ECHO "notice: [libpng] Condition" [ $(condition).raw ] ; + } + } + + local mt = [ new ac-library libpng : $(.project) : $(condition) : + $(include-path) : $(library-path) : $(library-name) : $(root) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + targets.main-target-alternative $(mt) ; + } + .configured.$(condition) = true ; +} diff --git a/src/tools/tiff.jam b/src/tools/tiff.jam new file mode 100644 index 000000000..14f235e3f --- /dev/null +++ b/src/tools/tiff.jam @@ -0,0 +1,230 @@ +# Copyright (c) 2010 Vladimir Prus. +# Copyright (c) 2013 Steven Watanabe +# +# Use, modification and distribution is subject to the Boost Software +# License Version 1.0. (See accompanying file LICENSE_1_0.txt or +# http://www.boost.org/LICENSE_1_0.txt) + +# Supports the libtiff library +# +# After 'using libtiff', the following targets are available: +# +# /libtiff//libtiff -- The libtiff library + +import project ; +import ac ; +import errors ; +import "class" : new ; +import targets ; +import path ; +import modules ; +import errors ; +import indirect ; +import property ; +import property-set ; + +header = tiff.h tiffio.hxx ; + +names = libtiff ; + +sources = tif_aux.c tif_close.c tif_codec.c tif_color.c tif_compress.c tif_dir.c tif_dirinfo.c + tif_dirread.c tif_dirwrite.c tif_dumpmode.c tif_error.c tif_extension.c tif_fax3.c tif_fax3sm.c + tif_getimage.c tif_jbig.c tif_jpeg.c tif_jpeg_12.c tif_ojpeg.c tif_flush.c tif_luv.c tif_lzw.c + tif_next.c tif_open.c tif_packbits.c tif_pixarlog.c tif_predict.c tif_print.c tif_read.c tif_stream.cxx + tif_swab.c tif_strip.c tif_thunder.c tif_tile.c tif_version.c tif_warning.c tif_write.c tif_zip.c ; + +library-id = 0 ; + +if --debug-configuration in [ modules.peek : ARGV ] +{ + .debug = true ; +} + +# Initializes the libtiff library. +# +# libtiff can be configured either to use pre-existing binaries +# or to build the library from source. +# +# Options for configuring a prebuilt libtiff:: +# +# +# The directory containing the libtiff binaries. +# +# Overrides the default library name. +# +# The directory containing the libtiff headers. +# +# If none of these options is specified, then the environmental +# variables LIBTIFF_LIBRARY_PATH, LIBTIFF_NAME, and LIBTIFF_INCLUDE will +# be used instead. +# +# Options for building libtiff from source:: +# +# +# The libtiff source directory. Defaults to the environmental variable +# LIBTIFF_SOURCE. +# +# A rule which computes the actual name of the compiled +# libraries based on the build properties. Ignored +# when using precompiled binaries. +# +# The base name to use for the compiled library. Ignored +# when using precompiled binaries. +# +# Examples:: +# +# # Find libtiff in the default system location +# using libtiff ; +# # Build libtiff from source +# using libtiff : 4.0.1 : /home/steven/libtiff-4.0.1 ; +# # Find libtiff in /usr/local +# using libtiff : 4.0.1 +# : /usr/local/include /usr/local/lib ; +# # Build libtiff from source for msvc and find +# # prebuilt binaries for gcc. +# using libtiff : 4.0.1 : C:/Devel/src/libtiff-4.0.1 : msvc ; +# using libtiff : 4.0.1 : : gcc ; +# +rule init ( + version ? + # The libtiff version (currently ignored) + + : options * + # A list of the options to use + + : requirements * + # The requirements for the libtiff target + + : is-default ? + # Default configurations are only used when libtiff + # has not yet been configured. + ) +{ + local caller = [ project.current ] ; + + if ! $(.initialized) + { + .initialized = true ; + + project.initialize $(__name__) ; + .project = [ project.current ] ; + project libtiff ; + } + + local library-path = [ property.select : $(options) ] ; + library-path = $(library-path:G=) ; + local include-path = [ property.select : $(options) ] ; + include-path = $(include-path:G=) ; + local source-path = [ property.select : $(options) ] ; + source-path = $(source-path:G=) ; + local library-name = [ property.select : $(options) ] ; + library-name = $(library-name:G=) ; + local tag = [ property.select : $(options) ] ; + tag = $(tag:G=) ; + local build-name = [ property.select : $(options) ] ; + build-name = $(build-name:G=) ; + + condition = [ property-set.create $(requirements) ] ; + condition = [ property-set.create [ $(condition).base ] ] ; + + local no-build-from-source ; + # Ignore environmental ZLIB_SOURCE if this initialization + # requested to search for a specific pre-built library. + if $(library-path) || $(include-path) || $(library-name) + { + if $(source-path) || $(tag) || $(build-name) + { + errors.user-error "incompatible options for libtiff:" + [ property.select : $(options) ] "and" + [ property.select : $(options) ] ; + } + else + { + no-build-from-source = true ; + } + } + + source-path ?= [ modules.peek : ZLIB_SOURCE ] ; + + if $(.configured.$(condition)) + { + if $(is-default) + { + if $(.debug) + { + ECHO "notice: [libtiff] libtiff is already configured" ; + } + } + else + { + errors.user-error "libtiff is already configured" ; + } + return ; + } + else if $(source-path) && ! $(no-build-from-source) + { + build-name ?= z ; + library-id = [ CALC $(library-id) + 1 ] ; + tag = [ MATCH ^@?(.*)$ : $(tag) ] ; + if $(tag) && ! [ MATCH ^([^%]*)%([^%]+)$ : $(tag) ] + { + tag = [ indirect.make $(tag) : [ $(caller).project-module ] ] ; + } + sources = [ path.glob $(source-path) : $(sources) ] ; + if $(.debug) + { + ECHO "notice: [libtiff] Building libtiff from source as $(build-name)" ; + if $(condition) + { + ECHO "notice: [libtiff] Condition" [ $(condition).raw ] ; + } + if $(sources) + { + ECHO "notice: [libtiff] found libtiff source in $(source-path)" ; + } + else + { + ECHO "warning: [libtiff] could not find libtiff source in $(source-path)" ; + } + } + local target ; + if $(sources) { + target = [ targets.create-typed-target LIB : $(.project) + : $(build-name).$(library-id) + : $(sources) + : $(requirements) + @$(tag) + $(source-path) + msvc:_CRT_SECURE_NO_DEPRECATE + msvc:_SCL_SECURE_NO_DEPRECATE + shared:ZLIB_DLL + : + : $(source-path) ] ; + } + + local mt = [ new ac-library libtiff : $(.project) : $(condition) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + if $(target) + { + $(mt).set-target $(target) ; + } + targets.main-target-alternative $(mt) ; + } else { + if $(.debug) + { + ECHO "notice: [libtiff] Using pre-installed library" ; + if $(condition) + { + ECHO "notice: [libtiff] Condition" [ $(condition).raw ] ; + } + } + + local mt = [ new ac-library libtiff : $(.project) : $(condition) : + $(include-path) : $(library-path) : $(library-name) : $(root) ] ; + $(mt).set-header $(header) ; + $(mt).set-default-names $(names) ; + targets.main-target-alternative $(mt) ; + } + .configured.$(condition) = true ; +}