Apple M1 support part 1

This commit is contained in:
Jay Lee
2022-02-28 16:07:17 -05:00
committed by GitHub
parent 7ae61b0c6d
commit e44ea5dbed

View File

@@ -33,15 +33,17 @@ jobs:
jid: 3 jid: 3
goal: build goal: build
arch: x86_64 arch: x86_64
openssl_archs: darwin64-x86_64,darwin64-arm64 openssl_archs: darwin64-x86_64 darwin64-arm64
- os: windows-2022 - os: windows-2022
jid: 4 jid: 4
goal: build goal: build
arch: Win64 arch: Win64
openssl_archs: VC-WIN64A
- os: windows-2022 - os: windows-2022
jid: 5 jid: 5
goal: build goal: build
arch: Win32 arch: Win32
openssl_archs: VC-WIN32
- os: ubuntu-20.04 - os: ubuntu-20.04
goal: test goal: test
python: "3.7" python: "3.7"
@@ -61,10 +63,12 @@ jobs:
jid: 9 jid: 9
goal: build goal: build
arch: aarch64 arch: aarch64
openssl_archs: linux-aarch64
- os: [self-hosted, linux, arm] - os: [self-hosted, linux, arm]
jid: 10 jid: 10
goal: build goal: build
arch: armv7l arch: armv7l
openssl_archs: linux-armv4
steps: steps:
@@ -127,19 +131,18 @@ jobs:
env: env:
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
jid: ${{ matrix.jid }} jid: ${{ matrix.jid }}
openssl_archs: ${{ openssl_archs }}
run: | run: |
echo "We are running on ${RUNNER_OS}" echo "We are running on ${RUNNER_OS}"
if [[ "${arch}" == "Win64" ]]; then if [[ "${arch}" == "Win64" ]]; then
PYEXTERNALS_PATH="amd64" PYEXTERNALS_PATH="amd64"
PYBUILDRELEASE_ARCH="x64" PYBUILDRELEASE_ARCH="x64"
OPENSSL_CONFIG_TARGET="VC-WIN64A"
GAM_ARCHIVE_ARCH="x86_64" GAM_ARCHIVE_ARCH="x86_64"
WIX_ARCH="x64" WIX_ARCH="x64"
CHOC_OPS="" CHOC_OPS=""
elif [[ "${arch}" == "Win32" ]]; then elif [[ "${arch}" == "Win32" ]]; then
PYEXTERNALS_PATH="win32" PYEXTERNALS_PATH="win32"
PYBUILDRELEASE_ARCH="Win32" PYBUILDRELEASE_ARCH="Win32"
OPENSSL_CONFIG_TARGET="VC-WIN32"
GAM_ARCHIVE_ARCH="x86" GAM_ARCHIVE_ARCH="x86"
WIX_ARCH="x86" WIX_ARCH="x86"
CHOC_OPS="--forcex86" CHOC_OPS="--forcex86"
@@ -156,6 +159,12 @@ jobs:
echo "PYTHON=${PYTHON_INSTALL_PATH}/bin/python3" >> $GITHUB_ENV echo "PYTHON=${PYTHON_INSTALL_PATH}/bin/python3" >> $GITHUB_ENV
export date=gdate export date=gdate
export realpath=grealpath export realpath=grealpath
echo "CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1" >> $GITHUB_ENV
echo "CFLAGS=-I${HOME}/ssl/include -arch arm64 -arch x86_64" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
echo "LDFLAGS=${HOME}/ssl/lib/libssl.a" >> $GITHUB_ENV
echo "ARCHFLAGS=-arch x86_64 -arch arm64" >> $GITHUB_ENV
echo 'PIP_ARGS=( "--no-binary" ":all:" )' >> $GITHUB_ENV
elif [[ "${RUNNER_OS}" == "Linux" ]]; then elif [[ "${RUNNER_OS}" == "Linux" ]]; then
MAKE=make MAKE=make
MAKEOPT="-j$(nproc)" MAKEOPT="-j$(nproc)"
@@ -183,7 +192,7 @@ jobs:
echo "PERL=${PERL}" >> $GITHUB_ENV echo "PERL=${PERL}" >> $GITHUB_ENV
echo "PYEXTERNALS_PATH=${PYEXTERNALS_PATH}" >> $GITHUB_ENV echo "PYEXTERNALS_PATH=${PYEXTERNALS_PATH}" >> $GITHUB_ENV
echo "PYBUILDRELEASE_ARCH=${PYBUILDRELEASE_ARCH}" >> $GITHUB_ENV echo "PYBUILDRELEASE_ARCH=${PYBUILDRELEASE_ARCH}" >> $GITHUB_ENV
echo "OPENSSL_CONFIG_TARGET=${OPENSSL_CONFIG_TARGET}" >> $GITHUB_ENV echo "openssl_archs=${openssl_archs}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${OPENSSL_INSTALL_PATH}/lib:${PYTHON_INSTALL_PATH}/lib" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=${OPENSSL_INSTALL_PATH}/lib:${PYTHON_INSTALL_PATH}/lib" >> $GITHUB_ENV
#echo "PATH=${PATH}:${PYTHON_INSTALL_PATH}/scripts" >> $GITHUB_ENV #echo "PATH=${PATH}:${PYTHON_INSTALL_PATH}/scripts" >> $GITHUB_ENV
@@ -197,6 +206,13 @@ jobs:
git checkout "${LATEST_STABLE_TAG}" git checkout "${LATEST_STABLE_TAG}"
export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix
echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV
cd ~
for openssl_arch in $openssl_archs; do
ssldir="openssl-${openssl_arch}"
mkdir "{ssldir}"
cp -rf openssl/* "${ssldir}/"
done
rm -rf openssl
- name: Windows NASM Install - name: Windows NASM Install
uses: ilammy/setup-nasm@v1 uses: ilammy/setup-nasm@v1
@@ -205,9 +221,11 @@ jobs:
- name: Config OpenSSL - name: Config OpenSSL
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true'
run: | run: |
cd "${OPENSSL_SOURCE_PATH}" for openssl_arch in $openssl_archs; do
cd "openssl-${openssl_arch}"
# --libdir=lib is needed so Python can find OpenSSL libraries # --libdir=lib is needed so Python can find OpenSSL libraries
"${PERL}" ./Configure "${OPENSSL_CONFIG_TARGET}" --libdir=lib --prefix="${OPENSSL_INSTALL_PATH}" $OPENSSL_CONFIG_OPTS "${PERL}" ./Configure "${openssl_archs}" --libdir=lib --prefix="${OPENSSL_INSTALL_PATH}-${openssl_arch}" $OPENSSL_CONFIG_OPTS
done
- name: Rename GNU link on Windows - name: Rename GNU link on Windows
if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true'
@@ -217,20 +235,43 @@ jobs:
- name: Make OpenSSL - name: Make OpenSSL
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true'
run: | run: |
cd "${OPENSSL_SOURCE_PATH}" for openssl_arch in $openssl_archs; do
cd "openssl-${openssl_arch}"
$MAKE "${MAKEOPT}" $MAKE "${MAKEOPT}"
done
- name: Install OpenSSL - name: Install OpenSSL
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true'
run: | run: |
cd "${OPENSSL_SOURCE_PATH}" for openssl_arch in $openssl_archs; do
cd "openssl-${openssl_arch}"
# install_sw saves us ages processing man pages :-) # install_sw saves us ages processing man pages :-)
$MAKE install_sw $MAKE install_sw
done
mkdir ssl
if [[ "${RUNNER_OS}" == "macOS" ]]; then
mkdir ssl/lib
mdkir ssl/bin
for archlib in libcrypto.3.dylib libssl.3.dylib libcrypto.a libssl.a; do
lipo -create "ssl-darwin64-x86_64/lib/${archlib}" \
"ssl-darwin64-arm64/lib/${archlib}" \
-output "ssl/lib/${archlib}"
done
mv ssl-darwin64-x86_64/include ssl/
lipo -create "ssl-darwin64-x86_64/bin/openssl" \
"ssl-darwin64-arm64/bin/openssl" \
-output "nssl/bin/openssl"
rm -rf ssl-darwin64-x86_64
rm -rf ssl-darwin64-arm64
else
mv "ssl-${openssl_archs}" ssl
fi
- name: Run OpenSSL - name: Run OpenSSL
if: matrix.goal == 'build' if: matrix.goal == 'build'
run: | run: |
"${OPENSSL_INSTALL_PATH}/bin/openssl" version "${OPENSSL_INSTALL_PATH}/bin/openssl" version
file "${OPENSSL_INSTALL_PATH}/bin/openssl"
- name: Get latest stable Python source - name: Get latest stable Python source
if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true'
@@ -246,12 +287,17 @@ jobs:
if: matrix.goal == 'build' && matrix.os != 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && matrix.os != 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true'
run: | run: |
cd "${PYTHON_SOURCE_PATH}" cd "${PYTHON_SOURCE_PATH}"
if [[ "${RUNNER_OS}" == "macOS" ]]; then
extra_args=( "--enable-universalsdk" "--with-universal-archs=universal2" )
else
extra_args=( )
./configure --with-openssl="${OPENSSL_INSTALL_PATH}" \ ./configure --with-openssl="${OPENSSL_INSTALL_PATH}" \
--prefix="${PYTHON_INSTALL_PATH}" \ --prefix="${PYTHON_INSTALL_PATH}" \
--enable-shared \ --enable-shared \
--with-ensurepip=upgrade \ --with-ensurepip=upgrade \
--enable-optimizations \ --enable-optimizations \
--with-lto --with-lto \
"${extra_args[@]}"
- name: Windows Get External Python deps - name: Windows Get External Python deps
if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true'
@@ -356,7 +402,7 @@ jobs:
- name: Install pip requirements - name: Install pip requirements
run: | run: |
set +e set +e
"${PYTHON}" -m pip install --upgrade -r requirements.txt "${PYTHON}" -m pip install --upgrade -r requirements.txt "${PIP_ARGS[@]}"
"${PYTHON}" -m pip list "${PYTHON}" -m pip list
- name: Build GAM with PyInstaller - name: Build GAM with PyInstaller