File: library.rb

package info (click to toggle)
mkvtoolnix 92.0-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 58,620 kB
  • sloc: cpp: 216,810; ruby: 11,403; xml: 8,058; ansic: 6,885; sh: 4,884; python: 1,041; perl: 191; makefile: 113; awk: 16; javascript: 4
file content (38 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Library < Target
  def initialize(name)
    super name
    @build_dll = false
  end

  def build_dll(build_dll_as_well = true)
    return self if !@only_if || (options.include?(:if) && !options[:if])
    @build_dll = build_dll_as_well
    self
  end

  def create_specific_static
    file "#{@target}.a" => @objects do |t|
      FileUtils.rm_f t.name
      runq "ar", t.name, "#{c(:AR)} crS #{t.name} #{@objects.join(" ")}"
      runq "ranlib", t.name, "#{c(:RANLIB)} #{$flags[:ranlib]} #{t.name}"
    end
  end

  def create_specific_dll
    file "#{@target}.dll" => @objects do |t|
      runq "link", t.name, <<-COMMAND
        #{c(:CXX)} #{$flags[:ldflags]} #{$system_libdirs} -shared -Wl,--export-all -Wl,--out-implib=#{t.name}.a -o #{t.name} #{@objects.join(" ")} #{@libraries.join(" ")}
      COMMAND
    end
  end

  def create_specific
    if @build_dll
      create_specific_dll
    else
      create_specific_static
    end

    self
  end
end