Merge pull request #493 from eric/add-make-install-opts-variables

Add MAKE_INSTALL_OPTS for packages
This commit is contained in:
Mislav Marohnić 2014-01-29 14:47:34 -08:00
commit 55bb34235b
3 changed files with 58 additions and 5 deletions

View file

@ -119,9 +119,10 @@ You can set certain environment variables to control the build process.
* `MAKE` lets you override the command to use for `make`. Useful for specifying
GNU make (`gmake`) on some systems.
* `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to `make`.
* `RUBY_CONFIGURE_OPTS` and `RUBY_MAKE_OPTS` allow you to specify configure and
make options for buildling MRI. These variables will be passed to Ruby only,
not any dependent packages (e.g. libyaml).
* `MAKE_INSTALL_OPTS` lets you pass additional options to `make install`.
* `RUBY_CONFIGURE_OPTS`, `RUBY_MAKE_OPTS` and `RUBY_MAKE_INSTALL_OPTS` allow
you to specify configure and make options for buildling MRI. These variables
will be passed to Ruby only, not any dependent packages (e.g. libyaml).
### Applying patches to Ruby before compiling

View file

@ -398,6 +398,8 @@ build_package_standard() {
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]"
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
[ "$package_var_name" = "RUBY" ] && use_homebrew_readline || true
@ -409,7 +411,7 @@ build_package_standard() {
) >&4 2>&1
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
"$MAKE" install
"$MAKE" install $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
} >&4 2>&1
}

View file

@ -47,7 +47,7 @@ OUT
stub_make_install() {
stub "$MAKE" \
" : echo \"$MAKE \$@\" >> build.log" \
"install : cat build.log >> '$INSTALL_ROOT/build.log'"
"install : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
}
assert_build_log() {
@ -71,8 +71,10 @@ assert_build_log() {
assert_build_log <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT
make -j 2
make install
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install
OUT
}
@ -94,9 +96,11 @@ OUT
assert_build_log <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT
make -j 2
make install
patch -p0 -i -
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install
OUT
}
@ -118,6 +122,7 @@ OUT
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-libyaml-dir=$brew_libdir
make -j 2
make install
OUT
}
@ -141,6 +146,7 @@ DEF
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-readline-dir=$readline_libdir
make -j 2
make install
OUT
}
@ -162,6 +168,7 @@ DEF
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-readline-dir=/custom
make -j 2
make install
OUT
}
@ -184,6 +191,7 @@ DEF
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install
OUT
}
@ -207,6 +215,47 @@ DEF
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 4
make install
OUT
}
@test "setting RUBY_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "ruby-2.0.0"
stub_make_install
export RUBY_MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
DEF
assert_success
unstub make
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install DOGE="such wow"
OUT
}
@test "setting MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "ruby-2.0.0"
stub_make_install
export MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
DEF
assert_success
unstub make
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install DOGE="such wow"
OUT
}
@ -257,6 +306,7 @@ DEF
apply -p1 -i /my/patch.diff
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2
make install
OUT
}