libusb 0.6.0-x86-linux → 0.6.1-x86-linux

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: 8745d74ba38a4b244a0a767c9f8d8b11399cb788
4
- data.tar.gz: dfbabc151f3b6098b888a3a4c616d14d4053f079
3
+ metadata.gz: 5ff4b89cdc9bbafe7bacc3dd6a868d7575d8949f
4
+ data.tar.gz: 3e29491b366bf81f0646607c743567cf4f328c78
5
5
  SHA512:
6
- metadata.gz: caa29ff2a44bd7d16ec6f8b66df34c3cf071b08783dc50f47476739eb18ca30cbd1c5c63c18c83f6914f5d9413c039125fcb4aed4f96420331c7ecd4c7af48f8
7
- data.tar.gz: b62f5112cc342bc683e7b625e0db0bc5b50088217f504148b1ed2fffec20c2cf8d05bd6da42607df8cd8a2298441a9d1be781727c9b2aa95768c86da02ac75f9
6
+ metadata.gz: 20cccbae192521aca6c42756302e7f356a84e8a93d5503bab33af34650f92870012d71165f854ce9dd4bfb1490038511fcf4cb8b8f87f6c81a481ec46f6d7cfd
7
+ data.tar.gz: 2b7143b58f11c6891f2c35d38800f9c4c228210d783dd88fcfffef0b9cdf771700636af1c416c4b88a6ad0127c99e6174c9be7317ce39ad80eae70b0e162194e
data/History.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.6.1 / 2016-12-18
2
+ ------------------
3
+ * Fix installation of bundled libusb library in source gem.
4
+
1
5
  0.6.0 / 2016-12-09
2
6
  ------------------
3
7
  * Update bundled libusb version to 1.0.21.
data/Rakefile CHANGED
@@ -1,18 +1,20 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # -*- ruby -*-
3
3
 
4
- require 'bundler/gem_tasks'
4
+ require 'bundler/gem_helper'
5
5
  require 'rubygems/package_task'
6
6
  require 'pathname'
7
7
  require 'uri'
8
8
  require 'ostruct'
9
9
  require 'rake/clean'
10
10
  require 'rake_compiler_dock'
11
- require_relative 'ext/libusb_recipe'
11
+ require_relative 'lib/libusb/libusb_recipe'
12
+ require_relative 'lib/libusb/gem_helper'
12
13
 
13
14
  task :gem => :build
14
15
  task :compile do
15
- sh "ruby ext/extconf.rb --disable-system-libusb"
16
+ sh "ruby -C ext extconf.rb --disable-system-libusb"
17
+ sh "make -C ext install RUBYARCHDIR=../lib"
16
18
  end
17
19
 
18
20
  task :test=>:compile do
@@ -25,40 +27,6 @@ task :travis=>:compile do
25
27
  end
26
28
  task :default => :test
27
29
 
