Skip to content

Commit

Permalink
added support of arm64 architecture for OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
LonelyWolf committed Jul 6, 2022
1 parent 1026223 commit b5fb0ad
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 197 deletions.
2 changes: 1 addition & 1 deletion BUNDLER_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.3
2.3.17
2 changes: 1 addition & 1 deletion RUBY_VERSIONS.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.10
3.1.2
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20210206
20220706
5 changes: 3 additions & 2 deletions osx/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ end


RUBY_VERSIONS.each do |ruby_version|
package = "traveling-ruby-#{VERSION}-#{ruby_version}-osx.tar.gz"
gem_dir = "traveling-ruby-gems-#{VERSION}-#{ruby_version}-osx"
arch = `uname -m`.chomp.strip
package = "traveling-ruby-#{VERSION}-#{ruby_version}-osx-#{arch}.tar.gz"
gem_dir = "traveling-ruby-gems-#{VERSION}-#{ruby_version}-osx-#{arch}"

task :package => "package:#{ruby_version}"
task :build => "build:#{ruby_version}"
Expand Down
24 changes: 14 additions & 10 deletions osx/build-ruby
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ fi

header "Preparing Ruby source code..."

# To many warnings, suppress them all (disable in case of troubleshooting)
export CPPFLAGS="-w"
export CXXFLAGS="-w"
export CFLAGS="-w"

export PATH="$RUNTIME_DIR/bin:$PATH"
export LIBRARY_PATH="$RUNTIME_DIR/lib"
export PKG_CONFIG_PATH="$RUNTIME_DIR/lib/pkgconfig:/usr/lib/pkgconfig"
Expand All @@ -255,12 +260,13 @@ echo

if $SETUP_SOURCE; then
header "Configuring..."
# NOTE: the option --disable-install-doc is a conjunction of --disable-install-rdoc and --disable-install-capi
# NOTE: the options --disable-install-doc and --disable-install-rdoc have been removed
# to support the presence of document coders
./configure \
--prefix "$TMPBUILDROOT" \
--disable-install-doc \
--disable-install-rdoc \
--disable-install-capi \
--with-out-ext=tk,sdbm,gdbm,dbm,dl,coverage \
--disable-install-capi \
--with-openssl-dir="$RUNTIME_DIR"
echo
fi
Expand Down Expand Up @@ -325,9 +331,9 @@ if [[ "$GEMFILE" != "" ]]; then

# Install Bundler, either from cache or directly.
if [[ -e "$RUNTIME_DIR/vendor/cache/bundler-$BUNDLER_VERSION.gem" ]]; then
run "$TMPBUILDROOT/bin/gem" install "$RUNTIME_DIR/vendor/cache/bundler-$BUNDLER_VERSION.gem" --no-rdoc --no-ri
run "$TMPBUILDROOT/bin/gem" install "$RUNTIME_DIR/vendor/cache/bundler-$BUNDLER_VERSION.gem" --no-document
else
run "$TMPBUILDROOT/bin/gem" install bundler -v $BUNDLER_VERSION --no-rdoc --no-ri
run "$TMPBUILDROOT/bin/gem" install bundler -v $BUNDLER_VERSION --no-document
run mkdir -p "$RUNTIME_DIR/vendor/cache"
run cp "$TMPBUILDROOT"/lib/ruby/gems/$RUBY_COMPAT_VERSION/cache/bundler-$BUNDLER_VERSION.gem \
"$RUNTIME_DIR/vendor/cache/"
Expand All @@ -344,10 +350,8 @@ if [[ "$GEMFILE" != "" ]]; then
run cp "$GEMFILE.lock" ./
fi
run bundle config --local force_ruby_platform true
# We set -j to 1 because of this bug:
# https://github.com/bundler/bundler/issues/3660
# When it is solved, we can set -j to $CONCURRENCY.
run "$TMPBUILDROOT/bin/bundle" install --system --retry 3 --jobs 1
run "$TMPBUILDROOT/bin/bundle" config set --local system true
run "$TMPBUILDROOT/bin/bundle" install --retry 3 --jobs $CONCURRENCY
run "$TMPBUILDROOT/bin/bundle" package

# Cache gems.
Expand All @@ -372,7 +376,7 @@ run rm -f bin/testrb # Only Ruby 2.1 has it
run rm -rf include
run rm -rf share
run rm -rf lib/{libruby-static.a,pkgconfig}
run rm -rf lib/ruby/$RUBY_COMPAT_VERSION/rdoc/generator/
#run rm -rf lib/ruby/$RUBY_COMPAT_VERSION/rdoc/generator/ # don't remove the documentation generators
run rm -f lib/ruby/gems/$RUBY_COMPAT_VERSION/cache/*
run rm -f lib/ruby/gems/$RUBY_COMPAT_VERSION/extensions/$GEM_PLATFORM/$GEM_EXTENSION_API_VERSION/*/{gem_make.out,mkmf.log}
run rm -rf lib/ruby/gems/$RUBY_COMPAT_VERSION/gems/*/{test,spec,*.md,*.rdoc}
Expand Down
5 changes: 3 additions & 2 deletions osx/internal/check_requirements
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ set -e

XCODEPATH=$(xcode-select -p)

if [[ ! -e "$XCODEPATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk" ]]; then
echo "*** ERROR: the macOS 10.14 SDK is required. Please refer to" \
# FIXME: determine the minimal version of SDK to use on ARM64
if [[ ! -e "$XCODEPATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk" ]]; then
echo "*** ERROR: the macOS 12.1 SDK is required. Please refer to" \
"https://github.com/FooBarWidget/traveling-ruby/blob/main/osx/README.md" \
"for installation instructions." >&2
exit 1
Expand Down
20 changes: 20 additions & 0 deletions osx/internal/cmake-3.23.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- CMakeLists.txt.orig 2022-07-05 17:51:38.000000000 +0200
+++ CMakeLists.txt 2022-07-05 17:51:57.000000000 +0200
@@ -101,17 +101,6 @@
endif()
endif()
endif()
-if(NOT CMake_TEST_EXTERNAL_CMAKE)
- # include special compile flags for some compilers
- include(CompileFlags.cmake)
-
- # check for available C++ features
- include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake)
-
- if(NOT CMake_HAVE_CXX_UNIQUE_PTR)
- message(FATAL_ERROR "The C++ compiler does not support C++11 (e.g. std::unique_ptr).")
- endif()
-endif()

# Inform STL library header wrappers whether to use system versions.
configure_file(${CMake_SOURCE_DIR}/Utilities/std/cmSTL.hxx.in
6 changes: 4 additions & 2 deletions osx/internal/reset_environment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export PATH="$SELFDIR/internal/bin":/usr/bin:/bin:/usr/sbin:/sbin
export MACOSX_DEPLOYMENT_TARGET=10.14
export MACOSX_COMPATIBLE_DEPLOYMENT_TARGETS="10.14 10.15 11.0 11.1 11.2 11.3 11.4 11.5"
# FIXME: minimal supported deployment target on ARM64
export MACOSX_DEPLOYMENT_TARGET=12.1
# FIXME: a full list of deployment targets on ARM64
export MACOSX_COMPATIBLE_DEPLOYMENT_TARGETS="10.14 10.15 11.0 11.1 11.2 11.3 11.4 11.5 11.6 12.0 12.1"
export CC="$SELFDIR/internal/bin/cc"
export CXX="$SELFDIR/internal/bin/c++"
unset DYLD_LIBRARY_PATH
Expand Down
Loading

0 comments on commit b5fb0ad

Please sign in to comment.