cbuildgems 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/build.rb +83 -0
- data/lib/cbuildgems.rb +3 -0
- data/lib/header.rb +39 -0
- data/lib/version.rb +3 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d450e771e9f46df615df92888e7bfbd353123f9
|
4
|
+
data.tar.gz: 5a987399aa8e9d0ca1ae435e7fde49165cf9e3c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e86affc2518d9110bce9ae89fb83510679441c155c2483fb5837c71476941401033d7646264b515a909890c43a778680572cd01176f4846dc1b445b884e2bc41
|
7
|
+
data.tar.gz: 16ffeff18c4e8ffab4d88982656bbde8d1683708f563588daf5925634cf27428862a3f7db9487748f43d3a01c43ebe62e1086c04339f0d3fbd4f65a0de752a17
|
data/lib/build.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module CBuildGems
|
4
|
+
class Build
|
5
|
+
# Returns a hash read in from the configuration YAML file.
|
6
|
+
attr_reader :hash
|
7
|
+
# Returns a hash for the YAML key config_out used to get data for
|
8
|
+
# configuration output data such as binaries, version numbers, package URLs,
|
9
|
+
# and bug report URLs.
|
10
|
+
attr_reader :config_out
|
11
|
+
# Returns an array for the YAML key c_flags used to get data for compiler flags.
|
12
|
+
attr_reader :c_flags
|
13
|
+
# Returns an array for the YAML key pkg_config used to get data for packages that
|
14
|
+
# the software depends.
|
15
|
+
attr_reader :pkg_config
|
16
|
+
# Returns a string with the name of the header file with the configuration macros.
|
17
|
+
attr_reader :config_header
|
18
|
+
# Returns a hash for the YAML key complier_opts used to get data for compiler options.
|
19
|
+
# including the complier being used(gcc, clang etc.).
|
20
|
+
attr_reader :complier_opts
|
21
|
+
|
22
|
+
# A hash with a value that is an array to binaries.
|
23
|
+
# @see Build#config_out
|
24
|
+
attr_reader :bins
|
25
|
+
# A hash with a value that is an array to versions numbers of the binaries.
|
26
|
+
# @see Build#config_out
|
27
|
+
attr_reader :versions
|
28
|
+
# A hash with a value that is an array to package urls of the binaries.
|
29
|
+
# @see Build#config_out
|
30
|
+
attr_reader :package_urls
|
31
|
+
# A hash with a value that is an array to issues urls of the binaries.
|
32
|
+
# @see Build#config_out
|
33
|
+
attr_reader :issues_urls
|
34
|
+
|
35
|
+
# A hash with a value that is an array to pkg-config libs & flags.
|
36
|
+
# @see Build#complier_opts
|
37
|
+
attr_reader :pkgc
|
38
|
+
|
39
|
+
# Executes a system command. It returns true if the command is succesful.
|
40
|
+
# It returns false if the command execution fails or gets a non zero exit
|
41
|
+
# status. If the former is true then the exit status in the built in global
|
42
|
+
# variable $? is printed to stdout. $? is either nil or Process::Status and
|
43
|
+
# in this case it will be Process::Status so it can used as needed following
|
44
|
+
# a failed execution.
|
45
|
+
#
|
46
|
+
# @param exec_str [String] the system command string.
|
47
|
+
# @return [Bool] true or false.
|
48
|
+
def self.exec(exec_str)
|
49
|
+
status = system(exec_str)
|
50
|
+
|
51
|
+
case status
|
52
|
+
when nil
|
53
|
+
puts $?
|
54
|
+
return false
|
55
|
+
when false
|
56
|
+
return status
|
57
|
+
else
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def initialize(config_yml)
|
63
|
+
output = File.new(config_yml, 'r')
|
64
|
+
@hash = YAML.load(output.read)
|
65
|
+
output.close
|
66
|
+
|
67
|
+
@config_out = @hash["config_out"]
|
68
|
+
@c_flags = @hash["c_flags"]
|
69
|
+
@config_header = @hash["config_header"]
|
70
|
+
@pkg_config = @hash["pkg_config"]
|
71
|
+
@config_files = @hash["config_files"]
|
72
|
+
@complier_opts = @hash["complier_opts"]
|
73
|
+
|
74
|
+
@bins = @config_out["bins"]
|
75
|
+
@versions = @config_out["versions"]
|
76
|
+
@package_urls = @config_out["package_urls"]
|
77
|
+
@issues_urls = @config_out["issues_urls"]
|
78
|
+
|
79
|
+
@cc = @complier_opts["cc"]
|
80
|
+
@pkgc = @complier_opts["pkg_config"]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/cbuildgems.rb
ADDED
data/lib/header.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module CBuildGems
|
2
|
+
class Header < Build
|
3
|
+
# An array of macros to write to the configuration header file.
|
4
|
+
attr_accessor :macros
|
5
|
+
def initialize(config_yml)
|
6
|
+
super(config_yml)
|
7
|
+
@macros = []
|
8
|
+
end
|
9
|
+
|
10
|
+
# Writes a configuration header file.
|
11
|
+
#
|
12
|
+
# @return [Nil]
|
13
|
+
def write
|
14
|
+
@header = File.new(@config_header, 'w')
|
15
|
+
|
16
|
+
@bins.each_index do |i|
|
17
|
+
@header.puts "/* Name of package */"
|
18
|
+
@header.puts "#define " + @macros[i] + "\s" + "\"#{@bins[i]}\"\n\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
@versions.each_index do |i|
|
22
|
+
@header.puts "/* Version number of package */"
|
23
|
+
@header.puts "#define " + @macros[i] + "_VERSION" + "\s" + "\"#{@versions[i]}\"\n\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
@package_urls.each_index do |i|
|
27
|
+
@header.puts "/* The home page for this package. */"
|
28
|
+
@header.puts "#define " + @macros[i] + "_PKG_URL" + "\s" + "\"#{@package_urls[i]}\"\n\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
@issues_urls.each_index do |i|
|
32
|
+
@header.puts "/* The address where bug reports for this package should be sent. */"
|
33
|
+
@header.puts "#define " + @macros[i] + "_ISSUES_URL" + "\s" + "\"#{@issues_urls[i]}\"\n\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
@header.close
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cbuildgems
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ralph Desir(Mav7)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.9'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.9.1
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.9'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.9.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: A gem for implementing A build system for C programs.
|
48
|
+
email: gehirnmav7@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- lib/build.rb
|
54
|
+
- lib/cbuildgems.rb
|
55
|
+
- lib/header.rb
|
56
|
+
- lib/version.rb
|
57
|
+
homepage:
|
58
|
+
licenses:
|
59
|
+
- GPL-2.0
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.5.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: A build system for C programs.
|
81
|
+
test_files: []
|