28
- task "release:tag" do
29
- hfile = "History.md"
30
- version = LIBUSB::VERSION
31
- reldate = Time.now.strftime("%Y-%m-%d")
32
- headline = '([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
33
-
34
- hin = File.read(hfile)
35
- hout = hin.sub(/#{headline}/) do
36
- raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version
37
- $1 + $2 + $3 + reldate + $5
38
- end
39
- if hout != hin
40
- Bundler.ui.confirm "Updating #{hfile} for release."
41
- File.write(hfile, hout)
42
- sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
43
- end
44
-
45
- Bundler.ui.confirm "Tag release with annotation:"
46
- m = hout.match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
47
- Bundler.ui.info(m[:annotation].gsub(/^/, " "))
48
- IO.popen(["git", "tag", "--file=-", version], "w") do |fd|
49
- fd.write m[:annotation]
50
- end
51
- end
52
-
53
- task "release:guard_clean" => "release:tag"
54
-
55
- task "release:rubygem_push" => "gem:native" do
56
- CrossLibraries.each do |ruby_platform, _|
57
- gh = Bundler::GemHelper.new
58
- gh.rubygem_push(gh.spec_path.gsub(".gem", "-#{ruby_platform}.gem"))
59
- end
60
- end
61
-
62
30
  task 'gem:native' do
63
31
  sh "bundle package"
64
32
  RakeCompilerDock.sh <<-EOT
@@ -67,79 +35,16 @@ task 'gem:native' do
67
35
  EOT
68
36
  end
69
37
 
70
- class CrossLibrary < OpenStruct
71
- include Rake::DSL
72
-
73
- def initialize(ruby_platform, host_platform, libusb_dllname)
74
- super()
75
-
76
- self.ruby_platform = ruby_platform
77
- self.recipe = LibusbRecipe.new
78
- recipe.host = host_platform
79
- recipe.configure_options << "--host=#{recipe.host}"
80
- self.libusb_dll = Pathname.new(recipe.path) + libusb_dllname
81
-
82
- file libusb_dll do
83
- recipe.cook
84
- end
85
-
86
- task "libusb_dll:#{ruby_platform}" => libusb_dll
87
-
88
- desc 'Cross compile libusb for win32'
89
- task :cross => [ "libusb_dll:#{ruby_platform}" ] do |t|
90
- spec = Gem::Specification::load("libusb.gemspec").dup
91
- spec.platform = Gem::Platform.new(ruby_platform)
92
- spec.extensions = []
93
-
94
- # Remove files unnecessary for native gems
95
- spec.files -= `git ls-files ext`.split("\n")
96
- spec.files.reject!{|f| f.start_with?('ports') }
97
- spec_text_files = spec.files.dup
98
-
99
- # Add native libusb-dll
100
- spec.files << "lib/#{libusb_dll.basename}"
101
-
102
- # MiniPortile isn't required for native gems
103
- spec.dependencies.reject!{|d| d.name=="mini_portile2" }
104
-
105
- # Generate a package for this gem
106
- pkg = Gem::PackageTask.new(spec) do |pkg|
107
- pkg.need_zip = false
108
- pkg.need_tar = false
109
- # Do not copy any files per PackageTask, because
110
- # we need the files from the platform specific directory
111
- pkg.package_files.clear
112
- end
113
-
114
- # copy files of the gem to pkg directory
115
- file pkg.package_dir_path => spec_text_files do
116
- spec_text_files.each do |fn|
117
- f = File.join(pkg.package_dir_path, fn)
118
- fdir = File.dirname(f)
119
- mkdir_p(fdir) if !File.exist?(fdir)
120
- rm_f f
121
- safe_ln(fn, f)
122
- end
123
-
124
- # copy libusb.dll to pkg directory
125
- f = "#{pkg.package_dir_path}/lib/#{libusb_dll.basename}"
126
- mkdir_p File.dirname(f)
127
- rm_f f
128
- safe_ln libusb_dll.realpath, f
129
- end
130
-
131
- file "lib/#{libusb_dll.basename}" => [libusb_dll]
132
- end
133
- end
134
- end
135
-
136
38
  CrossLibraries = [
137
- ['i386-mingw32', 'i686-w64-mingw32', 'bin/libusb-1.0.dll'],
39
+ ['x86-mingw32', 'i686-w64-mingw32', 'bin/libusb-1.0.dll'],
138
40
  ['x64-mingw32', 'x86_64-w64-mingw32', 'bin/libusb-1.0.dll'],
139
41
  ['x86-linux', 'i686-linux-gnu', 'lib/libusb-1.0.so'],
140
42
  ['x86_64-linux', 'x86_64-linux-gnu', 'lib/libusb-1.0.so'],
141
- ].each do |ruby_platform, host_platform, libusb_dll|
142
- CrossLibrary.new ruby_platform, host_platform, libusb_dll
43
+ ].map do |ruby_platform, host_platform, libusb_dll|
44
+ LIBUSB::CrossLibrary.new ruby_platform, host_platform, libusb_dll
143
45
  end
144
46
 
47
+ LIBUSB::GemHelper.install_tasks
48
+ Bundler::GemHelper.instance.cross_platforms = CrossLibraries.map(&:ruby_platform)
49
+
145
50
  # vim: syntax=ruby
