Remove Ruby references from python-build (#1596)

* Remove Ruby references from python-build

* restore fix_directory_permissions
This commit is contained in:
David Baumgold 2020-04-27 22:25:17 +02:00 committed by GitHub
parent ae4d48932f
commit 5e8719ab0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -791,14 +791,6 @@ build_package_standard_install() {
} >&4 2>&1
}
build_package_standard_install_with_bundled_gems() {
{ "$MAKE" update-gems
"$MAKE" extract-gems
} >&4 2>&1
build_package_standard_install "$@"
}
# Backward Compatibility for standard function
build_package_standard() {
build_package_standard_build "$@"
@ -810,13 +802,6 @@ build_package_autoconf() {
} >&4 2>&1
}
build_package_ruby() {
local package_name="$1"
{ "$RUBY_BIN" setup.rb
} >&4 2>&1
}
build_package_python() {
local package_name="$1"
@ -824,132 +809,9 @@ build_package_python() {
} >&4 2>&1
}
build_package_ree_installer() {
build_package_auto_tcltk
local options=""
is_mac && options="--no-tcmalloc"
local option
for option in $RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[@]}; do
options="$options -c $option"
done
# Work around install_useful_libraries crash with --dont-install-useful-gems
mkdir -p "$PREFIX_PATH/lib/ruby/gems/1.8/gems"
{ ./installer --auto "$PREFIX_PATH" --dont-install-useful-gems $options $CONFIGURE_OPTS
} >&4 2>&1
}
build_package_rbx() {
local package_name="$1"
{ [ ! -e "Gemfile" ] || bundle --path=vendor/bundle
if [ -n "$RUBY_BUILD_CACHE_PATH" ]; then
mkdir -p vendor
ln -s "$RUBY_BUILD_CACHE_PATH" vendor/prebuilt
fi
local opt
local -a configure_opts
for opt in "${RUBY_CONFIGURE_OPTS_ARRAY[@]}"; do
if [[ $opt == --with-openssl-dir=* ]]; then
local openssl_dir="${opt#*=}"
configure_opts[${#configure_opts[@]}]="--with-lib-dir=${openssl_dir}/lib"
configure_opts[${#configure_opts[@]}]="--with-include-dir=${openssl_dir}/include"
else
configure_opts[${#configure_opts[@]}]="$opt"
fi
done
RUBYOPT="-rrubygems $RUBYOPT" ./configure --prefix="$PREFIX_PATH" $RUBY_CONFIGURE_OPTS "${configure_opts[@]}"
rake install
fix_rbx_gem_binstubs "$PREFIX_PATH"
fix_rbx_irb "$PREFIX_PATH"
} >&4 2>&1
}
build_package_mruby() {
local package_name="$1"
{ rake
mkdir -p "$PREFIX_PATH"
cp -fR build/host/* "$PREFIX_PATH"
cd "$PREFIX_PATH/bin"
ln -fs mruby ruby
ln -fs mirb irb
} >&4 2>&1
}
build_package_maglev() {
build_package_copy
{ cd "${PREFIX_PATH}"
./install.sh
cd "${PREFIX_PATH}/bin"
echo "Creating symlink for ruby*"
ln -fs maglev-ruby ruby
echo "Creating symlink for irb*"
ln -fs maglev-irb irb
} >&4 2>&1
echo
echo "Run 'maglev start' to start up the stone before using 'ruby' or 'irb'"
}
build_package_topaz() {
build_package_copy
{ cd "${PREFIX_PATH}/bin"
echo "Creating symlink for ruby*"
ln -fs topaz ruby
} >&4 2>&1
}
topaz_architecture() {
case "$(uname -s)" in
"Darwin") echo "osx64";;
"Linux") [[ "$(uname -m)" = "x86_64" ]] && echo "linux64" || echo "linux32";;
*)
echo "no nightly builds available" >&2
exit 1;;
esac
}
build_package_jruby() {
build_package_copy
cd "${PREFIX_PATH}/bin"
ln -fs jruby ruby
chmod +x ruby
install_jruby_launcher
remove_windows_files
fix_jruby_shebangs
}
install_jruby_launcher() {
cd "${PREFIX_PATH}/bin"
{ ./ruby gem install jruby-launcher
} >&4 2>&1
}
fix_jruby_shebangs() {
for file in "${PREFIX_PATH}/bin"/*; do
if [ "$(head -c 20 "$file")" = "#!/usr/bin/env jruby" ]; then
sed -i.bak "1 s:.*:#\!${PREFIX_PATH}\/bin\/jruby:" "$file"
rm "$file".bak
fi
done
}
build_package_truffleruby() {
build_package_copy
cd "${PREFIX_PATH}"
./lib/truffle/post_install_hook.sh
}
remove_windows_files() {
cd "$PREFIX_PATH"
rm -f bin/*.exe bin/*.dll bin/*.bat bin/jruby.sh
rm -f bin/*.exe bin/*.dll bin/*.bat
}
build_package_jython() {
@ -1183,37 +1045,10 @@ cleanup_builtin_patches() {
}
fix_directory_permissions() {
# Ensure installed directories are not world-writable to avoid Bundler warnings
# Ensure installed directories are not world-writable
find "$PREFIX_PATH" -type d \( -perm -020 -o -perm -002 \) -exec chmod go-w {} \;
}
fix_rbx_gem_binstubs() {
local prefix="$1"
local gemdir="${prefix}/gems/bin"
local bindir="${prefix}/bin"
local file binstub
# Symlink Rubinius' `gems/bin/` into `bin/`
if [ -d "$gemdir" ] && [ ! -L "$gemdir" ]; then
for file in "$gemdir"/*; do
binstub="${bindir}/${file##*/}"
rm -f "$binstub"
{ echo "#!${bindir}/ruby"
grep -v '^#!' "$file"
} > "$binstub"
chmod +x "$binstub"
done
rm -rf "$gemdir"
ln -s ../bin "$gemdir"
fi
}
fix_rbx_irb() {
local prefix="$1"
"${prefix}/bin/irb" --version &>/dev/null ||
"${prefix}/bin/gem" install rubysl-tracer -v '~> 2.0' --no-rdoc --no-ri &>/dev/null ||
true
}
require_java7() {
local version="$(java -version 2>&1 | grep '\(java\|openjdk\) version' | head -1)"
if [[ $version != *[789]* ]]; then
@ -1682,36 +1517,6 @@ build_package_auto_tcltk() {
fi
}
rake() {
if [ -e "./Gemfile" ]; then
bundle exec rake "$@"
else
isolated_gem_dependency "rake --version" rake -v '~> 10.1.0'
command rake "$@"
fi
}
bundle() {
isolated_gem_dependency "bundle --version" bundler -v '~> 1.3.5'
command bundle "$@"
}
isolated_gem_dependency() {
set +E
( command $1 &>/dev/null ) || {
set -E
shift 1
isolated_gem_install "$@"
}
set -E
}
isolated_gem_install() {
export GEM_HOME="${PWD}/.gem"
export PATH="${GEM_HOME}/bin:${PATH}"
gem install "$@"
}
apply_python_patch() {
local patchfile
case "$1" in
@ -2108,19 +1913,6 @@ if [ -n "$noexec" ]; then
exit 1
fi
## Apply following work around, if gcc is not installed.
#if [ -z "$(locate_gcc)" ]; then
# # Work around warnings building Ruby 2.0 on Clang 2.x:
# # pass -Wno-error=shorten-64-to-32 if the compiler accepts it.
# #
# # When we set CFLAGS, Ruby won't apply its default flags, though. Since clang
# # builds 1.9.x and 2.x only, where -O3 is default, we can safely set that flag.
# # Ensure it's the first flag since later flags take precedence.
# if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
# RUBY_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $RUBY_CFLAGS"
# fi
#fi
if [ -z "$MAKE" ]; then
if [ "FreeBSD" = "$(uname -s)" ]; then
if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then