Class: PkgForge::DSL::Forge
- Inherits:
-
Base
- Object
- Base
- PkgForge::DSL::Forge
show all
- Defined in:
- lib/pkgforge/components/deps.rb,
lib/pkgforge/base.rb,
lib/pkgforge/components/dirs.rb,
lib/pkgforge/components/test.rb,
lib/pkgforge/components/build.rb,
lib/pkgforge/components/patch.rb,
lib/pkgforge/components/cflags.rb,
lib/pkgforge/components/source.rb,
lib/pkgforge/components/package.rb,
lib/pkgforge/components/metadata.rb,
lib/pkgforge/components/configure.rb
Overview
Add configure flag options to Forge DSL
Constant Summary
collapse
- ALL_HARDEN_OPTS =
{
format: %w(-Wformat -Wformat-security -Werror=format-security),
stackprotector: %w(-fstack-protector-strong),
fortify: %w(-O2 -D_FORTIFY_SOURCE=2),
pic: '-fPIC',
strictoverflow: '-fno-strict-overflow',
relro: '-zrelro',
bindnow: '-zbindnow'
}.freeze
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Constructor Details
This class inherits a constructor from PkgForge::Base
Instance Method Details
#build(&block) ⇒ Object
29
30
31
32
|
# File 'lib/pkgforge/components/build.rb', line 29
def build(&block)
@forge.build_block = block
nil
end
|
#cflags(value = nil) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/pkgforge/components/cflags.rb', line 23
def cflags(value = nil)
default = '-I%{dep}/usr/include -L%{dep}/usr/lib'
value ||= @forge.deps.map { |x, _| (default % { dep: dep(x) }).split }
@forge.cflags += value.flatten
nil
end
|
18
19
20
21
|
# File 'lib/pkgforge/components/configure.rb', line 18
def configure_flags(value)
@forge.configure_flags = value
nil
end
|
#dep(dep_name) ⇒ Object
36
37
38
|
# File 'lib/pkgforge/components/dirs.rb', line 36
def dep(dep_name)
@forge.dep(dep_name)
end
|
#deps(value) ⇒ Object
65
66
67
68
|
# File 'lib/pkgforge/components/deps.rb', line 65
def deps(value)
@forge.deps = value
nil
end
|
#harden(list = []) ⇒ Object
51
52
53
54
55
|
# File 'lib/pkgforge/components/cflags.rb', line 51
def harden(list = [])
harden_opts = ALL_HARDEN_OPTS.reject { |k, _| list.include? k.to_s }
@forge.cflags += harden_opts.values.flatten
nil
end
|
#libs(value = nil) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/pkgforge/components/cflags.rb', line 31
def libs(value = nil)
value ||= @forge.deps.keys
value.map! { |x| '-l' + x.to_s }
@forge.libs += value
nil
end
|
#licenses(files) ⇒ Object
Also known as:
license
54
55
56
57
58
|
# File 'lib/pkgforge/components/metadata.rb', line 54
def licenses(files)
files = [files] unless files.is_a? Array
@forge.licenses = files
nil
end
|
#name(value) ⇒ Object
42
43
44
45
|
# File 'lib/pkgforge/components/metadata.rb', line 42
def name(value)
@forge.name = value
nil
end
|
#org(value) ⇒ Object
48
49
50
51
|
# File 'lib/pkgforge/components/metadata.rb', line 48
def org(value)
@forge.org = value
nil
end
|
#package(params) ⇒ Object
68
69
70
71
|
# File 'lib/pkgforge/components/package.rb', line 68
def package(params)
@forge.package = params
nil
end
|
#patch(file) ⇒ Object
31
32
33
34
|
# File 'lib/pkgforge/components/patch.rb', line 31
def patch(file)
@forge.patches << file
nil
end
|
#remove_linker_archives(value = true) ⇒ Object
71
72
73
74
|
# File 'lib/pkgforge/components/deps.rb', line 71
def remove_linker_archives(value = true)
@forge.remove_linker_archives = value
nil
end
|
#remove_pkgconfig_files(value = true) ⇒ Object
77
78
79
80
|
# File 'lib/pkgforge/components/deps.rb', line 77
def remove_pkgconfig_files(value = true)
@forge.remove_pkgconfig_files = value
nil
end
|
#source(params) ⇒ Object
50
51
52
53
|
# File 'lib/pkgforge/components/source.rb', line 50
def source(params)
@forge.source = params
nil
end
|
#test(&block) ⇒ Object
72
73
74
75
|
# File 'lib/pkgforge/components/test.rb', line 72
def test(&block)
@forge.test_block = block
nil
end
|