Start of M1 support. Currently all MacOS support is broken.
This commit is contained in:
parent
1ba9000661
commit
1956472c30
1 changed files with 135 additions and 58 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
#
|
||||
# JoeyLib
|
||||
# Copyright (C) 2018-2019 Scott Duensing <scott@kangaroopunch.com>
|
||||
# Copyright (C) 2018-2021 Scott Duensing <scott@kangaroopunch.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -36,10 +36,13 @@ G_AUTOMATED=
|
|||
G_PASSWORD=
|
||||
G_ORCA_FILE=
|
||||
G_GOLDEN_GATE_FILE=
|
||||
G_XCODE_FILE=
|
||||
G_OSX_MIN=10.6
|
||||
G_OSX_DARWIN=17
|
||||
#***TODO*** This list is dumb. It and more should be in an array.
|
||||
G_MAC_INTEL_MIN=10.6
|
||||
G_MAC_INTEL_DARWIN=17
|
||||
G_MAC_INTEL_XIP="$(pwd)/Xcode_9.4.1.xip"
|
||||
G_MAC_APPLE_MIN=10.9
|
||||
G_MAC_APPLE_DARWIN=20.4
|
||||
G_MAC_APPLE_XIP="$(pwd)/Xcode_12.5.1.xip"
|
||||
#***TODO*** This list is dumb. It and more should be in an array. The rest is in the mainMenu code.
|
||||
G_IIGS=0
|
||||
#G_AMIGA=1
|
||||
#G_ATARIST=2
|
||||
|
@ -47,56 +50,79 @@ G_LINUX32=1
|
|||
G_LINUX64=2
|
||||
G_WIN32=3
|
||||
G_WIN64=4
|
||||
G_MAC32=5
|
||||
G_MAC64=6
|
||||
G_MACX32=5
|
||||
G_MACX64=6
|
||||
G_MACA64=7
|
||||
#G_ANDROID=9
|
||||
#G_IOS=10
|
||||
|
||||
|
||||
function buildMacOSXSDK() {
|
||||
local RESULT=$1
|
||||
local ARCH=$1
|
||||
local RESULT=$2
|
||||
local XCODE=
|
||||
local XIP=
|
||||
local OSX="${G_PARENT}/sdks/macOS"
|
||||
|
||||
eval $RESULT=0
|
||||
|
||||
if [[ "${ARCH}" == "APPLE" ]]; then
|
||||
OSX="${OSX}/apple"
|
||||
XIP="${G_MAC_APPLE_XIP}"
|
||||
else
|
||||
OSX="${OSX}/intel"
|
||||
XIP="${G_MAC_INTEL_XIP}"
|
||||
fi
|
||||
|
||||
mkdir -p "${G_PARENT}/sdks"
|
||||
|
||||
if [[ -e "${OSX}/SDK" ]]; then
|
||||
eval $RESULT=1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ ! -z ${G_AUTOMATED} ]]; then
|
||||
XCODE=${G_XCODE_FILE}
|
||||
XCODE=${XIP}
|
||||
if [[ ! -e "${XCODE}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
if [[ ! -e "${OSX}/SDK" ]]; then
|
||||
tFileBrowser XCODE "Please locate your XCode XIP" .xip ..
|
||||
if [[ -z ${XCODE} || "${XCODE}" == "" ]]; then
|
||||
return 0
|
||||
fi
|
||||
tFileBrowser XCODE "Please locate ${XIP}" .xip ..
|
||||
if [[ -z ${XCODE} || "${XCODE}" == "" ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
purple "Building macOS SDK"
|
||||
if [[ ! -d osxcross ]]; then
|
||||
purple "Building macOS SDK"
|
||||
git clone https://github.com/tpoechtrager/osxcross.git
|
||||
pushd osxcross &> /dev/null
|
||||
./tools/gen_sdk_package_pbzx.sh "${XCODE}"
|
||||
mv -f MacOSX.* tarballs/.
|
||||
# SDK_VERSION=
|
||||
OSX_VERSION_MIN=${G_OSX_MIN} UNATTENDED=1 ./build.sh
|
||||
mv -f target "${OSX}"
|
||||
popd &> /dev/null
|
||||
fi
|
||||
|
||||
G_IS_INSTALLED[$G_MAC32]=1
|
||||
G_IS_INSTALLED[$G_MAC64]=1
|
||||
configWrite
|
||||
configRead
|
||||
pushd osxcross &> /dev/null
|
||||
./tools/gen_sdk_package_pbzx.sh "${XCODE}"
|
||||
mv -f MacOSX.* tarballs/.
|
||||
# SDK_VERSION=
|
||||
# OSX_VERSION_MIN=${G_MAC_INTEL_MIN}
|
||||
UNATTENDED=1 ./build.sh
|
||||
mv -f target "${OSX}"
|
||||
./cleanup.sh
|
||||
popd &> /dev/null
|
||||
|
||||
eval $RESULT=1
|
||||
}
|
||||
|
||||
|
||||
function buildPCDepsM1Hack() {
|
||||
mkdir -p build-scripts
|
||||
pushd build-scripts &> /dev/null
|
||||
rm -f config.guess config.sub
|
||||
wget https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
|
||||
wget https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
|
||||
popd &> /dev/null
|
||||
cp -f build-scripts/config.guess .
|
||||
cp -f build-scripts/config.sub .
|
||||
}
|
||||
|
||||
|
||||
function buildPCDeps() {
|
||||
local TARGET=$1
|
||||
local FOLDER=$2
|
||||
|
@ -104,11 +130,13 @@ function buildPCDeps() {
|
|||
local CC_EXPORT=$4
|
||||
local CXX_EXPORT=$5
|
||||
local LD_EXPORT=$6
|
||||
local ADD_PATH=$7
|
||||
local DIST="$(pwd)/../dist/${FOLDER}"
|
||||
local PREFIX="$(pwd)/../sdks/${FOLDER}"
|
||||
local CC_OLD=$CC
|
||||
local CXX_OLD=$CXX
|
||||
local LD_OLD=$LD_LIBRARY_PATH
|
||||
local CC_OLD=${CC}
|
||||
local CXX_OLD=${CXX}
|
||||
local LD_OLD=${LD_LIBRARY_PATH}
|
||||
local PATH_OLD=${PATH}
|
||||
local SRC="${G_PARENT}/joeylib/joeylib/src"
|
||||
local G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -I${PREFIX}/include -c"
|
||||
|
||||
|
@ -121,12 +149,17 @@ function buildPCDeps() {
|
|||
export CXX="${CXX_EXPORT}"
|
||||
export LD_LIBRARY_PATH="${LD_EXPORT}"
|
||||
|
||||
if [[ ! -z ${ADD_PATH} ]]; then
|
||||
export PATH="${ADD_PATH}:${PATH}"
|
||||
fi
|
||||
|
||||
# SDL2
|
||||
purple "Building SDL2 ${TARGET}"
|
||||
if [[ ! -d SDL ]]; then
|
||||
hg clone http://hg.libsdl.org/SDL
|
||||
pushd SDL &> /dev/null
|
||||
hg up release-2.0.12
|
||||
hg up release-2.0.14
|
||||
buildPCDepsM1Hack
|
||||
popd &> /dev/null
|
||||
fi
|
||||
if [[ ! -e "${PREFIX}/lib/libSDL2.a" ]]; then
|
||||
|
@ -157,6 +190,7 @@ function buildPCDeps() {
|
|||
autoheader
|
||||
automake --force-missing --add-missing
|
||||
autoconf
|
||||
buildPCDepsM1Hack
|
||||
popd &> /dev/null
|
||||
fi
|
||||
if [[ ! -e "${PREFIX}/lib/libmodplug.a" ]]; then
|
||||
|
@ -180,6 +214,7 @@ function buildPCDeps() {
|
|||
hg clone http://hg.libsdl.org/SDL_mixer
|
||||
pushd SDL_mixer &> /dev/null
|
||||
hg up release-2.0.4
|
||||
buildPCDepsM1Hack
|
||||
popd &> /dev/null
|
||||
fi
|
||||
if [[ ! -e "${PREFIX}/lib/libSDL2_mixer.a" ]]; then
|
||||
|
@ -215,6 +250,8 @@ function buildPCDeps() {
|
|||
export CXX="${CXX_OLD}"
|
||||
export LD_LIBRARY_PATH="${LD_OLD}"
|
||||
|
||||
export PATH="${PATH_OLD}"
|
||||
|
||||
configWrite
|
||||
configRead
|
||||
|
||||
|
@ -340,16 +377,22 @@ function configWrite() {
|
|||
SDKLIST="${SDKLIST} ST"
|
||||
P=\${JOEY}/sdks/st/bin:${P}
|
||||
fi
|
||||
if [[ ${G_IS_INSTALLED[$G_MAC32]} == 1 || ${G_IS_INSTALLED[$G_MAC64]} == 1 ]]; then
|
||||
if [[ ${G_IS_INSTALLED[$G_MAC32]} == 1 ]]; then
|
||||
SDKLIST="${SDKLIST} MACOS32"
|
||||
if [[ ${G_IS_INSTALLED[$G_MACX32]} == 1 || ${G_IS_INSTALLED[$G_MACX64]} == 1 ]]; then
|
||||
if [[ ${G_IS_INSTALLED[$G_MACX32]} == 1 ]]; then
|
||||
SDKLIST="${SDKLIST} MACOSX32"
|
||||
fi
|
||||
if [[ ${G_IS_INSTALLED[$G_MAC64]} == 1 ]]; then
|
||||
SDKLIST="${SDKLIST} MACOS64"
|
||||
if [[ ${G_IS_INSTALLED[$G_MACX64]} == 1 ]]; then
|
||||
SDKLIST="${SDKLIST} MACOSX64"
|
||||
fi
|
||||
P=\${JOEY}/sdks/macOS/bin:${P}
|
||||
echo "export MACOSX_DEPLOYMENT_TARGET=${G_OSX_MIN}" >> "${O}"
|
||||
echo "export MACOSX_DARWIN=${G_OSX_DARWIN}" >> "${O}"
|
||||
echo "export MACOSX_INTEL_PATH=\"\${JOEY}/sdks/macOS/intel/bin\"" >> "${O}"
|
||||
echo "export MACOSX_INTEL_DEPLOYMENT_TARGET=${G_MAC_INTEL_MIN}" >> "${O}"
|
||||
echo "export MACOSX_INTEL_DARWIN=${G_MAC_INTEL_DARWIN}" >> "${O}"
|
||||
fi
|
||||
if [[ ${G_IS_INSTALLED[$G_MACA64]} == 1 ]]; then
|
||||
SDKLIST="${SDKLIST} MACOSA64"
|
||||
echo "export MACOSX_APPLE_PATH=\"\${JOEY}/sdks/macOS/apple/bin\"" >> "${O}"
|
||||
echo "export MACOSX_APPLE_DEPLOYMENT_TARGET=${G_MAC_APPLE_MIN}" >> "${O}"
|
||||
echo "export MACOSX_APPLE_DARWIN=${G_MAC_APPLE_DARWIN}" >> "${O}"
|
||||
fi
|
||||
echo "export PATH=\"${P}\"" >> "${O}"
|
||||
if [[ ${G_IS_INSTALLED[$G_WIN32]} == 1 ]]; then
|
||||
|
@ -697,6 +740,7 @@ function installLinux32() {
|
|||
"x86_64-linux-gnu" \
|
||||
"x86_64-linux-gnu-gcc -m32" \
|
||||
"x86_64-linux-gnu-g++ -m32" \
|
||||
"" \
|
||||
""
|
||||
}
|
||||
|
||||
|
@ -708,38 +752,66 @@ function installLinux64() {
|
|||
"x86_64-linux-gnu" \
|
||||
"x86_64-linux-gnu-gcc" \
|
||||
"x86_64-linux-gnu-g++" \
|
||||
"" \
|
||||
""
|
||||
#buildSDL12 "x86_64-linux-gnu" "${JOEY}/sdks/linux/x64"
|
||||
}
|
||||
|
||||
|
||||
function installmacOS32() {
|
||||
function installmacOSA64() {
|
||||
local INSTALLED=
|
||||
buildMacOSXSDK INSTALLED
|
||||
buildMacOSXSDK APPLE INSTALLED
|
||||
if [[ ${INSTALLED} -eq 1 ]]; then
|
||||
buildPCDeps \
|
||||
"macos32" \
|
||||
"macOS/i386" \
|
||||
"i386-apple-darwin${G_OSX_DARWIN}" \
|
||||
"o32-clang" \
|
||||
"macosa64" \
|
||||
"macOS/a64" \
|
||||
"arm64-apple-darwin${G_MAC_APPLE_DARWIN}" \
|
||||
"oa64-clang" \
|
||||
"" \
|
||||
"${JOEY}/sdks/macOS/lib"
|
||||
fi
|
||||
"${JOEY}/sdks/macOS/apple/lib" \
|
||||
"${JOEY}/sdks/macOS/apple/bin"
|
||||
G_IS_INSTALLED[$G_MACA64]=1
|
||||
configWrite
|
||||
configRead
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function installmacOS64() {
|
||||
function installmacOSX32() {
|
||||
local INSTALLED=
|
||||
buildMacOSXSDK INSTALLED
|
||||
buildMacOSXSDK INTEL INSTALLED
|
||||
if [[ ${INSTALLED} -eq 1 ]]; then
|
||||
buildPCDeps \
|
||||
"macos64" \
|
||||
"macosx32" \
|
||||
"macOS/i386" \
|
||||
"i386-apple-darwin${G_MAC_INTEL_DARWIN}" \
|
||||
"o32-clang" \
|
||||
"" \
|
||||
"${JOEY}/sdks/macOS/intel/lib" \
|
||||
"${JOEY}/sdks/macOS/intel/bin"
|
||||
G_IS_INSTALLED[$G_MACX32]=1
|
||||
configWrite
|
||||
configRead
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function installmacOSX64() {
|
||||
local INSTALLED=
|
||||
buildMacOSXSDK INTEL INSTALLED
|
||||
if [[ ${INSTALLED} -eq 1 ]]; then
|
||||
buildPCDeps \
|
||||
"macosx64" \
|
||||
"macOS/x64" \
|
||||
"x86_64-apple-darwin${G_OSX_DARWIN}" \
|
||||
"x86_64-apple-darwin${G_MAC_INTEL_DARWIN}" \
|
||||
"o64-clang" \
|
||||
"" \
|
||||
"${JOEY}/sdks/macOS/lib"
|
||||
fi
|
||||
"${JOEY}/sdks/macOS/intel/lib" \
|
||||
"${JOEY}/sdks/macOS/intel/bin"
|
||||
G_IS_INSTALLED[$G_MACX64]=1
|
||||
configWrite
|
||||
configRead
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -837,6 +909,7 @@ function installWin32() {
|
|||
"i686-w64-mingw32" \
|
||||
"i686-w64-mingw32-gcc -static-libgcc" \
|
||||
"" \
|
||||
"" \
|
||||
""
|
||||
}
|
||||
|
||||
|
@ -848,6 +921,7 @@ function installWin64() {
|
|||
"x86_64-w64-mingw32" \
|
||||
"x86_64-w64-mingw32-gcc -static-libgcc" \
|
||||
"x86_64-w64-mingw32-g++ -static-libstdc++" \
|
||||
"" \
|
||||
""
|
||||
}
|
||||
|
||||
|
@ -861,8 +935,9 @@ function mainMenu() {
|
|||
"Linux64"
|
||||
"Win32"
|
||||
"Win64"
|
||||
"macOS32"
|
||||
"macOS64"
|
||||
"macOSX32"
|
||||
"macOSX64"
|
||||
"macOSA64"
|
||||
# "Android"
|
||||
# "iOS"
|
||||
)
|
||||
|
@ -874,8 +949,9 @@ function mainMenu() {
|
|||
"Linux 64"
|
||||
"Windows 32"
|
||||
"Windows 64"
|
||||
"macOS 32"
|
||||
"macOS 64"
|
||||
"macOS Intel 32"
|
||||
"macOS Intel 64"
|
||||
"macOS Apple 64"
|
||||
# "Android 32"
|
||||
# "iOS 64"
|
||||
)
|
||||
|
@ -889,6 +965,7 @@ function mainMenu() {
|
|||
"windows/x64/libjoeylib.a"
|
||||
"macOS/i386/libjoeylib.a"
|
||||
"macOS/x64/libjoeylib.a"
|
||||
"macOS/a64/libjoeylib.a"
|
||||
# "Android"
|
||||
# "iOS"
|
||||
)
|
||||
|
@ -908,6 +985,7 @@ function mainMenu() {
|
|||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
# 0
|
||||
# 0
|
||||
)
|
||||
|
@ -1122,7 +1200,6 @@ if [[ "$1" == "AUTOMATED" ]]; then
|
|||
G_PASSWORD="$2"
|
||||
G_ORCA_FILE="$3"
|
||||
G_GOLDEN_GATE_FILE="$4"
|
||||
G_XCODE_FILE="$5"
|
||||
fi
|
||||
|
||||
# Don't run as root.
|
||||
|
|
Loading…
Add table
Reference in a new issue