rake-compiler-dock 0.5.3 → 0.6.0

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: 0504b401bdf688a47b2eaa654af05a9c7dc9d86b
4
- data.tar.gz: 2184f866ea7070f607105205e87ce413babbc657
3
+ metadata.gz: 2e0d52f58f0768b99cd33787878fc5c1e5e9ca7a
4
+ data.tar.gz: f4d6c657190b2c278c3426e42ce240ae199a98f6
5
5
  SHA512:
6
- metadata.gz: 51fed52f779d7ff82b30e987cf58b51a59e682204a2ea8ec11d14e13e57ab4559255341b1e927dd7667c29c785567d011e1cde2e4246bfc8a6fc8445c2ee3d7e
7
- data.tar.gz: 711429cd13fdc3e9417ed381a4ace8f5ed329808e01da48d626f4e15ad8f0117f4d02624fb89ce07ee87c27a2b2bf53f6640819515c676c0d735abf5d9565110
6
+ metadata.gz: 281afedf0ce93786df7f0a5c7727d5cc4ca2cdb467449c246efe671f7389019e5f7205acc13bfdcf4352eca35332c20a2722d9fd8b5101ad408be17da45f00c1
7
+ data.tar.gz: 40836a3193f4fd98126204b9022ed8e247591ba7044189ca1ff13a03cf328f704a2418f5c1e0450adcb42f0dbd33f4978e49442425502a4fddb4ca4f90d2729b
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Dockerfile CHANGED
@@ -1,17 +1,7 @@
1
- FROM ubuntu:14.04
1
+ FROM ubuntu:16.10
2
2
 
3
3
  RUN apt-get -y update && \
4
- apt-get install -y curl git-core mingw32 xz-utils build-essential wget unzip
5
-
6
- RUN mkdir -p /opt/mingw && \
7
- curl -SL http://downloads.sourceforge.net/mingw-w64/i686-w64-mingw32-gcc-4.7.2-release-linux64_rubenvb.tar.xz | \
8
- tar -xJC /opt/mingw && \
9
- echo "export PATH=\$PATH:/opt/mingw/mingw32/bin" >> /etc/rubybashrc
10
-
11
- RUN mkdir -p /opt/mingw && \
12
- curl -SL http://downloads.sourceforge.net/mingw-w64/x86_64-w64-mingw32-gcc-4.7.2-release-linux64_rubenvb.tar.xz | \
13
- tar -xJC /opt/mingw && \
14
- echo "export PATH=\$PATH:/opt/mingw/mingw64/bin" >> /etc/rubybashrc
4
+ apt-get install -y curl git-core xz-utils build-essential wget unzip sudo gpg dirmngr
15
5
 
16
6
  # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
17
7
  RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
@@ -32,7 +22,7 @@ ENV BASH_ENV /etc/rubybashrc
32
22
  # install rubies and fix permissions on
33
23
  RUN bash -c " \
34
24
  export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
35
- for v in 2.3.0 1.9.3 1.8.7-p374 ; do \
25
+ for v in 2.4.0 ; do \
36
26
  rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
37
27
  done && \
38
28
  rvm cleanup all && \
@@ -42,8 +32,7 @@ RUN bash -c " \
42
32
  # do not generate documentation for gems
43
33
  RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
44
34
  bash -c " \
45
- rvm all do gem install --no-document bundler rake-compiler hoe mini_portile rubygems-tasks && \
46
- rvm 1.9.3,2.3.0 do gem install --no-document mini_portile2 && \
35
+ rvm all do gem install --no-document bundler rake-compiler hoe mini_portile rubygems-tasks mini_portile2 && \
47
36
  find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
48
37
 
49
38
  # Install rake-compiler's cross rubies in global dir instead of /root
@@ -51,58 +40,78 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
51
40
  sudo chown rvm.rvm /usr/local/rake-compiler && \
52
41
  ln -s /usr/local/rake-compiler ~/.rake-compiler
53
42
 
43
+ # Add cross compilers for Windows and Linux
44
+ USER root
45
+ RUN apt-get -y update && \
46
+ apt-get install -y gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-x86-64 g++-mingw-w64-i686 \
47
+ gcc-multilib moreutils
48
+ USER rvm
49
+
50
+ # Create dev tools i686-linux-gnu-*
51
+ COPY build/mk_i686.rb /root/
52
+ RUN bash -c "rvm use 2.4.0 --default && rvmsudo ruby /root/mk_i686.rb"
53
+
54
54
  # Patch rake-compiler to avoid build of ruby extensions
