Skip to content

Commit 55bb342

Browse files
committed
Merge pull request rbenv#493 from eric/add-make-install-opts-variables
Add MAKE_INSTALL_OPTS for packages
2 parents be987f2 + 37c9a04 commit 55bb342

File tree

3 files changed

+58
-5
lines changed

3 files changed

+58
-5
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ You can set certain environment variables to control the build process.
119119
* `MAKE` lets you override the command to use for `make`. Useful for specifying
120120
GNU make (`gmake`) on some systems.
121121
* `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to `make`.
122-
* `RUBY_CONFIGURE_OPTS` and `RUBY_MAKE_OPTS` allow you to specify configure and
123-
make options for buildling MRI. These variables will be passed to Ruby only,
124-
not any dependent packages (e.g. libyaml).
122+
* `MAKE_INSTALL_OPTS` lets you pass additional options to `make install`.
123+
* `RUBY_CONFIGURE_OPTS`, `RUBY_MAKE_OPTS` and `RUBY_MAKE_INSTALL_OPTS` allow
124+
you to specify configure and make options for buildling MRI. These variables
125+
will be passed to Ruby only, not any dependent packages (e.g. libyaml).
125126

126127
### Applying patches to Ruby before compiling
127128

bin/ruby-build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ build_package_standard() {
398398
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]"
399399
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
400400
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
401+
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
402+
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
401403
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
402404

403405
[ "$package_var_name" = "RUBY" ] && use_homebrew_readline || true
@@ -409,7 +411,7 @@ build_package_standard() {
409411
) >&4 2>&1
410412

411413
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
412-
"$MAKE" install
414+
"$MAKE" install $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
413415
} >&4 2>&1
414416
}
415417

test/build.bats

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ OUT
4747
stub_make_install() {
4848
stub "$MAKE" \
4949
" : echo \"$MAKE \$@\" >> build.log" \
50-
"install : cat build.log >> '$INSTALL_ROOT/build.log'"
50+
"install : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
5151
}
5252

5353
assert_build_log() {
@@ -71,8 +71,10 @@ assert_build_log() {
7171
assert_build_log <<OUT
7272
yaml-0.1.4: --prefix=$INSTALL_ROOT
7373
make -j 2
74+
make install
7475
ruby-2.0.0: --prefix=$INSTALL_ROOT
7576
make -j 2
77+
make install
7678
OUT
7779
}
7880

@@ -94,9 +96,11 @@ OUT
9496
assert_build_log <<OUT
9597
yaml-0.1.4: --prefix=$INSTALL_ROOT
9698
make -j 2
99+
make install
97100
patch -p0 -i -
98101
ruby-2.0.0: --prefix=$INSTALL_ROOT
99102
make -j 2
103+
make install
100104
OUT
101105
}
102106

@@ -118,6 +122,7 @@ OUT
118122
assert_build_log <<OUT
119123
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-libyaml-dir=$brew_libdir
120124
make -j 2
125+
make install
121126
OUT
122127
}
123128

@@ -141,6 +146,7 @@ DEF
141146
assert_build_log <<OUT
142147
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-readline-dir=$readline_libdir
143148
make -j 2
149+
make install
144150
OUT
145151
}
146152

@@ -162,6 +168,7 @@ DEF
162168
assert_build_log <<OUT
163169
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-readline-dir=/custom
164170
make -j 2
171+
make install
165172
OUT
166173
}
167174

@@ -184,6 +191,7 @@ DEF
184191
assert_build_log <<OUT
185192
ruby-2.0.0: --prefix=$INSTALL_ROOT
186193
make -j 2
194+
make install
187195
OUT
188196
}
189197

@@ -207,6 +215,47 @@ DEF
207215
assert_build_log <<OUT
208216
ruby-2.0.0: --prefix=$INSTALL_ROOT
209217
make -j 4
218+
make install
219+
OUT
220+
}
221+
222+
@test "setting RUBY_MAKE_INSTALL_OPTS to a multi-word string" {
223+
cached_tarball "ruby-2.0.0"
224+
225+
stub_make_install
226+
227+
export RUBY_MAKE_INSTALL_OPTS="DOGE=\"such wow\""
228+
run_inline_definition <<DEF
229+
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
230+
DEF
231+
assert_success
232+
233+
unstub make
234+
235+
assert_build_log <<OUT
236+
ruby-2.0.0: --prefix=$INSTALL_ROOT
237+
make -j 2
238+
make install DOGE="such wow"
239+
OUT
240+
}
241+
242+
@test "setting MAKE_INSTALL_OPTS to a multi-word string" {
243+
cached_tarball "ruby-2.0.0"
244+
245+
stub_make_install
246+
247+
export MAKE_INSTALL_OPTS="DOGE=\"such wow\""
248+
run_inline_definition <<DEF
249+
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
250+
DEF
251+
assert_success
252+
253+
unstub make
254+
255+
assert_build_log <<OUT
256+
ruby-2.0.0: --prefix=$INSTALL_ROOT
257+
make -j 2
258+
make install DOGE="such wow"
210259
OUT
211260
}
212261

@@ -257,6 +306,7 @@ DEF
257306
apply -p1 -i /my/patch.diff
258307
ruby-2.0.0: --prefix=$INSTALL_ROOT
259308
make -j 2
309+
make install
260310
OUT
261311
}
262312

0 commit comments

Comments
 (0)