-
-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Root directory content refactoring (#1725)
* Root directory refactoring: - move info about Bootup Logo from a sepatate README to main README; - replace separate root scripts build.sh and start_dev.sh by root Makefile; - make Scripts directory and move there: flash_ts100_linux.sh script, ci/ directory, dockerfile, LICENSE_RELEASE, and PULL_REQUEST_TEMPLATE; - reconfigure build & deploy scripts according to changes * Scripts => scripts * Scripts -> scripts: re-add missing renamed files * Directories refactoring: add top-level Makefile, add scripts/deploy.sh script, move github templates from top-level dir to .github, organize files inside Development Resources * Update scripts/deploy.sh accroding to codestyle syntax shellcheck * Makefile: add docs-deploy target for mkdocs gh-deploy * Rename IronOS.yml > Env.yml, update related files * Docs configs: remove empty characters * docs/devel: update usage of new script
- Loading branch information
Showing
27 changed files
with
235 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#!/usr/bin/env make | ||
INFO:=top-level Makefile for IronOS - Soldering Iron Open Source Firmware Project. | ||
|
||
|
||
### global adjustable variables | ||
|
||
# command for "docker compose" from DOCKER env. var. | ||
ifdef DOCKER | ||
DOCKER_BIN:=$(DOCKER) | ||
else | ||
DOCKER_BIN:= | ||
endif | ||
|
||
# detect availability of docker | ||
ifndef DOCKER_BIN | ||
DOCKER_COMPOSE:=$(shell command -v docker-compose 2>/dev/null) | ||
DOCKER_TOOL:=$(shell command -v docker 2>/dev/null) | ||
ifdef DOCKER_COMPOSE | ||
DOCKER_BIN:=$(DOCKER_COMPOSE) | ||
else ifdef DOCKER_TOOL | ||
DOCKER_BIN:=$(DOCKER_TOOL) compose | ||
else | ||
$(error ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again) | ||
endif # DOCKER_* checks | ||
endif # DOCKER_BIN | ||
|
||
# command for python-based mkdocs tool | ||
ifndef MKDOCS | ||
MKDOCS:=mkdocs | ||
endif | ||
|
||
|
||
### global static variables | ||
|
||
# docker-related files | ||
DOCKER_YML=$(CURDIR)/Env.yml | ||
DOCKER_FILE=$(CURDIR)/scripts/IronOS.Dockerfile | ||
|
||
# docker dependencies | ||
DOCKER_DEPS=$(DOCKER_YML) $(DOCKER_FILE) | ||
|
||
# compose docker-compose command | ||
DOCKER_CMD=$(DOCKER_BIN) -f $(DOCKER_YML) run --rm builder | ||
|
||
# MkDocs config | ||
MKDOCS_YML=$(CURDIR)/scripts/IronOS-mkdocs.yml | ||
|
||
|
||
### targets | ||
|
||
# default target to show help | ||
help: | ||
@echo | ||
@echo "Welcome!\nThis is $(INFO)" | ||
@echo "To read more about supported commands (aka \"targets\"), type \"make list\"." | ||
@echo "But if you're impatient then just type \"make docker-build\" - it will:" | ||
@echo "\t * download, configure & start docker container" | ||
@echo "\t * compile builds of IronOS firmware for all supported models inside that container" | ||
@echo "\t * export generated binaries to \"scripts/ci/artefacts/\" local directory" | ||
@echo "Patches are welcome. Happy Hacking!" | ||
@echo | ||
|
||
# target to list supported targets with additional info | ||
list: | ||
@echo "" | ||
@echo "Supported top-level targets:" | ||
@echo "\t * help - shows short basic help" | ||
@echo "\t * list - this output" | ||
@echo "\t * docker-shell - start docker container with shell inside to work on IronOS with all tools needed" | ||
@echo "\t * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\"" | ||
@echo "\t * docker-clean - delete created docker container (but not pre-downloaded data for it)" | ||
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file" | ||
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo" | ||
@echo "\t * clean-full - delete files & directories generated by all the targets above " | ||
@echo "" | ||
@echo "NOTES on supported pass-trough targets:" | ||
@echo "\t * main Makefile is located in source/ directory and used to build the firmware itself;" | ||
@echo "\t * this top-level Makefile supports to call targets from source/Makefile;" | ||
@echo "\t * if you set up development environment right on your host, then to build firmware locally, you can just type right from here:" | ||
@echo | ||
@echo "\t> make firmware-LANG_ID model=MODEL_ID" | ||
@echo | ||
@echo "Full list of current supported IDs:" | ||
@echo "\t * LANG_ID: BE BG CS DA DE EL EN ES FI FR HR HU IT JA_JP LT NB NL_BE NL PL PT RO RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW" | ||
@echo "\t * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60" | ||
@echo | ||
@echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:" | ||
@echo "\n\t> make firmware-EN model=TS100" | ||
@echo | ||
|
||
# bash one-liner to generate langs for "make list": | ||
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`" | ||
|
||
# former start_dev.sh | ||
docker-shell: $(DOCKER_DEPS) | ||
$(DOCKER_CMD) | ||
|
||
# former build.sh | ||
docker-build: $(DOCKER_DEPS) | ||
$(DOCKER_CMD) /bin/bash /build/ci/buildAll.sh | ||
|
||
# delete container | ||
docker-clean: | ||
-docker rmi ironos-builder:latest | ||
|
||
# generate docs in site/ directory (DIR for -d is relative to mkdocs.yml file location, hence use default name/location site by setting up ../site) | ||
docs: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/* | ||
$(MKDOCS) build -f $(MKDOCS_YML) -d ../site | ||
|
||
# deploy docs to gh-pages branch of current repo automagically using ReadTheDocs framework | ||
docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/* | ||
$(MKDOCS) gh-deploy -f $(MKDOCS_YML) -d ../site | ||
|
||
# pass-through target for Makefile inside source/ dir | ||
%: | ||
make -C source/ $@ | ||
|
||
# global clean-up target | ||
clean-full: docker-clean | ||
make -C source/ clean-all | ||
rm -Rf site | ||
rm -Rf scripts/ci/artefacts | ||
|
||
.PHONY: docker-shell docker-build docker-clean docs clean-full | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env bash | ||
|
||
# little helper for docker deployment to: | ||
# - start development environment for IronOS ("shell" sub-command) | ||
# - generate full set of builds ("build" sub-command) | ||
|
||
#set -x | ||
#set -e | ||
|
||
usage() | ||
{ | ||
echo -e "\nUsage: ${0} [CMD]\n" | ||
echo "CMD:" | ||
echo -e "\tshell - start docker container with shell inside to work on IronOS with all tools needed" | ||
echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware" | ||
echo -e "\tclean - delete created docker container (but not pre-downloaded data for it)\n" | ||
echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n" | ||
} | ||
|
||
### main | ||
|
||
docker_conf="Env.yml" | ||
|
||
# allow providing custom path to docker tool using DOCKER_BIN external env. var. | ||
# (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh) | ||
|
||
if [ -z "${DOCKER_BIN}" ]; then | ||
docker_bin="" | ||
else | ||
docker_bin="${DOCKER_BIN}" | ||
fi; | ||
|
||
# detect availability of docker | ||
|
||
docker_compose="$(command -v docker-compose)" | ||
if [ -n "${docker_compose}" ] && [ -z "${docker_bin}" ]; then | ||
docker_bin="${docker_compose}" | ||
fi; | ||
|
||
docker_tool="$(command -v docker)" | ||
if [ -n "${docker_tool}" ] && [ -z "${docker_bin}" ]; then | ||
docker_bin="${docker_tool} compose" | ||
fi; | ||
|
||
if [ -z "${docker_bin}" ]; then | ||
echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again." | ||
exit 1 | ||
fi; | ||
|
||
# construct command to run | ||
|
||
cmd="${1}" | ||
if [ -z "${cmd}" ] || [ "${cmd}" = "shell" ]; then | ||
docker_cmd="run --rm builder" | ||
elif [ "${cmd}" = "build" ]; then | ||
docker_cmd="run --rm builder /bin/bash /build/ci/buildAll.sh" | ||
elif [ "${cmd}" = "clean" ]; then | ||
docker rmi ironos-builder:latest | ||
exit "${?}" | ||
else | ||
usage | ||
exit 1 | ||
fi; | ||
|
||
# get absolute location of project root dir to make docker happy with config(s) | ||
# (successfully tested on relatively POSIX-compliant Dash shell) | ||
|
||
# this script | ||
script_file="/deploy.sh" | ||
# IronOS/scripts/deploy.sh | ||
script_path="${PWD}"/"${0}" | ||
# IronOS/scripts/ | ||
script_dir=${script_path%"${script_file}"} | ||
# IronOS/ | ||
root_dir="${script_dir}/.." | ||
# IronOS/Env.yml | ||
docker_file="-f ${root_dir}/${docker_conf}" | ||
|
||
# change dir to project root dir & run constructed command | ||
|
||
cd "${root_dir}" || exit 1 | ||
echo -e "\n====>>>> Firing up & starting container..." | ||
if [ "${cmd}" = "shell" ]; then | ||
echo -e "\t* type \"exit\" to end the session when done;" | ||
fi; | ||
echo -e "\t* type \"${0} clean\" to delete created container (but not cached data)" | ||
echo -e "\n====>>>> ${docker_bin} ${docker_file} ${docker_cmd}\n" | ||
eval "${docker_bin} ${docker_file} ${docker_cmd}" | ||
exit "${?}" | ||
|
File renamed without changes.
This file was deleted.
Oops, something went wrong.