55
- RUN cd /usr/local/rvm/gems/ruby-1.8.7-p374/gems/rake-compiler-0.9.5 && git apply /home/rvm/patches/rake-compiler-0.9.5/*.diff ; \
56
- cd /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rake-compiler-0.9.5 && git apply /home/rvm/patches/rake-compiler-0.9.5/*.diff ; \
57
- cd /usr/local/rvm/gems/ruby-2.3.0/gems/rake-compiler-0.9.5 && git apply /home/rvm/patches/rake-compiler-0.9.5/*.diff ; \
55
+ RUN cd /usr/local/rvm/gems/ruby-2.4.0/gems/rake-compiler-1.0.3 && git apply /home/rvm/patches/rake-compiler-1.0.3/*.diff ;\
58
56
  true
59
57
 
60
- RUN bash -c "rvm use 2.3.0 --default && \
61
- export MAKE=\"make -j`nproc`\" CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
62
- rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-w64-mingw32 && \
63
- rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-w64-mingw32 && \
64
- rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-w64-mingw32 && \
65
- rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-w64-mingw32 && \
66
- rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-w64-mingw32 && \
67
- rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-w64-mingw32 && \
68
- rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-w64-mingw32 && \
69
- rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-w64-mingw32 && \
58
+ # Build cross ruby versions
59
+ RUN bash -c " \
60
+ export CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
61
+ parallel -- \
62
+ 'rake-compiler cross-ruby VERSION=2.4.0 HOST=i686-linux-gnu' \
63
+ 'rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-linux-gnu' \
64
+ 'rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-linux-gnu' \
65
+ 'rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-linux-gnu' \
66
+ 'rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-linux-gnu' \
67
+ 'rake-compiler cross-ruby VERSION=2.4.0 HOST=x86_64-linux-gnu' \
68
+ 'rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-linux-gnu' \
69
+ 'rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-linux-gnu' \
70
+ 'rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-linux-gnu' \
71
+ 'rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-linux-gnu' \
72
+ 'rake-compiler cross-ruby VERSION=2.4.0 HOST=i686-w64-mingw32' \
73
+ 'rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-w64-mingw32' \
74
+ 'rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-w64-mingw32' \
75
+ 'rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-w64-mingw32' \
76
+ 'rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-w64-mingw32' \
77
+ 'rake-compiler cross-ruby VERSION=2.4.0 HOST=x86_64-w64-mingw32' \
78
+ 'rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-w64-mingw32' \
79
+ 'rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-w64-mingw32' \
80
+ 'rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-w64-mingw32' \
81
+ 'rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-w64-mingw32' ; \
70
82
  rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
71
83
  find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
72
84
 
73
- RUN bash -c "rvm use 1.9.3 && \
74
- export CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
75
- rake-compiler cross-ruby VERSION=1.9.3-p551 HOST=i586-mingw32msvc && \
76
- rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources"
85
+ # Avoid linking against libruby shared object.
86
+ # See also https://github.com/rake-compiler/rake-compiler-dock/issues/13
87
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
88
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
89
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
90
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static/' $f ; done
77
91
 
78
- # Build 1.8.7 with mingw32 compiler (GCC 4.2)
79
- # Use just one CPU for building 1.8.7 and 1.9.3
80
- RUN bash -c "rvm use 1.8.7-p374 && \
81
- export CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
82
- rake-compiler cross-ruby VERSION=1.8.7-p374 HOST=i586-mingw32msvc && \
83
- rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources"
92
+ # RubyInstaller doesn't install libgcc -> link it static.
93
+ RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
84
94
 
85
95
  RUN bash -c " \
86
- rvm alias create 2.3 2.3.0 && \
87
- rvm alias create 1.9 1.9.3 && \
88
- rvm alias create 1.8 1.8.7-p374 "
96
+ rvm alias create 2.4 2.4.0 "
89
97
 
90
98
  USER root
91
99
 
100
+ # Add more libraries and tools to support cross build
101
+ RUN dpkg --add-architecture i386 && \
102
+ apt-get -y update && \
103
+ apt-get install -y libc6-dev:i386 libudev-dev libudev-dev:i386 cmake
104
+
92
105
  # Fix paths in rake-compiler/config.yml and add rvm and mingw-tools to the global bashrc
93
106
  RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml && \
94
- echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc && \
95
- echo "export PATH=\$PATH:/opt/mingw/mingw32/bin" >> /etc/bash.bashrc && \
96
- echo "export PATH=\$PATH:/opt/mingw/mingw64/bin" >> /etc/bash.bashrc
107
+ echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
97
108
 
98
- # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
109
+ # # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
99
110
  COPY build/strip_wrapper /root/
100
- RUN mv /opt/mingw/mingw32/bin/i686-w64-mingw32-strip /opt/mingw/mingw32/bin/i686-w64-mingw32-strip.bin && \
101
- mv /opt/mingw/mingw64/bin/x86_64-w64-mingw32-strip /opt/mingw/mingw64/bin/x86_64-w64-mingw32-strip.bin && \
102
- mv /usr/bin/i586-mingw32msvc-strip /usr/bin/i586-mingw32msvc-strip.bin && \
103
- ln /root/strip_wrapper /opt/mingw/mingw32/bin/i686-w64-mingw32-strip && \
104
- ln /root/strip_wrapper /opt/mingw/mingw64/bin/x86_64-w64-mingw32-strip && \
105
- ln /root/strip_wrapper /usr/bin/i586-mingw32msvc-strip
111
+ RUN mv /usr/bin/i686-w64-mingw32-strip /usr/bin/i686-w64-mingw32-strip.bin && \
112
+ mv /usr/bin/x86_64-w64-mingw32-strip /usr/bin/x86_64-w64-mingw32-strip.bin && \
113
+ ln /root/strip_wrapper /usr/bin/i686-w64-mingw32-strip && \
114
+ ln /root/strip_wrapper /usr/bin/x86_64-w64-mingw32-strip
106
115
 
107
116
  # Install SIGINT forwarder
108
117
  COPY build/sigfw.c /root/
@@ -114,6 +123,6 @@ COPY build/runas /usr/local/bin/
114
123
  # Install sudoers configuration
115
124
  COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
116
125
 
117
- ENV RUBY_CC_VERSION 2.3.0:2.2.2:2.1.6:2.0.0:1.9.3:1.8.7
126
+ ENV RUBY_CC_VERSION 2.4.0:2.3.0:2.2.2:2.1.6:2.0.0
118
127
 
119
128
  CMD bash
data/History.md CHANGED
@@ -1,3 +1,16 @@
1
+ 0.6.0 / YYYY-MM-DD
2
+ ------------------
3
+ * Remove Windows cross build environments for Ruby < 2.0.
4
+ * Add Windows cross build environment for Ruby-2.4.
5
+ * Add Linux cross build environment for Ruby-2.0 to 2.4.
6
+ * Update Windows gcc to 6.2.
7
+ * Update docker base image to Ubuntu-16.10.
8
+ * Update native rvm based ruby to 2.4.0.
9
+ * Respect MACHINE_DRIVER environment variable for docker-machine. #15
10
+ * Add RCD_WORKDIR and RCD_MOUNTDIR environment variables. #11
11
+ * Ignore non-unique UID or GID. #10
12
+
13
+
1
14
  0.5.3 / 2016-09-02
2
15
  ------------------
3
16
  * Fix 'docker-machine env' when running in Windows cmd shell
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # rake-compiler-dock
2
2
 
3
- **Easy to use and reliable cross compiler environment for building Windows binary gems.**
3
+ **Easy to use and reliable cross compiler environment for building Windows and Linux binary gems.**
4
4
 
5
- It provides cross compilers and Ruby environments for all versions of the [RubyInstaller](http://rubyinstaller.org/).
5
+ It provides cross compilers and Ruby environments for 2.0 and newer versions of the [RubyInstaller](http://rubyinstaller.org/) and Linux runtime environments.
6
6
  They are prepared for use with [rake-compiler](https://github.com/rake-compiler/rake-compiler).
7
7
  It is used by [many gems with C-extentions](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock).
8
8
 
@@ -30,18 +30,32 @@ Install rake-compiler-dock as a gem. The docker image is downloaded later on dem
30
30
 
31
31
  ## Usage
32
32
 
33
+ Rake-compiler-dock provides the necessary tools to build Ruby extensions for Windows and Linux written in C and C++.
34
+ It is intended to be used in conjunction with [rake-compiler's](https://github.com/rake-compiler/rake-compiler) cross build capability.
35
+ Your Rakefile should enable cross compilation like so:
36
+
37
+ Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
38
+ ext.cross_compile = true
39
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32 x86-linux x86_64-linux]
40
+ end
41
+
42
+ It may also be used to build ffi based binary gems like [libusb](https://github.com/larskanis/libusb), but currently doesn't provide any additional build helpers for this use case, beyond docker invocation and cross compilers.
43
+
44
+ ### Interactive Usage
45
+
33
46
  Rake-compiler-dock offers the shell command `rake-compiler-dock` and a [ruby API](http://www.rubydoc.info/gems/rake-compiler-dock/RakeCompilerDock) for issuing commands within the docker image, described below.
34
47
 
35
48
  `rake-compiler-dock` without arguments starts an interactive shell session.
36
49
  This is best suited to try out and debug a build.
37
50
  It mounts the current working directory into the docker environment.
38
51
  All changes below the current working directory are shared with the host.
39
- But note, that all other changes to the file system of the container are dropped at the end of the session - the docker image is static for a given version. `rake-compiler-dock` can also take the build command(s) from STDIN or as command arguments.
52
+ But note, that all other changes to the file system of the container are dropped at the end of the session - the docker image is static for a given version.
53
+ `rake-compiler-dock` can also take the build command(s) from STDIN or as command arguments.
40
54
 
41
55
  All commands are executed with the same user and group of the host.
42
56
  This is done by copying user account data into the container and sudo to it.
43
57
 
44
- To build x86- and x64 Windows (RubyInstaller) binary gems interactively, it can be called like this:
58
+ To build x86 and x64 Windows and Linux binary gems interactively, it can be called like this:
45
59
 
46
60
  user@host:$ cd your-gem-dir/
47
61
  user@host:$ rake-compiler-dock # this enters a container with an interactive shell
@@ -50,6 +64,7 @@ To build x86- and x64 Windows (RubyInstaller) binary gems interactively, it can
50
64
  user@5b53794ada92:$ exit
51
65
  user@host:$ ls pkg/*.gem
52
66
  your-gem-1.0.0.gem your-gem-1.0.0-x64-mingw32.gem your-gem-1.0.0-x86-mingw32.gem
67
+ your-gem-1.0.0-x86_64-linux.gem your-gem-1.0.0-x86-linux.gem
53
68
 
54
69
  Or non-interactive:
55
70
 
@@ -71,14 +86,15 @@ The current default is 2.3.
71
86
  To make the build process reproduceable for other parties, it is recommended to add rake-compiler-dock to your Rakefile.
72
87
  This can be done like this:
73
88
 
74
- task 'gem:windows' do
89
+ task 'gem:native' do
75
90
  require 'rake_compiler_dock'
76
- RakeCompilerDock.sh "bundle && rake cross native gem"
91
+ sh "bundle package" # Avoid repeated downloads of gems by using gem files from the host.
92
+ RakeCompilerDock.sh "bundle --local && rake cross native gem"
77
93
  end
78
94
 
79
95
  Rake-compiler-dock uses [semantic versioning](http://semver.org/), so you should add it into your Gemfile, to make sure, that future changes will not break your build.
80
96
 
81
- gem 'rake-compiler-dock', '~> 0.5.0'
97
+ gem 'rake-compiler-dock', '~> 0.6.0'
82
98
 
83
99
  See [the wiki](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock) for projects which make use of rake-compiler-dock.
84
100
 
@@ -103,6 +119,10 @@ The following variables are provided to the running docker container:
103
119
  * `RCD_HOST_RUBY_VERSION` - The `RUBY_VERSION` of the host ruby.
104
120
  * `RUBY_CC_VERSION` - The target ruby versions for rake-compiler.
105
121
  The default is defined in the [Dockerfile](https://github.com/rake-compiler/rake-compiler-dock/blob/master/Dockerfile), but can be changed as a parameter to rake.
122
+ * `RCD_MOUNTDIR` - The directory which is mounted into the docker container.
123
+ Defaults to pwd.
124
+ * `RCD_WORKDIR` - The working directory within the docker container.
125
+ Defaults to pwd.
106
126
 
107
127
  Other environment variables can be set or passed through to the container like this:
108
128
 
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake_compiler_dock"
3
+ require "rake_compiler_dock/gem_helper"
3
4
 
4
5
  task :build do
5
6
  sh "docker build -t larskanis/rake-compiler-dock:#{RakeCompilerDock::IMAGE_VERSION} ."
@@ -0,0 +1,16 @@
1
+ require "fileutils"
2
+
3
+ Dir["/usr/bin/x86_64-linux-gnu-*"].each do |file|
4
+ case File.basename(file)
5
+ when /^x86_64-linux-gnu-(gcc|g\+\+|ld)$/
6
+ e = $1
7
+ puts "create /usr/bin/i686-linux-gnu-#{e}"
8
+ File.write("/usr/bin/i686-linux-gnu-#{e}", <<-EOT)
9
+ #!/bin/sh
10
+ x86_64-linux-gnu-#{e} -m32 "$@"
11
+ EOT
12
+ File.chmod(0755, "/usr/bin/i686-linux-gnu-#{e}")
13
+ when /^x86_64-linux-gnu-([a-z+\.]+)$/
14
+ FileUtils.ln_s(file, "/usr/bin/i686-linux-gnu-#{$1}", verbose: true)
15
+ end
16
+ end
@@ -1,14 +1,13 @@
1
1
  diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index 6acc816..6aa2a49 100644
2
+ index 6230799..3a69f13 100644
3
3
  --- a/tasks/bin/cross-ruby.rake
4
4
  +++ b/tasks/bin/cross-ruby.rake
5
- @@ -135,8 +135,7 @@ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER
5
+ @@ -134,6 +134,8 @@ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER
6
+ "--target=#{MINGW_TARGET}",
6
7
  "--build=#{RUBY_BUILD}",
7
8
  '--enable-shared',
9
+ + '--enable-static',
10
+ + '--enable-install-static-library',
8
11
  '--disable-install-doc',
9
- - '--without-tk',
10
- - '--without-tcl'
11
- + '--with-ext='
12
+ '--with-ext='
12
13
  ]
13
-
14
- # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
@@ -1,8 +1,8 @@
1
1
  #!/bin/bash
2
2
 
3
- groupadd -g "$GID" "$GROUP"
3
+ groupadd -o -g "$GID" "$GROUP"
4
4
  mkdir -p /tmp/home
5
- useradd -g "$GID" -u "$UID" -G rvm,sudo -p "" -b /tmp/home -m "$USER"
5
+ useradd -o -g "$GID" -u "$UID" -G rvm,sudo -p "" -b /tmp/home -m "$USER"
6
6
 
7
7
  HOME=$(bash <<< "echo ~$USER")
8
8
  ln -s /usr/local/rake-compiler "$HOME"/.rake-compiler
@@ -7,6 +7,8 @@
7
7
  * Therefore Ctrl-C aka SIGINT is ignored per default.
8
8
  */
