diff --git a/build-distro.sh b/build-distro.sh index f0dd4bc..587b3f2 100755 --- a/build-distro.sh +++ b/build-distro.sh @@ -83,6 +83,8 @@ pushd distro cp -f ../README . cp -f ../f256build.bat . cp -f ../f256run.bat . + cp -f ../f256build.sh . + cp -f ../f256run.sh . buildOverlayTool linux x86_64 $(pwd)/overlay.linux buildOverlayTool macos aarch64 $(pwd)/overlay.macos diff --git a/distro/README b/distro/README index 062a491..4c24ed8 100644 --- a/distro/README +++ b/distro/README @@ -18,15 +18,19 @@ On Windows, you will need: * WinRAR (https://www.rarlab.com/) or 7-Zip (https://www.7zip.com/) installed. * Python 3.x (https://www.python.org/) installed and in your PATH. +MacOS and Linux: + + * Ensure you have Python 3.x installed. + INSTALLATION ============ Download the appropriate installation script: - * 64 bit Intel Windows: f256-install-windows.bat - * 64 bit Intel Linux: f256-install-linux.sh - * 64 bit ARM MacOS: f256-install-macos.sh + * 64 bit Intel Windows: f256-install.bat + * 64 bit Intel Linux: f256-install.sh + * 64 bit ARM MacOS: f256-install.sh Create a new, empty directory, with no spaces in the name (or in the names of the parent directories) and place this file into it. From that folder, execute @@ -65,6 +69,8 @@ C:\FOENIX folder as follows: UNIX folks, flip your slashes! + f256build.sh code/myprogram + USAGE ===== diff --git a/distro/f256-install-windows.bat b/distro/f256-install.bat similarity index 100% rename from distro/f256-install-windows.bat rename to distro/f256-install.bat diff --git a/distro/f256-install-linux.sh b/distro/f256-install.sh similarity index 75% rename from distro/f256-install-linux.sh rename to distro/f256-install.sh index aed971e..a625140 100755 --- a/distro/f256-install-linux.sh +++ b/distro/f256-install.sh @@ -22,9 +22,26 @@ # SOFTWARE. # +# +# This script is intended for use on Linux and MacOS. +# -REMOTE1=https://github.com/llvm-mos/llvm-mos-sdk/releases/latest/download/llvm-mos-linux.tar.xz -LOCAL1=llvm-mos-linux.tar.xz + +MACTEST=$(uname -a | grep Darwin) +if [[ $? == 0 ]]; then + MACTEST=$(uname -a | grep arm64) + if [[ $? == 0 ]]; then + MAC=1 + fi +fi + +if [[ -z ${MAC} ]]; then + REMOTE1=https://github.com/llvm-mos/llvm-mos-sdk/releases/latest/download/llvm-mos-linux.tar.xz + LOCAL1=llvm-mos-linux.tar.xz +else + REMOTE1=https://github.com/llvm-mos/llvm-mos-sdk/releases/latest/download/llvm-mos-macos.tar.xz + LOCAL1=llvm-mos-macos.tar.xz +fi REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.tar.xz LOCAL2=llvm-mos-f256.tar.xz @@ -38,14 +55,25 @@ if [[ -d $(basename -s .tar.xz ${LOCAL1}) ]]; then exit 1 fi -PYTHON=$(which pythonx) -if [[ $? != 0 ]]; then - echo "Unable to find Python. Exiting." +PYTHON=$(which python) +if [[ $? == 1 ]]; then + PYTHON=$(which python3) + if [[ $? == 1 ]]; then + echo "Unable to find Python 3.x. Exiting." + exit 1 + fi +fi + +PYVER=$(${PYTHON} --version | grep "Python 3") +if [[ $? == 1 ]]; then + echo "Unable to find Python 3.x. Exiting." + exit 1 fi PIP=$(which pip) -if [[ $? != 0 ]]; then +if [[ $? == 1 ]]; then echo "Unable to find pip. Exiting." + exit 1 fi CURL=$(which curl) @@ -74,8 +102,13 @@ rm ${LOCAL2} rm ${LOCAL3} rm -f overlay.windows -rm -f overlay.macos -mv overlay.linux overlay +if [[ -z ${MAC} ]]; then + rm -f overlay.macos + mv overlay.linux overlay +else + rm -f overlay.linux + mv overlay.macos overlay +fi rm -f *.bat diff --git a/distro/f256build.sh b/distro/f256build.sh index 18b212d..254bd67 100755 --- a/distro/f256build.sh +++ b/distro/f256build.sh @@ -22,6 +22,10 @@ # SOFTWARE. # +# +# This script is intended for use on Linux and MacOS. +# + ROOT=$(pwd) @@ -35,6 +39,15 @@ if ! compgen -G "${1}/src/*.c" > /dev/null; then exit 1 fi +PYTHON=$(which python) +if [[ $? == 1 ]]; then + PYTHON=$(which python3) + if [[ $? == 1 ]]; then + echo "Unable to find Python 3.x. Exiting." + exit 1 + fi +fi + PROJECT=${ROOT}/${1} SOURCE=${PROJECT}/src BUILD=${PROJECT}/.builddir @@ -55,7 +68,7 @@ pushd "${PROJECT}" > /dev/null mv ${NAME} ${NAME}.pgz llvm-nm ${NAME}.elf > ${NAME}.sym llvm-objdump --syms -d --print-imm-hex ${NAME}.elf > ${NAME}.lst - python ${ROOT}/pgz-thunk.py ${NAME}.pgz + ${PYTHON} ${ROOT}/pgz-thunk.py ${NAME}.pgz mv ${NAME}.pgz ../. fi popd > /dev/null diff --git a/distro/f256run.sh b/distro/f256run.sh index 57a7ce1..bb968da 100755 --- a/distro/f256run.sh +++ b/distro/f256run.sh @@ -22,6 +22,10 @@ # SOFTWARE. # +# +# This script is intended for use on Linux and MacOS. +# + ROOT=$(pwd) @@ -30,6 +34,15 @@ if [[ -z ${1} ]]; then exit 1 fi +PYTHON=$(which python) +if [[ $? == 1 ]]; then + PYTHON=$(which python3) + if [[ $? == 1 ]]; then + echo "Unable to find Python 3.x. Exiting." + exit 1 + fi +fi + PROJECT=${ROOT}/${1} NAME=$(basename ${PROJECT}) if [[ ! -f "${PROJECT}/${NAME}.pgz" ]]; then @@ -37,5 +50,5 @@ if [[ ! -f "${PROJECT}/${NAME}.pgz" ]]; then exit 1 fi -python "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --boot FLASH -python "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --run-pgz "${PROJECT}/${NAME}.pgz" +${PYTHON} "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --boot FLASH +${PYTHON} "${ROOT}/FoenixMgr/FoenixMgr/fnxmgr.py" --run-pgz "${PROJECT}/${NAME}.pgz"