autotools 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/autotools/configure.rb +218 -0
  3. metadata +45 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGI2NjVhMWZmNTU0ODljZjAwOTUzYjA4ZmJkMWI4OGI2YzQ2MGQyYw==
5
+ data.tar.gz: !binary |-
6
+ MDIwMDE1Y2FjZmMxMWUzYWQ5NWYwNmVlNjU4MDJhN2UxNWIyNjMzYQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ODBjYTU0NTMwNTk4MGY1MzBiYmMwNGU0ZGQ5OTk4MWI0NmJmMDcwMDI4ZGJi
10
+ N2EzYmU4MDBkNTQ5NTUzYTI1MDk5N2FmOGNjYjc2YmJlOTJkNzM5NGNhZTRk
11
+ YzA2NDgzNmFlYjVjOTRhMDdmNDJiNjZhZjVhNTFjZDJkMmNmYWM=
12
+ data.tar.gz: !binary |-
13
+ Mzc5OTkwYmY5MzI0ZjgyZDE5YmZhMDJjM2MwYWVkZWIwMGZmZGFkYTU2ZjA0
14
+ OTA2ZGIwMWUzNWE0ZDkyZGFkMzA5NmE4NjBmNjg1MjVlZjEzMGMwZDYxMTJm
15
+ MjZlZTRmNWY3YmM2NjZjMDI4N2ViNjU1MTU1MmEwOWVlZGQ1M2Q=
@@ -0,0 +1,218 @@
1
+ #!/usr/bin/ruby19
2
+
3
+ require 'pathname'
4
+ require 'optparse'
5
+ require 'optparse/time'
6
+ require 'ostruct'
7
+
8
+
9
+ PROG_NAME = 'configure'
10
+ VERSION = '0.1'
11
+ USAGE = "Usage: #{PROG_NAME} [options]"
12
+ ARGS_NUM = (0..(1.0/0.0))
13
+
14
+
15
+ PACKAGE_NAME = 'unixcmd'
16
+
17
+
18
+ def parse_options(args)
19
+ options = OpenStruct.new
20
+
21
+ def options.eval_options
22
+ list = marshal_dump
23
+
24
+ list.each do |pair|
25
+ opt = pair[0]
26
+ val = pair[1]
27
+
28
+ if(val.class == String)
29
+ method("#{opt}=".to_sym).call eval('"' + val + '"')
30
+ end
31
+ end
32
+ end
33
+
34
+ opt_parser = OptionParser.new do |opts|
35
+ opts.banner = USAGE
36
+ options.verbose = false
37
+
38
+ options.prefix = '/usr/local'
39
+ options.exec_prefix = '#{prefix}'
40
+ options.bindir = '#{exec_prefix}/bin'
41
+ options.sbindir = '#{exec_prefix}/sbin'
42
+ options.libexecdir = '#{exec_prefix}/libexec'
43
+ options.sysconfdir = '#{prefix}/etc'
44
+ options.sharedstatedir = '#{prefix}/com'
45
+ options.localstatedir = '#{prefix}/var'
46
+ options.runstatedir = '#{prefix}/run'
47
+ options.libdir = '#{exec_prefix}/lib'
48
+ options.includedir = '#{prefix}/include'
49
+ options.oldincludedir = '/usr/include'
50
+ options.datarootdir = '#{prefix}/share'
51
+ options.datadir = '#{datarootdir}'
52
+ options.infodir = '#{datarootdir}/info'
53
+ options.localedir = '#{datarootdir}/locale'
54
+ options.mandir = '#{datarootdir}/man'
55
+ options.docdir = '#{datarootdir}/doc/#{PACKAGE_NAME}'
56
+ options.htmldir = '#{docdir}'
57
+ options.dvidir = '#{docdir}'
58
+ options.pdfdir = '#{docdir}'
59
+ options.psdir = '#{docdir}'
60
+
61
+ options.program_prefix = ''
62
+ options.program_suffix = ''
63
+
64
+ options.features = { 'foo' => false, 'bar' => true }
65
+ options.libs = { 'foobar' => true, 'barbar' => false }
66
+
67
+ diropts = {
68
+ 'prefix' => 'install architecture-independent files in DIR',
69
+ 'exec-prefix' => 'install architecture-dependent files in DIR',
70
+ 'bindir' => 'user executables',
71
+ 'sbindir' => 'system admin executables',
72
+ 'libexecdir' => 'program executables',
73
+ 'sysconfdir' => 'read-only single-machine data',
74
+ 'sharedstatedir' => 'modifiable architecture-independent data',
75
+ 'localstatedir' => 'modifiable single-machine data',
76
+ 'runstatedir' => nil,
77
+ 'libdir' => 'object code libraries',
78
+ 'includedir' => 'C header files',
79
+ 'oldincludedir' => 'C header files for non-gcc',
80
+ 'datarootdir' => 'read-only arch.-independent data root',
81
+ 'datadir' => 'read-only architecture-independent data',
82
+ 'infodir' => 'info documentation',
83
+ 'localedir' => 'locale-dependent data',
84
+ 'mandir' => 'man documentation',
85
+ 'docdir' => 'documentation root',
86
+ 'htmldir' => 'HTML documentation',
87
+ 'dvidir' => 'dvi documentation',
88
+ 'pdfdir' => 'PDF documentation',
89
+ 'psdir' => 'PS documentation'
90
+ }
91
+
92
+ features = {
93
+ 'foo' => 'foo feature',
94
+ 'bar' => 'foo feature'
95
+ }
96
+
97
+ libs = {
98
+ 'foobar' => 'foobar library',
99
+ 'barbar' => 'barbar library'
100
+ }
101
+
102
+ opts.separator ""
103
+ opts.separator "Fine tuning of the installation directories:"
104
+
105
+ diropts.each do |pair|
106
+ opt = pair[0]
107
+ opt_r = opt.sub '-', '_'
108
+ desc = pair[1]
109
+ opts.on("--#{opt}=DIR", String, "#{desc} [#{options.method(opt_r.to_sym).call}]") do |path|
110
+ options.method("#{opt_r}=".to_sym).call(path)
111
+ end
112
+ end
113
+
114
+ opts.separator ""
115
+ opts.separator "Program names:"
116
+
117
+ opts.on("--program-prefix=PREFIX", String, "prepend PREFIX to installed program names") do |prefix|
118
+ options.program_prefix = prefix
119
+ end
120
+
121
+ opts.on("--program-suffix=SUFFIX", String, "append SUFFIX to installed program names") do |suffix|
122
+ options.program_suffix = suffix
123
+ end
124
+
125
+ opts.separator ""
126
+ opts.separator "Optional Features:"
127
+
128
+ features.each do |pair|
129
+ feature = pair[0]
130
+ desc = pair[1]
131
+
132
+ newval = !(options.features[feature] == true)
133
+ actstr = newval ? 'enable' : 'disable'
134
+
135
+ opts.on("--#{actstr}-#{feature}", "#{actstr} #{features[feature]}") do
136
+ options.features[feature] = newval
137
+ end
138
+ end
139
+
140
+ libs.each do |pair|
141
+ lib = pair[0]
142
+ desc = pair[1]
143
+
144
+ newval = !(options.libs[lib] == true)
145
+ actstr = newval ? 'with' : 'without'
146
+
147
+ opts.on("--#{actstr}-#{lib}", "#{actstr} #{libs[lib]}") do
148
+ options.libs[lib]= newval
149
+ end
150
+ end
151
+
152
+ opts.separator ""
153
+ opts.separator "Common options:"
154
+
155
+ opts.on("--verbose", "Print maximum information") do
156
+ options.verbose = true
157
+ end
158
+
159
+ opts.on_tail("-h", "--help", "Show this message") do
160
+ puts opts
161
+ exit
162
+ end
163
+
164
+ opts.on_tail("--version", "Show version") do
165
+ puts VERSION
166
+ exit
167
+ end
168
+ end
169
+
170
+ opt_parser.parse!(args)
171
+ [options, opt_parser]
172
+ end
173
+
174
+ res = parse_options(ARGV)
175
+ options = res[0]
176
+ opt_parser = res[1]
177
+
178
+ options.eval_options
179
+
180
+ unless ARGS_NUM.include? ARGV.count
181
+ p opt_parser
182
+ exit 1
183
+ end
184
+
185
+ ARGV.delete_if do |arg|
186
+ m = arg.match /\s*([\w\d_]+)\s*\=\s*(.*)\s*/
187
+ unless m.nil?
188
+ ENV[m[1]] = m[2]
189
+ next true
190
+ end
191
+ end
192
+
193
+ diropts = [
194
+ 'prefix', 'exec_prefix', 'bindir', 'sbindir', 'libexecdir', 'sysconfdir', 'sharedstatedir',
195
+ 'localstatedir', 'runstatedir', 'libdir', 'includedir', 'oldincludedir', 'datarootdir',
196
+ 'datadir', 'infodir', 'localedir', 'mandir', 'docdir', 'htmldir', 'dvidir', 'pdfdir', 'psdir'
197
+ ]
198
+
199
+ diropts.each do |opt|
200
+ path = options.method(opt.to_sym).call
201
+ if path.class == String
202
+ puts "option #{opt} = #{Pathname.new(path).cleanpath}"
203
+ end
204
+ end
205
+
206
+ options.features.each do |pair|
207
+ puts "feature #{pair[0]} = #{pair[1]}"
208
+ end
209
+
210
+ options.libs.each do |pair|
211
+ puts "using lib #{pair[0]} = #{pair[1]}"
212
+ end
213
+
214
+ p ARGV
215
+ p ENV
216
+
217
+ # vim: sw=2 sts=2 ts=8:
218
+
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autotools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Artem Levenkov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Implementation Autotools functionality on Ruby language. DO NOT USE (in
14
+ development).
15
+ email: artem@levenkov.org
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/autotools/configure.rb
21
+ homepage: http://rubygems.org/gems/autotools
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.14
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Autotools implementation in Ruby
45
+ test_files: []