Index: libraries/osx/build-osx-libs.sh =================================================================== --- libraries/osx/build-osx-libs.sh +++ libraries/osx/build-osx-libs.sh @@ -36,7 +36,7 @@ OGG_VERSION="libogg-1.3.3" VORBIS_VERSION="libvorbis-1.3.7" # gloox requires GnuTLS, GnuTLS requires Nettle and GMP -GMP_VERSION="gmp-6.2.0" +GMP_VERSION="gmp-6.2.1" NETTLE_VERSION="nettle-3.6" # NOTE: remember to also update LIB_URL below when changing version GLOOX_VERSION="gloox-1.0.24" @@ -87,23 +87,7 @@ OBJCFLAGS="$OBJCFLAGS $C_FLAGS" OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS" -# Force x86_64 architecture on MacOS for now. -# NB: annoyingly, this is rather unstandardised. Some libs expect -arch, others different things. -# Further: wxWidgets uses its own system and actually fails to compile with arch arguments. -ARCHLESS_CFLAGS=$CFLAGS -ARCHLESS_CXXFLAGS=$CXXFLAGS -ARCHLESS_LDFLAGS="$LDFLAGS -stdlib=libc++" - -CFLAGS="$CFLAGS -arch x86_64" -CXXFLAGS="$CXXFLAGS -arch x86_64" - -LDFLAGS="$LDFLAGS -arch x86_64" - -# Some libs want this passed to configure for cross compilation. -HOST_PLATFORM="--host=x86_64-apple-darwin" - -# CMake doesn't seem to pick up on architecture with CFLAGS only -CMAKE_FLAGS="-DCMAKE_OSX_ARCHITECTURES=x86_64" +LDFLAGS="$LDFLAGS -stdlib=libc++" JOBS=${JOBS:="-j2"} @@ -447,7 +431,6 @@ CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-unicode - --enable-universal_binary=x86_64 --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} @@ -467,10 +450,10 @@ if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION" fi - (../configure CFLAGS="$ARCHLESS_CFLAGS" \ - CXXFLAGS="$ARCHLESS_CXXFLAGS" \ + (../configure CFLAGS="$CFLAGS" \ + CXXFLAGS="$CXXFLAGS" \ CPPFLAGS="-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" \ - LDFLAGS="$ARCHLESS_LDFLAGS" $CONF_OPTS \ + LDFLAGS="$LDFLAGS" $CONF_OPTS \ && make ${JOBS} && make install) || die "wxWidgets build failed" popd popd @@ -655,7 +638,6 @@ (./configure CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS" \ LDFLAGS="$LDFLAGS" \ - "$HOST_PLATFORM" \ --prefix="$INSTALL_DIR" \ --enable-fat \ --disable-shared \ @@ -802,7 +784,6 @@ (./configure CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS" \ LDFLAGS="$LDFLAGS" \ - "$HOST_PLATFORM" \ --prefix="$INSTALL_DIR" \ GNUTLS_CFLAGS="-I${GNUTLS_DIR}/include" \ GNUTLS_LIBS="-L${GNUTLS_DIR}/lib -lgnutls" \ @@ -851,7 +832,6 @@ (CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ ../runConfigureICU MacOSX \ - "$HOST_PLATFORM" \ --prefix=$INSTALL_DIR \ --disable-shared \ --enable-static \ @@ -1014,7 +994,6 @@ -DFMT_TEST=False \ -DFMT_DOC=False \ -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \ - "$CMAKE_FLAGS" \ && make fmt ${JOBS} && make install) || die "fmt build failed" popd Index: libraries/source/nvtt/src/src/nvcore/Debug.cpp =================================================================== --- libraries/source/nvtt/src/src/nvcore/Debug.cpp +++ libraries/source/nvtt/src/src/nvcore/Debug.cpp @@ -607,6 +607,9 @@ # elif NV_CPU_ARM ucontext_t * ucp = (ucontext_t *)secret; return (void *) ucp->uc_mcontext->__ss.__pc; +# elif NV_CPU_AARCH64 + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext->__ss.__pc; # else # error "Unknown CPU" # endif Index: libraries/source/spidermonkey/FixMacBuild.diff =================================================================== --- libraries/source/spidermonkey/FixMacBuild.diff +++ libraries/source/spidermonkey/FixMacBuild.diff @@ -32,4 +32,65 @@ - 'https://github.com/phracker/MacOSX-SDKs' % (version, sdk_max_version)) return sdk - set_config('MACOS_SDK_DIR', macos_sdk) \ No newline at end of file + set_config('MACOS_SDK_DIR', macos_sdk) +--- a/build/moz.configure/init.configure ++++ b/build/moz.configure/init.configure +@@ -375,9 +375,6 @@ + sys.exit(subprocess.call([python] + sys.argv)) + + # We are now in the virtualenv +- if not distutils.sysconfig.get_python_lib(): +- die('Could not determine python site packages directory') +- + str_version = '.'.join(str(v) for v in version) + + return namespace( +--- a/js/src/jit/arm64/vixl/MozCpu-vixl.cpp ++++ b/js/src/jit/arm64/vixl/MozCpu-vixl.cpp +@@ -69,7 +69,7 @@ void CPU::SetUp() { + + + uint32_t CPU::GetCacheType() { +-#if defined(__aarch64__) && !defined(_MSC_VER) ++#if defined(__aarch64__) && (defined(__linux__) || defined(__android__)) + uint64_t cache_type_register; + // Copy the content of the cache type register to a core register. + __asm__ __volatile__ ("mrs %[ctr], ctr_el0" // NOLINT +--- a/js/src/wasm/WasmSignalHandlers.cpp ++++ b/js/src/wasm/WasmSignalHandlers.cpp +@@ -226,6 +226,10 @@ using mozilla::DebugOnly; + # define R13_sig(p) ((p)->thread.__sp) + # define R14_sig(p) ((p)->thread.__lr) + # define R15_sig(p) ((p)->thread.__pc) ++# define EPC_sig(p) ((p)->thread.__pc) ++# define RFP_sig(p) ((p)->thread.__fp) ++# define R31_sig(p) ((p)->thread.__sp) ++# define RLR_sig(p) ((p)->thread.__lr) + #else + # error "Don't know how to read/write to the thread state via the mcontext_t." + #endif +@@ -351,6 +355,12 @@ struct macos_arm_context { + arm_neon_state_t float_; + }; + # define CONTEXT macos_arm_context ++# elif defined(__aarch64__) ++struct macos_aarch64_context { ++ arm_thread_state64_t thread; ++ arm_neon_state64_t float_; ++}; ++# define CONTEXT macos_aarch64_context + # else + # error Unsupported architecture + # endif +@@ -816,6 +826,11 @@ static bool HandleMachException(const ExceptionRequest& request) { + unsigned int float_state_count = ARM_NEON_STATE_COUNT; + int thread_state = ARM_THREAD_STATE; + int float_state = ARM_NEON_STATE; ++# elif defined(__aarch64__) ++ unsigned int thread_state_count = ARM_THREAD_STATE64_COUNT; ++ unsigned int float_state_count = ARM_NEON_STATE64_COUNT; ++ int thread_state = ARM_THREAD_STATE64; ++ int float_state = ARM_NEON_STATE64; + # else + # error Unsupported architecture + # endif Index: libraries/source/spidermonkey/build.sh =================================================================== --- libraries/source/spidermonkey/build.sh +++ libraries/source/spidermonkey/build.sh @@ -49,9 +49,6 @@ if [ "`uname -s`" = "Darwin" ] then - # Explicitly target x86_64. - CONF_OPTS="${CONF_OPTS} --target=x86_64-apple-darwin" - # Link to custom-built zlib export PKG_CONFIG_PATH="=${ZLIB_DIR}:${PKG_CONFIG_PATH}" CONF_OPTS="${CONF_OPTS} --with-system-zlib" Index: libraries/source/spidermonkey/patch.sh =================================================================== --- libraries/source/spidermonkey/patch.sh +++ libraries/source/spidermonkey/patch.sh @@ -8,25 +8,27 @@ # if python is detected to be newer than 3.7. if [ "$(uname -s)" = "Darwin" ]; then + # SM actually uses features from the full-fledged virtualenv package + # and not just venv, so install it to be safe. + # Install it locally to not pollute anything. + # Install specifically a version that's know to work. + pip3 install --upgrade -t virtualenv 'virtualenv==20.13.1' --force-reinstall + export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH" + PYTHON_MINOR_VERSION="$(python3 -c 'import sys; print(sys.version_info.minor)')" - if [ "$PYTHON_MINOR_VERSION" -gt 7 ]; + if [ "$PYTHON_MINOR_VERSION" -gt 9 ]; + then + # In python 3.10 `sysconfig._get_default_scheme()` was renamed to + # `sysconfig.get_default_scheme()`. This breaks the version of + # `virtualenv` bundled with the spidermonkey source code. + # + # It is assumed that the updated version fetched for macOS systems + # above does not have this problem. + patch -p1 < ../FixVirtualenvForPython310.diff + elif [ "$PYTHON_MINOR_VERSION" -gt 7 ]; then - # SM actually uses features from the full-fledged virtualenv package - # and not just venv, so install it to be safe. - # Install it locally to not pollute anything. - # Install specifically a version that's know to work. - pip3 install --upgrade -t virtualenv 'virtualenv==20.13.1' - export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH" patch -p1 < ../FixVirtualEnv.diff fi -else - # In python 3.10 `sysconfig._get_default_scheme()` was renamed to - # `sysconfig.get_default_scheme()`. This breaks the version of - # `virtualenv` bundled with the spidermonkey source code. - # - # It is assumed that the updated version fetched for macOS systems - # above does not have this problem. - patch -p1 < ../FixVirtualenvForPython310.diff fi # Mozglue symbols need to be linked against static builds. Index: source/tools/dist/build-osx-executable.sh =================================================================== --- source/tools/dist/build-osx-executable.sh +++ source/tools/dist/build-osx-executable.sh @@ -2,8 +2,7 @@ # Build the Pyrogenesis executable, used to create the bundle and run the archiver. -# TODO: is there anything to do for ARM support? -export ARCH=${ARCH:="x86_64"} +export ARCH=${ARCH:=$(uname -m)} # Set mimimum required OS X version, SDK location and tools # Old SDKs can be found at https://github.com/phracker/MacOSX-SDKs