Sha256: 66d0405950915a10e048a93eba1d161f596baaa07392c2a90c46beb679b5701b

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

module Rscons
  module Builders
    # A default Rscons builder that produces a static library archive.
    class Rscons::Builders::Library < Rscons::Builder
      def default_variables(env)
        {
          'AR' => 'ar',
          'LIBSUFFIX' => '.a',
          'ARFLAGS' => [],
          'ARCMD' => ['${AR}', 'rcs', '${ARFLAGS}', '${_TARGET}', '${_SOURCES}']
        }
      end

      def run(target, sources, cache, env, vars)
        # build sources to linkable objects
        objects = env.build_sources(sources, [env['OBJSUFFIX'], env['LIBSUFFIX']].flatten, cache, vars)
        if objects
          vars = vars.merge({
            '_TARGET' => target,
            '_SOURCES' => objects,
          })
          command = env.build_command(env['ARCMD'], vars)
          standard_build("AR #{target}", target, command, objects, env, cache)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rscons-1.3.0 lib/rscons/builders/library.rb
rscons-1.2.0 lib/rscons/builders/library.rb