Try and fix mpy-cross variants

This commit is contained in:
Scott Shawcroft 2023-10-05 14:00:19 -07:00
parent 7869706551
commit 22a44c6003
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
14 changed files with 26 additions and 100 deletions

View File

@ -5,6 +5,9 @@ inputs:
required: false
default: true
type: boolean
cp-version:
required: true
type: string
runs:
using: composite
@ -27,6 +30,8 @@ runs:
if: inputs.download == 'false' || steps.download-mpy-cross.outcome == 'failure'
run: make -C mpy-cross -j2
shell: bash
env:
CP_VERSION: ${{ inputs.cp-version }}
- name: Upload mpy-cross
if: inputs.download == 'false' || steps.download-mpy-cross.outcome == 'failure'
@ -34,4 +39,4 @@ runs:
uses: actions/upload-artifact@v3
with:
name: mpy-cross
path: mpy-cross/mpy-cross
path: mpy-cross/build/mpy-cross

View File

@ -49,6 +49,8 @@ jobs:
- name: Set up mpy-cross
if: steps.set-up-submodules.outputs.frozen == 'True'
uses: ./.github/actions/mpy_cross
with:
cp-version: ${{ inputs.cp-version }}
- name: Versions
run: |

View File

@ -51,6 +51,7 @@ jobs:
- name: Set up mpy-cross
uses: ./.github/actions/mpy_cross
with:
cp-version: ${{ steps.set-up-submodules.outputs.version }}
download: false
- name: Get last commit with checks
id: get-last-commit-with-checks

View File

@ -65,6 +65,7 @@ jobs:
if: steps.set-up-submodules.outputs.frozen == 'True'
uses: ./.github/actions/mpy_cross
with:
cp-version: ${{ steps.set-up-submodules.outputs.version }}
download: false
- name: Versions
run: |

View File

@ -17,7 +17,7 @@ jobs:
env:
CP_VERSION: ${{ inputs.cp-version }}
MICROPY_CPYTHON3: python3.8
MICROPY_MICROPYTHON: ../ports/unix/micropython-coverage
MICROPY_MICROPYTHON: ../ports/unix/build-coverage/micropython
TEST_all:
TEST_mpy: --via-mpy -d basics float micropython
TEST_native: --emit native
@ -41,6 +41,8 @@ jobs:
uses: ./.github/actions/deps/external
- name: Set up mpy-cross
uses: ./.github/actions/mpy_cross
with:
cp-version: ${{ inputs.cp-version }}
- name: Build unix port
run: make -C ports/unix VARIANT=coverage -j2
- name: Run tests

View File

@ -1,7 +1,7 @@
include ../py/mkenv.mk
# define main target
PROG = mpy-cross
PROG ?= mpy-cross
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h

View File

@ -6,4 +6,4 @@ PROG=mpy-cross.fuzz
BUILD=build-static
STATIC_BUILD=1
CC=afl-clang-fast
include mpy-cross.mk
include Makefile

View File

@ -5,6 +5,6 @@
PROG=mpy-cross-arm64
BUILD=build-arm64
include mpy-cross.mk
include Makefile
# Because mpy-cross.mk unconditionally overwrites CC for Darwin, we must set it BELOW the inclusion
CC := $(shell xcrun --find clang) -isysroot $(shell xcrun --show-sdk-path) -target arm64-apple-macos11

View File

@ -6,4 +6,4 @@ PROG=mpy-cross.static
BUILD=build-static
STATIC_BUILD=1
include mpy-cross.mk
include Makefile

View File

@ -7,4 +7,4 @@ BUILD=build-static-aarch64
STATIC_BUILD=1
CROSS_COMPILE = aarch64-linux-gnu-
include mpy-cross.mk
include Makefile

View File

@ -7,4 +7,4 @@ CROSS_COMPILE = x86_64-w64-mingw32-
BUILD=build-static-mingw
STATIC_BUILD=1
include mpy-cross.mk
include Makefile

View File

@ -8,4 +8,4 @@ STATIC_BUILD=1
$(shell if ! [ -d pitools ]; then echo 1>&2 "Fetching pi build tools. This may take awhile."; git clone -q https://github.com/raspberrypi/tools.git --depth=1 pitools; fi)
CROSS_COMPILE = pitools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
include mpy-cross.mk
include Makefile

View File

@ -1,89 +0,0 @@
$(error not supposed to be used??)
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
include ../py/mkenv.mk
# define main target
PROG ?= mpy-cross
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# OS name, for simple autoconfig
UNAME_S := $(shell uname -s)
# include py core make definitions
include $(TOP)/py/py.mk
INC += -I.
INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
CWARN = -Wall -Werror
CWARN += -Wpointer-arith -Wuninitialized
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
# Build a static executable.
# Useful for Windows builds, etc., that must run on multiple operating system versions.
ifdef STATIC_BUILD
CFLAGS += -static -static-libgcc -static-libstdc++
endif
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g
COPT = -O0
else
COPT = -Os #-DNDEBUG
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
# The unix port of MicroPython on OSX must be compiled with clang,
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
# Use clang syntax for map file
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
else
# Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
ifdef STATIC_BUILD
LDFLAGS += -static -static-libgcc -static-libstdc++
endif
CFLAGS += -DCIRCUITPY=1
# source files
SRC_C += \
main.c \
gccollect.c \
shared/runtime/gchelper_generic.c \
supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \
supervisor/shared/translate/translate.c
$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h
# Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
SRC_C += fmode.c
endif
OBJ = $(PY_CORE_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h
include $(TOP)/py/mkrules.mk

View File

@ -13,8 +13,9 @@ import pathlib
import datetime
import subprocess
# CIRCUITPY: use external script
tools_describe = str(pathlib.Path(__file__).parent.parent / "tools/describe")
# CIRCUITPY: use external script that can override git describe output with an
# environment variable.
tools_describe = str(pathlib.Path(__file__).resolve().parent.parent / "tools/describe")
def get_version_info_from_git(repo_path):
@ -27,6 +28,7 @@ def get_version_info_from_git(repo_path):
# Note: git describe doesn't work if no tag is available
try:
print(tools_describe)
git_tag = subprocess.check_output(
[tools_describe],
cwd=repo_path,
@ -93,8 +95,10 @@ def make_version_header(repo_path, filename):
# Get version info using git (required)
info = get_version_info_from_git(repo_path)
if info is None:
print(info)
cannot_determine_version()
git_tag, git_hash, ver = info
print(git_tag, git_hash, ver)
if len(ver) < 3:
cannot_determine_version()
else: