ryb 0.2.2.0 → 0.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 967b64b65c0a4e6e0b55cf72f91ee5c12ee9c317
4
- data.tar.gz: 3c5bc20bdc03baeed7642fcb17c6afc93738282f
3
+ metadata.gz: b3a0798e444f9bbea1b7dcae4c18a8c238faaff2
4
+ data.tar.gz: 5985a2218e703b9736338ba85ca4da10bf769182
5
5
  SHA512:
6
- metadata.gz: 355d9136fb7b6242c4f2e6827917affcb14de3afe52d0e9cef2f60bf65bca23c928f069dc87ebdac99af9d99862aafafd4d73f9db71a737107a468038f924641
7
- data.tar.gz: 433e4402f912ec821ea9a811549e89097989a18c4d5cf7fc20526cc8810e34bf0301e16bc95e243a0499949bacbccea1b1d2b01763d6e8182f25d3d9bf5a4763
6
+ metadata.gz: 98eab62ee6529b19c35bb0a0b19b3e6ed2cce830fb5cc866175c00b10c42dae28d13a3e6a96d729a3c318db0f468b77bedf716da1498aac0d97afdf9c0ae77a3
7
+ data.tar.gz: 92d73b5b190dd663408ee39b5985895fd877e0cfc24d30f204f11659e36d11042aeb859fe0a39fd7177e6aba2db55f9a0183561c2de43e68e5da85ff779461c8
@@ -117,24 +117,24 @@ module Ryb
117
117
  end
118
118
 
119
119
  module Code
120
- def add_source_file(file)
120
+ def add_source_file(file, **options)
121
121
  case file
122
122
  when SourceFile
123
123
  @spec.sources ||= []
124
124
  @spec.sources = @spec.sources + [file]
125
125
  when String
126
- add_source_file(SourceFile.new(file))
126
+ add_source_file(SourceFile.new(file, options))
127
127
  end
128
128
  end
129
129
 
130
- def add_source_files(*files_and_patterns)
130
+ def add_source_files(*files_and_patterns, **options)
131
131
  [*files_and_patterns].each do |file_or_pattern|
132
132
  case file_or_pattern
133
133
  when SourceFile
134
- add_source_file(file_or_pattern)
134
+ add_source_file(file_or_pattern, options)
135
135
  when String
136
136
  [*(Dir.glob(file_or_pattern))].each do |file|
137
- add_source_file(file)
137
+ add_source_file(file, options)
138
138
  end
139
139
  end
140
140
  end
@@ -41,7 +41,7 @@ module Ryb
41
41
  end
42
42
 
43
43
  module VERSION #:nodoc:
44
- MAJOR, MINOR, PATCH, PRE = [0, 2, 2, 0]
44
+ MAJOR, MINOR, PATCH, PRE = [0, 2, 2, 1]
45
45
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
46
46
  end
47
47
 
@@ -48,11 +48,12 @@ module Ryb
48
48
  name = product.name.canonicalize
49
49
  namespace = "#{name}_#{tripletised.triplet.join('_')}"
50
50
 
51
- sdk = @vc.sdks[:windows].select{|sdk| sdk.version == '7.1'}.first
51
+ sdk = @vc.sdks[:windows].select{|sdk| sdk.version.to_f >= 7.1}.first
52
52
  sys_include_paths = @vc.includes + sdk.includes
53
53
  sys_lib_paths = @vc.libraries[arch] + sdk.libraries[arch]
54
54
 
55
55
  @ninjafile.variable "#{namespace}_cflags_sys", VisualStudio::Compiler.include_paths_to_flags(sys_include_paths).join(' ')
56
+ @ninjafile.variable "#{namespace}_cxxflags_sys", "$#{namespace}_cflags_sys"
56
57
  @ninjafile.variable "#{namespace}_ldflags_sys", VisualStudio::Linker.library_paths_to_flags(sys_lib_paths).join(' ')
57
58
 
58
59
  cflags = cflags_for_product(project, product, tripletised)
@@ -76,9 +77,8 @@ module Ryb
76
77
  @ninjafile.variable "#{namespace}_symbols", artifacts[0].gsub(/\.(exe|lib|dll)/, ".pdb")
77
78
 
78
79
  # https://github.com/ninja-build/ninja/blob/d1763746b65cc7349d4ed9478befdb651aa24589/src/msvc_helper_main-win32.cc#L38
79
- # ninja -t msvc -e _build/#{namespace}.env -- cl.exe ...
80
80
  env_block = "#@build/#{namespace}.env_block"
81
- env = @vc.environment(target: {platform: :windows, architecture: arch})
81
+ env = @vc.environment(target: {platform: :windows, architecture: arch}, base: environment)
82
82
  # "PATH=#{(@vc.binaries[arch] + sdk.binaries[arch]).join(';')}\0"
83
83
  File.write(env_block, env.map{|env_var, value| "#{env_var}=#{value}"}.join("\0"))
84
84
 
@@ -137,6 +137,49 @@ module Ryb
137
137
  end
138
138
 
139
139
  private
140
+ def environment
141
+ variables = [
142
+ 'ALLUSERSPROFILE',
143
+ 'APPDATA',
144
+ 'CommonProgramFiles',
145
+ 'CommonProgramFiles(x86)',
146
+ 'CommonProgramW6432',
147
+ 'ComSpec',
148
+ 'HOMEDRIVE',
149
+ 'HOMEPATH',
150
+ 'LOCALAPPDATA',
151
+ 'Path',
152
+ 'PATHEXT',
153
+ 'ProgramData',
154
+ 'ProgramFiles',
155
+ 'ProgramFiles(x86)',
156
+ 'ProgramW6432',
157
+ 'PUBLIC',
158
+ 'SystemDrive',
159
+ 'SystemRoot',
160
+ 'TEMP',
161
+ 'TMP',
162
+ 'USERDOMAIN',
163
+ 'USERNAME',
164
+ 'USERPROFILE',
165
+ 'windir'
166
+ ]
167
+
168
+ @environment ||= begin
169
+ require 'win32/registry'
170
+ ::Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", ::Win32::Registry::KEY_READ) do |originals|
171
+ variables.map { |variable|
172
+ value = begin
173
+ originals[variable]
174
+ rescue
175
+ ENV[variable]
176
+ end
177
+ [variable, value]
178
+ }.to_h
179
+ end
180
+ end
181
+ end
182
+
140
183
  def sources_for_product(product, tripletised)
141
184
  sources = [*product.sources] |
142
185
  [*tripletised.configuration.sources] |
@@ -41,6 +41,8 @@ module Ryb
41
41
  end
42
42
 
43
43
  def self.generate_debug_symbols_to_flag(enabled)
44
+ # TODO(mtwilliams): Don't link to debug runtime.
45
+ # Do I need to expose another flag?
44
46
  # HACK(mtwilliams): Force writes to PDBs to be serialized.
45
47
  # Refer to https://msdn.microsoft.com/en-us/library/dn502518.aspx.
46
48
  enabled ? %w{/MDd /Zi /FS} : %w{/MD}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ryb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.0
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-02 00:00:00.000000000 Z
11
+ date: 2017-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -186,9 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.6.8
189
+ rubygems_version: 2.6.11
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Rubifiy your builds!
193
193
  test_files: []
194
- has_rdoc: