Mxx_ru 1.4.8 → 1.4.9

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.
data/THANKS CHANGED
@@ -2,3 +2,4 @@ Konstantine Nazarov (rut at user dot sourceforge dot net)
2
2
  Igor Mironchick (imironchick at gmail dot com)
3
3
  Mikhail Pustovalov (mpustovalov at gmail dot com)
4
4
  Oleg Nabiullin (nabiullin at tecomgroup dot ru)
5
+ Timur Hairulin (timurhai at gmail dot com)
@@ -206,6 +206,22 @@ module Cpp
206
206
  # More exact: a.qrc -> a.rcc
207
207
  attr_reader :qt_qrc2rcc_files
208
208
 
209
+ # File list for translations.
210
+ #
211
+ attr_reader :qt_ts_files
212
+
213
+ # List of options for lupdate utility.
214
+ #
215
+ # Default value: [ '-noobsolete', '-silent' ]
216
+ #
217
+ attr_accessor :lupdate_options
218
+
219
+ # Name of lupdate tool.
220
+ #
221
+ # Default value: lupdate.
222
+ #
223
+ attr_accessor :lupdate_name
224
+
209
225
  # Target, generator is created for.
210
226
  attr :target
211
227
 
@@ -220,6 +236,8 @@ module Cpp
220
236
  @moc_result_subdir = nil
221
237
  @uic_result_subdir = nil
222
238
  @qrc_result_subdir = nil
239
+ @lupdate_name = 'lupdate'
240
+ @lupdate_options = [ '-noobsolete', '-silent' ]
223
241
 
224
242
  # If uic_result_subdir not nil than we must add
225
243
  # uic_result_subdir into
@@ -231,6 +249,7 @@ module Cpp
231
249
  @qt_ui_files = []
232
250
  @qt_qrc2cpp_files = []
233
251
  @qt_qrc2rcc_files = []
252
+ @qt_ts_files = []
234
253
 
235
254
  defines_to_set = a_defines.flatten
236
255
  defines_to_set.each { |d| a_target.define( d ) }
@@ -293,6 +312,14 @@ module Cpp
293
312
  a_modules.each { |m| use_module( m ) }
294
313
  end
295
314
 
315
+ # Add translation file.
316
+ #
317
+ # a_file -- name of .ts-file.
318
+ #
319
+ def ts( a_name )
320
+ @qt_ts_files << a_name
321
+ end
322
+
296
323
  # Perform files generation.
297
324
  def build( a_target )
298
325
  build_from_ui( a_target )
@@ -300,6 +327,7 @@ module Cpp
300
327
  build_from_qrc2rcc( a_target )
301
328
  build_from_h( a_target )
302
329
  build_from_cpp( a_target )
330
+ build_translations( a_target )
303
331
  end
304
332
 
305
333
  # Perform generated files cleanup.
@@ -519,6 +547,24 @@ module Cpp
519
547
  }
520
548
  end
521
549
 
550
+ # Perform .ts-files building.
551
+ #
552
+ def build_translations( a_target )
553
+ return if 0 == @qt_ts_files.size
554
+
555
+ project_path = File.dirname( a_target.prj_alias )
556
+ @qt_ts_files.each do |ts_file|
557
+ full_ts_file_name = File.join( project_path, ts_file )
558
+ MxxRu::Util::ensure_path_exists( File.dirname( full_ts_file_name ) )
559
+
560
+ MxxRu::AbstractTarget::run(
561
+ [ "#{lupdate_name} #{lupdate_options.join(' ')} " +
562
+ "#{project_path} -ts #{full_ts_file_name}" ],
563
+ [ full_ts_file_name ],
564
+ "building translation file #{full_ts_file_name}" )
565
+ end
566
+ end
567
+
522
568
  # Formatting file name, which is generated from cpp file by moc tool
523
569
  def moc_from_cpp( a_cpp_file, a_target )
524
570
  path = make_moc_result_path_for( File.dirname( a_cpp_file ) )
@@ -0,0 +1,72 @@
1
+ #--
2
+ # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
+ # Copyright (c) 2004-2006, JSC Intervale
4
+ # Copyright (c) 2006-2009, The Mxx_ru Project
5
+ # All rights reserved.
6
+ #
7
+ # Redistribution and use in source and binary forms, with or without modification,
8
+ # are permitted provided that the following conditions are met:
9
+ #
10
+ # 1. Redistributions of source code must retain the above copyright notice,
11
+ # this list of conditions and the following disclaimer.
12
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ # 3. The name of the author may not be used to endorse or promote products derived
16
+ # from this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
21
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #++
28
+
29
+ require 'mxx_ru/cpp/toolsets/gcc_unix_family'
30
+
31
+ module MxxRu
32
+ module Cpp
33
+ module Toolsets
34
+
35
+ # Toolset implemetation for GCC compiler for MacOS X (Darwin).
36
+ class GccDarwin < GccFamily
37
+ public
38
+ def initialize( a_name = "gcc" )
39
+ super( a_name )
40
+
41
+ setup_tag( GCC_PORT_TAG, GCC_PORT_UNIX )
42
+ setup_tag( "host_os", "unix" )
43
+ setup_tag( "target_os", "unix" )
44
+ setup_tag( "unix_port", "darwin" )
45
+ end
46
+
47
+ def setup_mandatory_options( target )
48
+ super( target )
49
+
50
+ if target.target_type.name == DllTargetType::TYPE
51
+ target.linker_option( "-prebind" )
52
+ target.linker_option( "-dynamiclib" )
53
+ target.linker_option( "-single_module" )
54
+ elsif target.target_type.name == ExeTargetType::TYPE
55
+ target.linker_option( "-prebind" )
56
+ end
57
+ end
58
+
59
+ # There ins't any bracket on MacOS X.
60
+ def enclose_linker_include_lib_options_into_brackes( options )
61
+ options
62
+ end
63
+ end # class GccDarwin
64
+
65
+ end # module Toolsets
66
+
67
+ end # module Cpp
68
+
69
+ end # module MxxRu
70
+
71
+ MxxRu::Cpp::setup_toolset( MxxRu::Cpp::Toolsets::GccDarwin.new )
72
+
@@ -1,7 +1,7 @@
1
1
  #--
2
2
  # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
3
  # Copyright (c) 2004-2006, JSC Intervale
4
- # Copyright (c) 2006-2008, The Mxx_ru Project
4
+ # Copyright (c) 2006-2009, The Mxx_ru Project
5
5
  # All rights reserved.
6
6
  #
7
7
  # Redistribution and use in source and binary forms, with or without modification,
@@ -279,7 +279,16 @@ module MxxRu
279
279
  all_libs = libs.inject( '' ) { |r, l|
280
280
  r << '-l' << port_specific_lib_name_checker( l.name ) << ' '
281
281
  }
282
- "-Wl,--start-group #{all_libs} -Wl,--end-group "
282
+ enclose_linker_include_lib_options_into_brackes( all_libs )
283
+ end
284
+
285
+ # Enclose library list into brackets if necessary.
286
+ #
287
+ # For example, on Linux -Wl,--start-group and -Wl,--end-group
288
+ # should be used around library list.
289
+ #
290
+ def enclose_linker_include_lib_options_into_brackes( options )
291
+ "-Wl,--start-group #{options} -Wl,--end-group "
283
292
  end
284
293
 
285
294
  # Return string containing port-specific linker option for DLL linking.
@@ -61,7 +61,7 @@ class GccUnixFamily < GccFamily
61
61
  r << '-l' << port_specific_lib_name_checker( l.name ) << ' '
62
62
  }
63
63
  all_libs << switch_to_default_lib_mode_if_needed( current_lib_type )
64
- "-Wl,--start-group #{all_libs} -Wl,--end-group "
64
+ enclose_linker_include_lib_options_into_brackes( all_libs )
65
65
  end
66
66
 
67
67
  # Return default library linking mode for current platform.
@@ -34,5 +34,5 @@
34
34
  #
35
35
  # puts 'Mxx_ru version is: ' + MXX_RU_VERSION
36
36
  #
37
- MXX_RU_VERSION = '1.4.8'
37
+ MXX_RU_VERSION = '1.4.9'
38
38
 
@@ -1,3 +1,3 @@
1
- #include <cstdio>
2
-
3
- void A() { std::printf( "A2\n" ); }
1
+ #include <cstdio>
2
+
3
+ void A() { std::printf( "A2\n" ); }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'a'
4
+ target 'MyA'
5
5
 
6
6
  cpp_source 'a.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'b'
4
+ target 'MyB'
5
5
 
6
6
  required_prj 'a.rb'
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'A'
4
+ target 'MyA'
5
5
 
6
6
  cpp_source 'a.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'B'
4
+ target 'MyB'
5
5
 
6
6
  cpp_source 'b.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'C'
4
+ target 'MyC'
5
5
 
6
6
  cpp_source 'c.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'D'
4
+ target 'MyD'
5
5
 
6
6
  cpp_source 'd.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'E'
4
+ target 'MyE'
5
5
 
6
6
  cpp_source 'e.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'F'
4
+ target 'MyF'
5
5
 
6
6
  cpp_source 'f.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'G'
4
+ target 'MyG'
5
5
 
6
6
  cpp_source 'g.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'A'
4
+ target 'MyA'
5
5
 
6
6
  cpp_source 'a.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'B'
4
+ target 'MyB'
5
5
 
6
6
  cpp_source 'b.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'C'
4
+ target 'MyC'
5
5
 
6
6
  cpp_source 'c.cpp'
7
7
  }
@@ -1,7 +1,7 @@
1
1
  require 'mxx_ru/cpp'
2
2
 
3
3
  MxxRu::Cpp::lib_target {
4
- target 'D'
4
+ target 'MyD'
5
5
 
6
6
  cpp_source 'd.cpp'
7
7
  }
@@ -4,11 +4,10 @@ MxxRu::Cpp::exe_target {
4
4
  target 'main'
5
5
 
6
6
  lib_path '.'
7
- lib_static 'A'
8
- lib_static 'B'
9
- lib 'C'
10
- lib_static 'D'
7
+ lib_static 'MyA'
8
+ lib_static 'MyB'
9
+ lib 'MyC'
10
+ lib_static 'MyD'
11
11
 
12
12
  cpp_source 'main.cpp'
13
13
  }
14
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Mxx_ru
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.8
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Mxx_ru Project
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-15 00:00:00 +03:00
12
+ date: 2009-03-06 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -348,6 +348,7 @@ files:
348
348
  - lib/mxx_ru/cpp/toolsets/c89_nsk.rb
349
349
  - lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb
350
350
  - lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb
351
+ - lib/mxx_ru/cpp/toolsets/gcc_darwin.rb
351
352
  - lib/mxx_ru/cpp/toolsets/gcc_family.rb
352
353
  - lib/mxx_ru/cpp/toolsets/gcc_linux.rb
353
354
  - lib/mxx_ru/cpp/toolsets/gcc_mingw.rb