@@ -0,0 +1,147 @@
1
+ # This file is part of Libusb for Ruby.
2
+ #
3
+ # Libusb for Ruby is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # Libusb for Ruby is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "bundler/gem_helper"
17
+
18
+ module LIBUSB
19
+ class GemHelper < Bundler::GemHelper
20
+ attr_accessor :cross_platforms
21
+
22
+ def install
23
+ super
24
+
25
+ task "release:guard_clean" => ["release:update_history"]
26
+
27
+ task "release:update_history" do
28
+ update_history
29
+ end
30
+
31
+ task "release:rubygem_push" => ["gem:native"]
32
+ end
33
+
34
+ def hfile
35
+ "History.md"
36
+ end
37
+
38
+ def headline
39
+ '([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
40
+ end
41
+
42
+ def reldate
43
+ Time.now.strftime("%Y-%m-%d")
44
+ end
45
+
46
+ def update_history
47
+ hin = File.read(hfile)
48
+ hout = hin.sub(/#{headline}/) do
49
+ raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s
50
+ $1 + $2 + $3 + reldate + $5
51
+ end
52
+ if hout != hin
53
+ Bundler.ui.confirm "Updating #{hfile} for release."
54
+ File.write(hfile, hout)
55
+ Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
56
+ end
57
+ end
58
+
59
+ def tag_version
60
+ Bundler.ui.confirm "Tag release with annotation:"
61
+ m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
62
+ Bundler.ui.info(m[:annotation].gsub(/^/, " "))
63
+ IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
64
+ fd.write m[:annotation]
65
+ end
66
+ yield if block_given?
67
+ rescue
68
+ Bundler.ui.error "Untagging #{version_tag} due to error."
69
+ sh_with_code "git tag -d #{version_tag}"
70
+ raise
71
+ end
72
+
73
+ def rubygem_push(path)
74
+ cross_platforms.each do |ruby_platform|
75
+ super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
76
+ end
77
+ super(path)
78
+ end
79
+ end
80
+
81
+
82
+ class CrossLibrary < OpenStruct
83
+ include Rake::DSL
84
+
85
+ def initialize(ruby_platform, host_platform, libusb_dllname)
86
+ super()
87
+
88
+ self.ruby_platform = ruby_platform
89
+ self.recipe = LIBUSB::LibusbRecipe.new
90
+ recipe.host = host_platform
91
+ recipe.configure_options << "--host=#{recipe.host}"
92
+ self.libusb_dll = Pathname.new(recipe.path) + libusb_dllname
93
+
94
+ file libusb_dll do
95
+ recipe.cook
96
+ end
97
+
98
+ task "libusb_dll:#{ruby_platform}" => libusb_dll
99
+
100
+ desc 'Cross compile libusb for win32'
101
+ task :cross => [ "libusb_dll:#{ruby_platform}" ] do |t|
102
+ spec = Gem::Specification::load("libusb.gemspec").dup
103
+ spec.platform = Gem::Platform.new(ruby_platform)
104
+ spec.extensions = []
105
+
106
+ # Remove files unnecessary for native gems
107
+ spec.files -= `git ls-files ext`.split("\n")
108
+ spec.files.reject!{|f| f.start_with?('ports') }
109
+ spec_text_files = spec.files.dup
110
+
111
+ # Add native libusb-dll
112
+ spec.files << "lib/#{libusb_dll.basename}"
113
+
114
+ # MiniPortile isn't required for native gems
115
+ spec.dependencies.reject!{|d| d.name=="mini_portile2" }
116
+
117
+ # Generate a package for this gem
118
+ pkg = Gem::PackageTask.new(spec) do |pkg|
119
+ pkg.need_zip = false
120
+ pkg.need_tar = false
121
+ # Do not copy any files per PackageTask, because
122
+ # we need the files from the platform specific directory
123
+ pkg.package_files.clear
124
+ end
125
+
126
+ # copy files of the gem to pkg directory
127
+ file pkg.package_dir_path => spec_text_files do
128
+ spec_text_files.each do |fn|
129
+ f = File.join(pkg.package_dir_path, fn)
130
+ fdir = File.dirname(f)
131
+ mkdir_p(fdir) if !File.exist?(fdir)
132
+ rm_f f
133
+ safe_ln(fn, f)
134
+ end
135
+
136
+ # copy libusb.dll to pkg directory
137
+ f = "#{pkg.package_dir_path}/lib/#{libusb_dll.basename}"
138
+ mkdir_p File.dirname(f)
139
+ rm_f f
140
+ safe_ln libusb_dll.realpath, f
141
+ end
142
+
143
+ file "lib/#{libusb_dll.basename}" => [libusb_dll]
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'dependencies'
2
+ require 'rubygems'
3
+ # Keep the version constraint in sync with libusb.gemspec
4
+ gem "mini_portile2", LIBUSB::MINI_PORTILE_VERSION
5
+ require "mini_portile2"
6
+
7
+ module LIBUSB
8
+ class LibusbRecipe < MiniPortile
9
+ ROOT = File.expand_path('../../..', __FILE__)
10
+
11
+ def initialize
12
+ super("libusb", LIBUSB_VERSION)
13
+ self.target = File.join(ROOT, "ports")
14
+ self.files = [url: LIBUSB_SOURCE_URI, sha1: LIBUSB_SOURCE_SHA1]
15
+ self.configure_options = []
16
+ end
17
+
18
+ def cook_and_activate
19
+ checkpoint = File.join(self.target, "#{self.name}-#{self.version}-#{self.host}.installed")
20
+ unless File.exist?(checkpoint)
21
+ self.cook
22
+ FileUtils.touch checkpoint
23
+ end
24
+ self.activate
25
+ self
26
+ end
27
+
28
+ public :files_hashs
29
+ end
30
+ end
@@ -15,5 +15,5 @@
15
15
 
16
16
  module LIBUSB
17
17
  # Library version of libusb for Ruby
18
- VERSION = "0.6.0"
18
+ VERSION = "0.6.1"
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libusb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - Lars Kanis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-09 00:00:00.000000000 Z
11
+ date: 2016-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -96,7 +96,9 @@ files:
96
96
  - lib/libusb/device.rb
97
97
  - lib/libusb/endpoint.rb
98
98
  - lib/libusb/eventmachine.rb
99
+ - lib/libusb/gem_helper.rb
99
100
  - lib/libusb/interface.rb
101
+ - lib/libusb/libusb_recipe.rb
100
102
  - lib/libusb/setting.rb
101
103
  - lib/libusb/ss_companion.rb
102
104
  - lib/libusb/stdio.rb