cbuildgems 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build.rb +12 -1
- data/lib/cbuildgems.rb +1 -0
- data/lib/config_build.rb +125 -0
- data/lib/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e63f89e085031f20d3087052b462508945ccfeec
|
4
|
+
data.tar.gz: 637e474ad90fd48d65950dff3ef578a536015578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf9bb33ed8b721fb00accfb9dd0bf725f1f860cd6c467664db16eaccecb5f615f5ba2e3458245c2f245524d08c42f70067061349badd058a31685435e0e3e709
|
7
|
+
data.tar.gz: ae6bad319b07f31489c20ff80878da50a1784c657db4513776560d036864d8053048128756c8330bee40bce91a5aa1a5746c6875df24c07ec00f13421ea654c5
|
data/lib/build.rb
CHANGED
@@ -35,6 +35,15 @@ module CBuildGems
|
|
35
35
|
# A hash with a value that is an array to pkg-config libs & flags.
|
36
36
|
# @see Build#complier_opts
|
37
37
|
attr_reader :pkgc
|
38
|
+
# A hash with a value that is an array to include header files.
|
39
|
+
# @see Build#complier_opts
|
40
|
+
attr_reader :include
|
41
|
+
# A hash with a value that is an array to libs.
|
42
|
+
# @see Build#complier_opts
|
43
|
+
attr_reader :libs
|
44
|
+
# A hash with a value that is an array to source code path.
|
45
|
+
# @see Build#complier_opts
|
46
|
+
attr_reader :src
|
38
47
|
|
39
48
|
# Executes a system command. It returns true if the command is succesful.
|
40
49
|
# It returns false if the command execution fails or gets a non zero exit
|
@@ -76,8 +85,10 @@ module CBuildGems
|
|
76
85
|
@package_urls = @config_out["package_urls"]
|
77
86
|
@issues_urls = @config_out["issues_urls"]
|
78
87
|
|
79
|
-
@cc = @complier_opts["cc"]
|
80
88
|
@pkgc = @complier_opts["pkg_config"]
|
89
|
+
@include = @complier_opts["include"]
|
90
|
+
@libs = @complier_opts["libs"]
|
91
|
+
@src = @complier_opts["src"]
|
81
92
|
end
|
82
93
|
end
|
83
94
|
end
|
data/lib/cbuildgems.rb
CHANGED
data/lib/config_build.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
module CBuildGems
|
2
|
+
class Config_Build < Build
|
3
|
+
# The string with the compiler options.
|
4
|
+
attr_reader :build_str
|
5
|
+
# If true(default) then -g is passed into #build_str to include debuging data.
|
6
|
+
# So it can be used with GDB for debugging.
|
7
|
+
attr_accessor :debug_mode
|
8
|
+
def initialize(config_yml)
|
9
|
+
super(config_yml)
|
10
|
+
|
11
|
+
@build_str = "gcc "
|
12
|
+
@debug_mode = true
|
13
|
+
end
|
14
|
+
|
15
|
+
# If complier_opts includes the the passed in key than is yields what
|
16
|
+
# whatever is in the code block.
|
17
|
+
#
|
18
|
+
# @param key [String] complier_opts key to test.
|
19
|
+
# @return [Nil]
|
20
|
+
def if_include(key)
|
21
|
+
yield if @complier_opts.keys.include?(key)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Sets each C flag to build_str from c_flags.
|
25
|
+
#
|
26
|
+
# @return [Nil]
|
27
|
+
# @see Build#c_flags
|
28
|
+
# @see #build_str
|
29
|
+
def set_c_flags
|
30
|
+
@c_flags.each do |i|
|
31
|
+
build_str.concat("#{i}\s")
|
32
|
+
end
|
33
|
+
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
# Sets each include path to build_str from c_flags.
|
38
|
+
#
|
39
|
+
# @return [Nil]
|
40
|
+
# @see Build#include
|
41
|
+
# @see #build_str
|
42
|
+
def set_include_paths
|
43
|
+
if_include("include") do
|
44
|
+
inc = 0
|
45
|
+
|
46
|
+
@include.each do |l|
|
47
|
+
build_str.concat("-I"+@include[inc] + "\s")
|
48
|
+
inc += 1
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
|
55
|
+
# Sets each source path to build_str from src.
|
56
|
+
#
|
57
|
+
# @return [Nil]
|
58
|
+
# @see Build#src
|
59
|
+
# @see #build_str
|
60
|
+
def set_src_paths
|
61
|
+
@src.each do |i|
|
62
|
+
if debug_mode
|
63
|
+
build_str.concat("-g #{i} -o\s")
|
64
|
+
else
|
65
|
+
build_str.concat("#{i} -o\s")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
|
72
|
+
# Sets an output(executable/binary) to build_str from @bins.
|
73
|
+
#
|
74
|
+
# @param bins_index [Fixnum] the binary in the bins array.
|
75
|
+
# @return [Nil]
|
76
|
+
# @see Build#@bins
|
77
|
+
# @see #build_str
|
78
|
+
def set_output(bins_index)
|
79
|
+
build_str.concat("#{@bins[bins_index]}\s")
|
80
|
+
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
|
84
|
+
# Sets each library to build_str from libs.
|
85
|
+
#
|
86
|
+
# @return [Nil]
|
87
|
+
# @see Build#libs
|
88
|
+
# @see #build_str
|
89
|
+
def set_libs
|
90
|
+
if_include("libs") do
|
91
|
+
inc = 0
|
92
|
+
|
93
|
+
@libs.each do |l|
|
94
|
+
if l.include?(".a") || l.include?(".so")
|
95
|
+
build_str.concat(@libs[inc] + "\s")
|
96
|
+
else
|
97
|
+
build_str.concat("-l"+@libs[inc] + "\s")
|
98
|
+
end
|
99
|
+
inc += 1
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
nil
|
104
|
+
end
|
105
|
+
|
106
|
+
# Sets each package to build_str from pkgc.
|
107
|
+
#
|
108
|
+
# @return [Nil]
|
109
|
+
# @see Build#pkgc
|
110
|
+
# @see #build_str
|
111
|
+
def set_pkg_config
|
112
|
+
if_include("pkg_config") do
|
113
|
+
build_str.concat("`pkg-config --cflags --libs ")
|
114
|
+
|
115
|
+
@pkgc.each do |p|
|
116
|
+
build_str.concat("#{p}" + "\s")
|
117
|
+
end
|
118
|
+
|
119
|
+
build_str.concat "`"
|
120
|
+
end
|
121
|
+
|
122
|
+
nil
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbuildgems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralph Desir(Mav7)
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
description: A gem for implementing A build system for
|
47
|
+
description: A gem for implementing A build system for NixGems programs.
|
48
48
|
email: gehirnmav7@gmail.com
|
49
49
|
executables: []
|
50
50
|
extensions: []
|
@@ -52,6 +52,7 @@ extra_rdoc_files: []
|
|
52
52
|
files:
|
53
53
|
- lib/build.rb
|
54
54
|
- lib/cbuildgems.rb
|
55
|
+
- lib/config_build.rb
|
55
56
|
- lib/header.rb
|
56
57
|
- lib/version.rb
|
57
58
|
homepage:
|
@@ -77,5 +78,5 @@ rubyforge_project:
|
|
77
78
|
rubygems_version: 2.5.1
|
78
79
|
signing_key:
|
79
80
|
specification_version: 4
|
80
|
-
summary: A build system for
|
81
|
+
summary: A build system for NixGems programs.
|
81
82
|
test_files: []
|