9
9
 
10
+ #include <unistd.h>
11
+ #include <stdio.h>
10
12
  #include <signal.h>
11
13
  #include <sys/types.h>
12
14
  #include <sys/wait.h>
@@ -83,7 +83,8 @@ module RakeCompilerDock
83
83
 
84
84
  def doma_create
85
85
  options = add_env_options([], %w[ftp_proxy http_proxy https_proxy])
86
- @doma_create_text, @doma_create_status = run("docker-machine create --driver virtualbox #{options.join(" ")} #{machine_name}", cmd: :visible, output: :visible)
86
+ driver = ENV['MACHINE_DRIVER'] || 'virtualbox'
87
+ @doma_create_text, @doma_create_status = run("docker-machine create --driver #{driver.inspect} #{options.join(" ")} #{machine_name}", cmd: :visible, output: :visible)
87
88
  end
88
89
 
89
90
  def doma_create_ok?
@@ -0,0 +1,69 @@
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 RakeCompilerDock
19
+ class GemHelper < Bundler::GemHelper
20
+ def install
21
+ super
22
+
23
+ task "release:guard_clean" => ["release:update_history"]
24
+
25
+ task "release:update_history" do
26
+ update_history
27
+ end
28
+ end
29
+
30
+ def hfile
31
+ "History.md"
32
+ end
33
+
34
+ def headline
35
+ '([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
36
+ end
37
+
38
+ def reldate
39
+ Time.now.strftime("%Y-%m-%d")
40
+ end
41
+
42
+ def update_history
43
+ hin = File.read(hfile)
44
+ hout = hin.sub(/#{headline}/) do
45
+ raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s
46
+ $1 + $2 + $3 + reldate + $5
47
+ end
48
+ if hout != hin
49
+ Bundler.ui.confirm "Updating #{hfile} for release."
50
+ File.write(hfile, hout)
51
+ Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
52
+ end
53
+ end
54
+
55
+ def tag_version
56
+ Bundler.ui.confirm "Tag release with annotation:"
57
+ m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
58
+ Bundler.ui.info(m[:annotation].gsub(/^/, " "))
59
+ IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
60
+ fd.write m[:annotation]
61
+ end
62
+ yield if block_given?
63
+ rescue
64
+ Bundler.ui.error "Untagging #{version_tag} due to error."
65
+ sh_with_code "git tag -d #{version_tag}"
66
+ raise
67
+ end
68
+ end
69
+ end
@@ -1,5 +1,5 @@
1
1
  # DO NOT EDIT - This file is generated per 'rake update_lists'
2
2
  module RakeCompilerDock
3
- PredefinedUsers = ["root", "daemon", "bin", "sys", "sync", "games", "man", "lp", "mail", "news", "uucp", "proxy", "www-data", "backup", "list", "irc", "gnats", "nobody", "libuuid", "syslog", "rvm"]
4
- PredefinedGroups = ["root", "daemon", "bin", "sys", "adm", "tty", "disk", "lp", "mail", "news", "uucp", "man", "proxy", "kmem", "dialout", "fax", "voice", "cdrom", "floppy", "tape", "sudo", "audio", "dip", "www-data", "backup", "operator", "list", "irc", "src", "gnats", "shadow", "utmp", "video", "sasl", "plugdev", "staff", "games", "users", "nogroup", "libuuid", "netdev", "crontab", "syslog", "ssh", "rvm"]
3
+ PredefinedUsers = ["root", "daemon", "bin", "sys", "sync", "games", "man", "lp", "mail", "news", "uucp", "proxy", "www-data", "backup", "list", "irc", "gnats", "nobody", "_apt", "rvm"]
4
+ PredefinedGroups = ["root", "daemon", "bin", "sys", "adm", "tty", "disk", "lp", "mail", "news", "uucp", "man", "proxy", "kmem", "dialout", "fax", "voice", "cdrom", "floppy", "tape", "sudo", "audio", "dip", "www-data", "backup", "operator", "list", "irc", "src", "gnats", "shadow", "utmp", "video", "sasl", "plugdev", "staff", "games", "users", "nogroup", "netdev", "ssh", "rvm"]
5
5
  end
@@ -23,11 +23,12 @@ module RakeCompilerDock
23
23
  options = (Hash === args.last) ? args.pop : {}
24
24
  runargs = args.dup
25
25
 
26
- pwd = Dir.pwd
26
+ mountdir = options.fetch(:mountdir){ ENV['RCD_MOUNTDIR'] || Dir.pwd }
27
+ workdir = options.fetch(:workdir){ ENV['RCD_WORKDIR'] || Dir.pwd }
27
28
  case RUBY_PLATFORM
28
29
  when /mingw|mswin/
29
- # Change Path from "C:\Path" to "/c/Path" as used by boot2docker
30
- pwd = pwd.gsub(/^([a-z]):/i){ "/#{$1.downcase}" }
30
+ mountdir = sanitize_windows_path(mountdir)
31
+ workdir = sanitize_windows_path(workdir)
31
32
  # Virtualbox shared folders don't care about file permissions, so we use generic ids.
32
33
  uid = 1000
33
34
  gid = 1000
@@ -43,7 +44,7 @@ module RakeCompilerDock
43
44
  user = options.fetch(:username){ current_user }
44
45
  group = options.fetch(:groupname){ current_group }
45
46
 
46
- check_docker(pwd) if options.fetch(:check_docker){ true }
47
+ check_docker(mountdir) if options.fetch(:check_docker){ true }
47
48
  runargs.unshift("sigfw") if options.fetch(:sigfw){ true }
48
49
  runargs.unshift("runas") if options.fetch(:runas){ true }
49
50
  docker_opts = options.fetch(:options) do
@@ -53,7 +54,7 @@ module RakeCompilerDock
53
54
  end
54
55
 
55
56
  cmd = ["docker", "run",
56
- "-v", "#{pwd}:#{make_valid_path(pwd)}",
57
+ "-v", "#{mountdir}:#{make_valid_path(mountdir)}",
57
58
  "-e", "UID=#{uid}",
58
59
  "-e", "GID=#{gid}",
59
60
  "-e", "USER=#{user}",
@@ -64,7 +65,7 @@ module RakeCompilerDock
64
65
  "-e", "RCD_HOST_RUBY_PLATFORM=#{RUBY_PLATFORM}",
65
66
  "-e", "RCD_HOST_RUBY_VERSION=#{RUBY_VERSION}",
66
67
  "-e", "RCD_IMAGE=#{image_name}",
67
- "-w", make_valid_path(pwd),
68
+ "-w", make_valid_path(workdir),
68
69
  *docker_opts,
69
70
  image_name,
70
71
  *runargs]
@@ -143,6 +144,10 @@ module RakeCompilerDock
143
144
  @@docker_checked[pwd] = check
144
145
  end
145
146
 
147
+ # Change Path from "C:\Path" to "/c/Path" as used by boot2docker
148
+ def sanitize_windows_path(path)
149
+ path.gsub(/^([a-z]):/i){ "/#{$1.downcase}" }
150
+ end
146
151
  end
147
152
  end
148
153
  end
@@ -1,4 +1,4 @@
1
1
  module RakeCompilerDock
2
- VERSION = "0.5.3"
3
- IMAGE_VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
+ IMAGE_VERSION = "0.6.0"
4
4
  end
@@ -47,4 +47,8 @@ class TestEnvironmentVariables < Test::Unit::TestCase
47
47
  assert_equal RUBY_VERSION, rcd_env['RCD_HOST_RUBY_VERSION']
48
48
  end
49
49
 
50
+ def test_PWD
51
+ assert_equal Dir.pwd, rcd_env['PWD']
52
+ end
53
+
50
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler-dock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kanis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  PizTJCem24R2bzZN5VGvA5tpqgwytgcFq1PZofgFxK2uKPCS+tmsA8wIjjGzFsnR
30
30
  WfgqWGyHn5K4wejsMic/uA==
31
31
  -----END CERTIFICATE-----
32
- date: 2016-09-02 00:00:00.000000000 Z
32
+ date: 2016-12-26 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: bundler
@@ -91,12 +91,9 @@ files:
91
91
  - README.md
92
92
  - Rakefile
93
93
  - bin/rake-compiler-dock
94
- - build/patches/rake-compiler-0.9.5/compat-with-bundler.diff
95
- - build/patches/rake-compiler-0.9.5/without-exts.diff
96
- - build/patches/ruby-1.8.7-p374/nop.patch
97
- - build/patches/ruby-1.9.3/no_sendfile.patch
98
- - build/patches/ruby-1.9.3/nop.patch
99
- - build/patches/ruby-2.3.0/no_sendfile.patch
94
+ - build/mk_i686.rb
95
+ - build/patches/rake-compiler-1.0.3/enable-static.diff
96
+ - build/patches/ruby-2.4.0/no_sendfile.patch
100
97
  - build/runas
101
98
  - build/sigfw.c
102
99
  - build/strip_wrapper
@@ -104,6 +101,7 @@ files:
104
101
  - lib/rake_compiler_dock.rb
105
102
  - lib/rake_compiler_dock/colors.rb
106
103
  - lib/rake_compiler_dock/docker_check.rb
104
+ - lib/rake_compiler_dock/gem_helper.rb
107
105
  - lib/rake_compiler_dock/predefined_user_group.rb
108
106
  - lib/rake_compiler_dock/starter.rb
109
107
  - lib/rake_compiler_dock/version.rb
@@ -138,4 +136,3 @@ summary: Easy to use and reliable cross compiler environment for building Window
138
136
  test_files:
139
137
  - test/test_environment_variables.rb
140
138
  - test/test_starter.rb
141
- has_rdoc:
metadata.gz.sig CHANGED
Binary file
@@ -1,105 +0,0 @@
1
- From 41f834449fc4323b2f995e8715aa5842d9fd9334 Mon Sep 17 00:00:00 2001
2
- From: Lars Kanis <lars@greiz-reinsdorf.de>
3
- Date: Sat, 30 Jan 2016 08:08:07 +0100
4
- Subject: [PATCH] Change the fake mechanism to be compatible with bundler.
5
-
6
- The previous fake mechanism worked by hooking onto the
7
- "require 'rbconfig'" call.
8
- This is problematic because bundler internally requires rbconfig, but doesn't
9
- work corretly in a faked environment.
10
- It then fails to load gems that are also part of the standard library, like
11
- json and rdoc.
12
- This results in issues like https://github.com/rake-compiler/rake-compiler-dock/issues/8
13
-
14
- The fake mechanism is now changed to hook onto the "require 'mkrb'" call,
15
- which is typically part of the extconf file, and it is where the faked platform
16
- values are actually needed.
17
- That way it is loaded after bundler/setup, so that the library paths are
18
- set according to the Gemfile.lock, to the native Linux libraries, before
19
- the fake environment is active.
20
-
21
- Please note, that the build directory of a given gem needs to be cleared,
22
- in order to get updated fake files. So do a "rm tmp pkg -rf".
23
- ---
24
- lib/rake/extensiontask.rb | 35 ++++++++++++++---------------------
25
- 1 file changed, 14 insertions(+), 21 deletions(-)
26
-
27
- diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
28
- index 030af96..f914919 100644
29
- --- a/lib/rake/extensiontask.rb
30
- +++ b/lib/rake/extensiontask.rb
31
- @@ -169,8 +169,8 @@ Java extension should be preferred.
32
- # now add the extconf script
33
- cmd << abs_extconf.relative_path_from(abs_tmp_path)
34
-
35
- - # rbconfig.rb will be present if we are cross compiling
36
- - if t.prerequisites.include?("#{tmp_path}/rbconfig.rb") then
37
- + # fake.rb will be present if we are cross compiling
38
- + if t.prerequisites.include?("#{tmp_path}/fake.rb") then
39
- options.push(*cross_config_options(platf))
40
- end
41
-
42
- @@ -365,39 +365,30 @@ Java extension should be preferred.
43
- # define compilation tasks for cross platform!
44
- define_compile_tasks(for_platform, ruby_ver)
45
-
46
- - # chain fake.rb, rbconfig.rb and mkmf.rb to Makefile generation
47
- + # chain fake.rb and mkmf.rb to Makefile generation
48
- file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb",
49
- - "#{tmp_path}/rbconfig.rb",
50
- "#{tmp_path}/mkmf.rb"]
51
-
52
- - # copy the file from the cross-ruby location
53
- - file "#{tmp_path}/rbconfig.rb" => [rbconfig_file] do |t|
54
- + # copy the rbconfig from the cross-ruby location and
55
- + # genearte fake.rb for different ruby versions
56
- + file "#{tmp_path}/fake.rb" => [rbconfig_file] do |t|
57
- File.open(t.name, 'w') do |f|
58
- - f.write "require 'fake.rb'\n\n"
59
- + f.write fake_rb(for_platform, ruby_ver)
60
- f.write File.read(t.prerequisites.first)
61
- end
62
- end
63
-
64
- # copy mkmf from cross-ruby location
65
- file "#{tmp_path}/mkmf.rb" => [mkmf_file] do |t|
66
- - cp t.prerequisites.first, t.name
67
- - if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
68
- - File.open(t.name, 'r+t') do |f|
69
- - content = f.read
70
- + File.open(t.name, 'w') do |f|
71
- + content = File.read(t.prerequisites.first)
72
- + content.sub!(/^(require ')rbconfig(')$/, '\\1fake\\2')
73
- + if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
74
- content.sub!(/^( break )\*(defaults)$/, '\\1\\2.first')
75
- content.sub!(/^( return )\*(defaults)$/, '\\1\\2.first')
76
- content.sub!(/^( mfile\.)print( configuration\(srcprefix\))$/, '\\1puts\\2')
77
- - f.rewind
78
- - f.write content
79
- - f.truncate(f.tell)
80
- end
81
- - end
82
- - end
83
- -
84
- - # genearte fake.rb for different ruby versions
85
- - file "#{tmp_path}/fake.rb" do |t|
86
- - File.open(t.name, 'w') do |f|
87
- - f.write fake_rb(for_platform, ruby_ver)
88
- + f.write content
89
- end
90
- end
91
-
92
- @@ -495,8 +486,10 @@ Java extension should be preferred.
93
- # "cannot load such file -- win32/resolv" when it is required later on.
94
- # See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5
95
- require 'resolv'
96
- + require 'rbconfig'
97
-
98
- class Object
99
- + remove_const :RbConfig
100
- remove_const :RUBY_PLATFORM
101
- remove_const :RUBY_VERSION
102
- remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
103
- --
104
- 2.5.0.windows.1
105
-
@@ -1,2 +0,0 @@
1
- diff --git a/configure b/configure
2
- index 55157af..6630eba 100755
@@ -1,13 +0,0 @@
1
- diff --git a/configure b/configure
2
- index 898730c..cfe6253 100755
3
- --- a/configure
4
- +++ b/configure
5
- @@ -14695,7 +14695,7 @@ for ac_func in fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot ge
6
- setsid telldir seekdir fchmod cosh sinh tanh log2 round\
7
- setuid setgid daemon select_large_fdset setenv unsetenv\
8
- mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
9
- - pread sendfile shutdown sigaltstack dl_iterate_phdr
10
- + pread shutdown sigaltstack dl_iterate_phdr
11
- do :
12
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
13
- ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -1,2 +0,0 @@
1
- diff --git a/configure b/configure
2
- index 55157af..6630eba 100755