Still arguing with x86 MacOS.
This commit is contained in:
parent
35b4b1303b
commit
e89cdf12e8
3 changed files with 99 additions and 36 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
*~
|
||||
clang/
|
||||
work/
|
||||
x-tools/
|
||||
*.xip
|
||||
|
|
|
@ -25,5 +25,10 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
set(KANGAROO_OS linux)
|
||||
set(KANGAROO_ARCH x86_64)
|
||||
|
|
|
@ -33,9 +33,9 @@ function buildMacOSXToolchain() {
|
|||
local XCODE=$2
|
||||
local PLATFORM=$3
|
||||
local BASE=$(pwd)
|
||||
# This isn't great. What if there is more than one version installed?
|
||||
#local LLVM=$(ls -1 /usr/lib | grep llvm)
|
||||
#local CLANG=$(ls -1 /usr/lib/${LLVM}/lib/clang | grep -F .)
|
||||
local CLANG=
|
||||
local RTPATH=
|
||||
local CROSSTOOLS="${BASE}/x-tools/${PLATFORM}"
|
||||
|
||||
mkdir -p work
|
||||
|
||||
|
@ -47,9 +47,17 @@ function buildMacOSXToolchain() {
|
|||
if [[ ! -f x-tools/${PLATFORM}/toolchain.cmake ]]; then
|
||||
pushd work/osxcross
|
||||
# Have we built Apple's clang?
|
||||
#if [[ ! -d "${BASE}/clang" ]]; then
|
||||
# UNATTENDED=1 INSTALLPREFIX=${BASE}/clang ./build_apple_clang.sh
|
||||
#fi
|
||||
if [[ ! -d "${BASE}/clang" ]]; then
|
||||
UNATTENDED=1 INSTALLPREFIX=${BASE}/clang ./build_apple_clang.sh
|
||||
pushd build/clang*/build_stage2
|
||||
make install
|
||||
popd
|
||||
fi
|
||||
# Use our fresh new clang.
|
||||
source <("${CROSSTOOLS}/bin/osxcross-conf" 2>/dev/null)
|
||||
export PATH="${BASE}/clang/bin:${CROSSTOOLS}/bin:${PATH}"
|
||||
export CC="${BASE}/clang/bin/clang"
|
||||
export CXX="${BASE}/clang/bin/clang++"
|
||||
# Do we have an existing SDK tarball?
|
||||
if [[ ! -f "${BASE}/${SDK}" ]]; then
|
||||
# Nope. Build tarball and keep for later.
|
||||
|
@ -59,12 +67,35 @@ function buildMacOSXToolchain() {
|
|||
# Put tarball in place.
|
||||
cp -f "${BASE}/${SDK}" tarballs/.
|
||||
# Build SDK.
|
||||
UNATTENDED=1 TARGET_DIR=${BASE}/x-tools/${PLATFORM} ./build.sh
|
||||
UNATTENDED=1 TARGET_DIR="${CROSSTOOLS}" ./build.sh
|
||||
# Fix fubar in osxcross.
|
||||
[[ -d target ]] && rm -rf target
|
||||
ln -sf ${BASE}/x-tools/${PLATFORM} target
|
||||
ln -sf "${CROSSTOOLS}" target
|
||||
:<<NO_GCC
|
||||
# Build GCC
|
||||
# Fix another fubar in osxcross.
|
||||
if [[ ! -f build_gcc-fixed.sh ]]; then
|
||||
sed '/^pushd gcc.*/a \.\/contrib\/download_prerequisites' build_gcc.sh > build_gcc-fixed.sh
|
||||
chmod +x build_gcc-fixed.sh
|
||||
fi
|
||||
TARGET_DIR="${CROSSTOOLS}" ./build_gcc-fixed.sh
|
||||
NO_GCC
|
||||
# Build compiler runtime.
|
||||
./build_compiler_rt.sh
|
||||
#***TODO*** This fails to find <optional> for x86.
|
||||
RTPATH="${BASE}/clang/lib/clang"
|
||||
CLANG=$(ls -1 "${RTPATH}" | grep -F . | sort | tail -n1)
|
||||
if [[ "${CLANG}" == "" ]]; then
|
||||
CLANG=$(ls -1 "${RTPATH}" | sort | tail -n1)
|
||||
fi
|
||||
RTPATH="${RTPATH}/${CLANG}/lib/darwin"
|
||||
if [[ -d "${RTPATH}" ]]; then
|
||||
rm -rf "${RTPATH}"
|
||||
fi
|
||||
CXX_FLAGS="-std=c++17" ENABLE_COMPILER_RT_INSTALL=1 ./build_compiler_rt.sh
|
||||
if [[ -d "${RTPATH}" ]]; then
|
||||
mv -f "${RTPATH}" "${CROSSTOOLS}/."
|
||||
echo "RTPATH=\"${RTPATH}\"" > ${CROSSTOOLS}/rtpath.inc
|
||||
fi
|
||||
# Tidy up for next build.
|
||||
./cleanup.sh
|
||||
popd
|
||||
|
@ -75,16 +106,20 @@ function buildMacOSXToolchain() {
|
|||
function install_x86_64_linux() {
|
||||
# Required tools for Linux x86_64. These should always be installed.
|
||||
sudo apt-get install -y \
|
||||
autoconf \
|
||||
binutils \
|
||||
bison \
|
||||
build-essential \
|
||||
clang \
|
||||
cmake \
|
||||
cmake-curses-gui \
|
||||
curl \
|
||||
flex \
|
||||
git \
|
||||
git-lfs \
|
||||
liblzma-dev \
|
||||
libtool \
|
||||
nasm \
|
||||
texinfo \
|
||||
unzip \
|
||||
zlib1g-dev
|
||||
|
@ -93,7 +128,10 @@ function install_x86_64_linux() {
|
|||
|
||||
function install_x86_linux() {
|
||||
# x86 Linux support.
|
||||
sudo apt-get install -y gcc-multilib
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get install -y \
|
||||
gcc-i686-linux-gnu \
|
||||
g++-i686-linux-gnu
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,19 +142,23 @@ function install_x86_64_windows() {
|
|||
|
||||
|
||||
function install_aarch64_pi() {
|
||||
# Raspberry Pi, various CPUs.
|
||||
# Raspberry Pi, aarch64.
|
||||
wget -O- ${PIURL}aarch64-rpi3-linux-gnu.tar.xz | tar xJ
|
||||
#***TODO*** sysroot
|
||||
}
|
||||
|
||||
|
||||
function install_armv6_pi() {
|
||||
# Raspberry Pi, armv6.
|
||||
wget -O- ${PIURL}armv6-rpi-linux-gnueabihf.tar.xz | tar xJ
|
||||
#***TODO*** sysroot
|
||||
}
|
||||
|
||||
|
||||
function install_armv8_pi() {
|
||||
# Raspberry Pi, armv8.
|
||||
wget -O- ${PIURL}armv8-rpi3-linux-gnueabihf.tar.xz | tar xJ
|
||||
#***TODO*** sysroots
|
||||
#***TODO*** sysroot
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,6 +172,7 @@ function install_x86_64_macos() {
|
|||
|
||||
function install_aarch64_macos() {
|
||||
# MacOS aarch64.
|
||||
#***TODO*** https://stackoverflow.com/questions/67712376/after-updating-gcc-clang-cant-find-libstdc-anymore
|
||||
buildMacOSXToolchain MacOSX13.3.sdk.tar.xz Xcode_14.3.1.xip aarch64-macos-apple
|
||||
}
|
||||
|
||||
|
@ -152,8 +195,9 @@ function install_x86_dos() {
|
|||
}
|
||||
|
||||
|
||||
ARCH=$1
|
||||
PLAT=$2
|
||||
MODE=$1
|
||||
ARCH=$2
|
||||
PLAT=$3
|
||||
|
||||
HELP=1
|
||||
|
||||
|
@ -171,18 +215,19 @@ PLATFORMS[12]="x86_64"; PLATFORMS[13]="macos"
|
|||
PLATFORMS[14]="aarch64"; PLATFORMS[15]="macos"
|
||||
PLATFORMS[16]="x86"; PLATFORMS[17]="dos"
|
||||
|
||||
# Install all toolchains.
|
||||
if [[ "${ARCH}" == "all" && "${PLAT}" == "all" ]]; then
|
||||
if [[ "${MODE}" == "install" ]]; then
|
||||
# Install all toolchains.
|
||||
if [[ "${ARCH}" == "all" && "${PLAT}" == "all" ]]; then
|
||||
HELP=0
|
||||
for (( row=0; row<ROWS; row++ )); do
|
||||
set -x
|
||||
install_${PLATFORMS[$((${COLS}*${row}))]}_${PLATFORMS[$((${COLS}*${row}+1))]}
|
||||
set +x
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install all toolchains for a specific platform.
|
||||
if [[ "${ARCH}" == "all" && "${PLAT}" != "all" ]]; then
|
||||
# Install all toolchains for a specific platform.
|
||||
if [[ "${ARCH}" == "all" && "${PLAT}" != "all" ]]; then
|
||||
HELP=0
|
||||
for (( row=0; row<ROWS; row++ )); do
|
||||
if [[ "${PLAT}" == "${PLATFORMS[$((${COLS}*${row}+1))]}" ]]; then
|
||||
|
@ -191,10 +236,10 @@ if [[ "${ARCH}" == "all" && "${PLAT}" != "all" ]]; then
|
|||
set +x
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install a single toolchain.
|
||||
if [[ "${ARCH}" != "all" && "${PLAT}" != "all" ]]; then
|
||||
# Install a single toolchain.
|
||||
if [[ "${ARCH}" != "all" && "${PLAT}" != "all" ]]; then
|
||||
for (( row=0; row<ROWS; row++ )); do
|
||||
if [[ "${ARCH}" == "${PLATFORMS[$((${COLS}*${row}))]}" && "${PLAT}" == "${PLATFORMS[$((${COLS}*${row}+1))]}" ]]; then
|
||||
HELP=0
|
||||
|
@ -203,6 +248,18 @@ if [[ "${ARCH}" != "all" && "${PLAT}" != "all" ]]; then
|
|||
set +x
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${MODE}" == "use" ]]; then
|
||||
for (( row=0; row<ROWS; row++ )); do
|
||||
if [[ "${ARCH}" == "${PLATFORMS[$((${COLS}*${row}))]}" && "${PLAT}" == "${PLATFORMS[$((${COLS}*${row}+1))]}" ]]; then
|
||||
HELP=0
|
||||
set -x
|
||||
#use_${ARCH}_${PLAT}
|
||||
set +x
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Do they need help?
|
||||
|
@ -212,7 +269,7 @@ if [[ ${HELP} -eq 1 ]]; then
|
|||
Kangaroo Punch Toolchain Installer
|
||||
http://skunkworks.kangaroopunch.com
|
||||
|
||||
Usage: $0 [architecture] [platform]
|
||||
Usage: $0 install [architecture] [platform]
|
||||
|
||||
Where [architecture] and [platform] are one of:
|
||||
|
Loading…
Add table
Reference in a new issue