Import devel/makeesparduino: makefile for ESP8266 and ESP32 Arduino projects

The main intent for this project is to provide a minimalistic yet powerful and
easy configurable makefile for projects using the ESP/Arduino framework
available at: https://github.com/esp8266/Arduino and
https://github.com/espressif/arduino-esp32.

Testing paco@

Input jca@ sthen@

Ok paco@ jca@ sthen@
This commit is contained in:
tracey 2020-04-23 14:31:06 +00:00
parent e0d3b40116
commit 2606193697
6 changed files with 151 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# $OpenBSD: Makefile,v 1.1.1.1 2020/04/23 14:31:06 tracey Exp $
COMMENT = makefile for ESP8266 and ESP32 Arduino projects
GH_ACCOUNT = plerup
GH_PROJECT = makeEspArduino
GH_TAGNAME = 4.22.0
PKGNAME = makeesparduino-${GH_TAGNAME}
CATEGORIES = devel
MAINTAINER = Tracey Emery <tracey@openbsd.org>
#LGPLv2.1
PERMIT_PACKAGE = Yes
RUN_DEPENDS += devel/arduino \
devel/gmake
NO_TEST = Yes
NO_BUILD = Yes
post-patch:
${SUBST_CMD} ${WRKDIST}/makeEspArduino.mk
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/makeEspArduino
cp -r ${WRKDIST}/*.mk ${PREFIX}/share/makeEspArduino/
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (makeEspArduino-4.22.0.tar.gz) = uqUhHKeLx0rrW+xoXm2A7l6LTfM2Jqegf4g49tnjM7w=
SIZE (makeEspArduino-4.22.0.tar.gz) = 22314

View File

@ -0,0 +1,104 @@
$OpenBSD: patch-makeEspArduino_mk,v 1.1.1.1 2020/04/23 14:31:06 tracey Exp $
Index: makeEspArduino.mk
--- makeEspArduino.mk.orig
+++ makeEspArduino.mk
@@ -26,8 +26,13 @@ CHIP ?= esp8266
BOARD ?= $(if $(filter $(CHIP), esp32),esp32,generic)
# Serial flashing parameters
-UPLOAD_PORT ?= $(shell ls -1tr /dev/tty*USB* 2>/dev/null | tail -1)
-UPLOAD_PORT := $(if $(UPLOAD_PORT),$(UPLOAD_PORT),/dev/ttyS0)
+ifeq ($(OS), OpenBSD)
+ UPLOAD_PORT ?= $(shell ls -1tr /dev/tty*U* 2>/dev/null | tail -1)
+ UPLOAD_PORT := $(if $(UPLOAD_PORT),$(UPLOAD_PORT),/dev/ttyU0)
+else
+ UPLOAD_PORT ?= $(shell ls -1tr /dev/tty*USB* 2>/dev/null | tail -1)
+ UPLOAD_PORT := $(if $(UPLOAD_PORT),$(UPLOAD_PORT),/dev/ttyS0)
+endif
# OTA parameters
OTA_ADDR ?=
@@ -57,7 +62,7 @@ FS_REST_DIR ?= $(BUILD_DIR)/file_system
# Bootloader
BOOT_LOADER ?= $(ESP_ROOT)/bootloaders/eboot/eboot.elf
-
+#XXX: HERE
#====================================================================================
# Standard build logic and values
#====================================================================================
@@ -70,6 +75,8 @@ git_description = $(shell git -C $(1) describe --tags
time_string = $(shell date +$(1))
ifeq ($(OS), Darwin)
find_files = $(shell find -E $2 -regex ".*\.($1)" | sed 's/\/\//\//')
+else ifeq ($(OS), OpenBSD)
+ find_files = $(shell find $2 | awk '/.*\.($1)/')
else
find_files = $(shell find $2 -regextype posix-egrep -regex ".*\.($1)")
endif
@@ -81,20 +88,33 @@ ifndef ESP_ROOT
ARDUINO_ROOT = $(shell cygpath -m $(LOCALAPPDATA)/Arduino15)
else ifeq ($(OS), Darwin)
ARDUINO_ROOT = $(HOME)/Library/Arduino15
+ else ifeq ($(OS), OpenBSD)
+ ARDUINO_ROOT = ${LOCALBASE}/share/arduino
else
ARDUINO_ROOT = $(HOME)/.arduino15
endif
ARDUINO_ESP_ROOT = $(ARDUINO_ROOT)/packages/$(CHIP)
- ESP_ROOT := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/hardware/$(CHIP)/*))
+ ifeq ($(OS), OpenBSD)
+ ESP_ROOT = $(ARDUINO_ROOT)/hardware/espressif/$(CHIP)
+ ARDUINO_LIBS = ${LOCALBASE}/share/arduino/libraries
+ else
+ ESP_ROOT := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/hardware/$(CHIP)/*))
+ ARDUINO_LIBS = $(shell grep -o "sketchbook.path=.*" $(ARDUINO_ROOT)/preferences.txt 2>/dev/null | cut -f2- -d=)/libraries
+ endif
ifeq ($(ESP_ROOT),)
$(error No installed version of $(CHIP) Arduino found)
endif
- ARDUINO_LIBS = $(shell grep -o "sketchbook.path=.*" $(ARDUINO_ROOT)/preferences.txt 2>/dev/null | cut -f2- -d=)/libraries
ESP_ARDUINO_VERSION := $(notdir $(ESP_ROOT))
# Find used version of compiler and tools
- COMP_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/xtensa-*/*))
- ESPTOOL_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/esptool*/*))
- MKSPIFFS_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/mkspiffs/*/*))
+ ifeq ($(OS), OpenBSD)
+ COMP_PATH := ${LOCALBASE}/bin
+ ESPTOOL_PATH := ${LOCALBASE}/bin
+ MKSPIFFS_PATH := ${LOCALBASE}/bin
+ else
+ COMP_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/xtensa-*/*))
+ ESPTOOL_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/esptool*/*))
+ MKSPIFFS_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/mkspiffs/*/*))
+ endif
else
# Location defined, assume it is a git clone
ESP_ARDUINO_VERSION = $(call git_description,$(ESP_ROOT))
@@ -213,6 +233,8 @@ LWIP_VARIANT ?= $(shell cat $(ESP_ROOT)/boards.txt | p
# Handle possible changed state i.e. make command line parameters or changed git versions
ifeq ($(OS), Darwin)
CMD_LINE := $(shell ps $$PPID -o command | tail -1)
+else ifeq ($(OS), OpenBSD)
+ CMD_LINE := $(shell ps $$PPID -o command | tail -1)
else
CMD_LINE := $(shell tr "\0" " " </proc/$$PPID/cmdline)
endif
@@ -496,6 +518,8 @@ DEFAULT_GOAL ?= all
ifeq ($(OS), Darwin)
BUILD_THREADS ?= $(shell sysctl -n hw.ncpu)
+else ifeq ($(OS), OpenBSD)
+ BUILD_THREADS ?= $(shell sysctl -n hw.ncpuonline)
else
BUILD_THREADS ?= $(shell nproc)
endif
@@ -516,6 +540,7 @@ my $$os = shift;
$$os =~ s/Windows_NT/windows/;
$$os =~ s/Linux/linux/;
$$os =~ s/Darwin/macosx/;
+$$os =~ s/OpenBSD/openbsd/;
my $$lwipvariant = shift;
my %v;

View File

@ -0,0 +1,6 @@
A makefile for ESP8266 and ESP32 Arduino projects.
The main intent for this project is to provide a minimalistic yet powerful and
easy configurable makefile for projects using the ESP/Arduino framework
available at: https://github.com/esp8266/Arduino and
https://github.com/espressif/arduino-esp32.

View File

@ -0,0 +1,5 @@
Before using makeesparduino, an arduino-core package must be installed for the
desired Espressif chipset.
If you haven't already, please use pkg_add to install arduino-esp8266,
arduino-esp32, or both.

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2020/04/23 14:31:07 tracey Exp $
share/makeEspArduino/
share/makeEspArduino/makeEspArduino.mk