From 7082172bc446118db254041278446b765e742095 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 18 Nov 2022 23:33:15 -0800 Subject: [PATCH] Reworked build system --- .gitignore | 4 +-- .gitmodules | 10 ------- Makefile | 85 ----------------------------------------------------- README.md | 18 ++---------- build.sh | 13 ++++++++ qmk.sh | 2 -- qmk/qmk_cli | 1 - qmk/qmk_fw | 1 - 8 files changed, 16 insertions(+), 118 deletions(-) delete mode 100644 Makefile create mode 100755 build.sh delete mode 100755 qmk.sh delete mode 160000 qmk/qmk_cli delete mode 160000 qmk/qmk_fw diff --git a/.gitignore b/.gitignore index 1e954ea..431cbe6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/venv -/build -qmk/qmk.conf +output secrets.h \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 609b9b7..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +0,0 @@ -[submodule "qmk/qmk_fw"] - path = qmk/qmk_fw - url = ssh://git@git.betalupi.com:33/mirrors-QMK/qmk_firmware.git -[submodule "qmk/qmk_cli"] - path = qmk/qmk_cli - url = ssh://git@git.betalupi.com:33/mirrors-QMK/qmk_cli.git -[submodule "qmk_cli"] - url = ssh://git@git.betalupi.com:33/QMK/qmk_cli.git -[submodule "qmk_fw"] - url = ssh://git@git.betalupi.com:33/QMK/qmk_firmware.git diff --git a/Makefile b/Makefile deleted file mode 100644 index 2f08bf5..0000000 --- a/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -QMK_REPO := ssh://git@git.betalupi.com:33/Mark/qmk_betalupi.git - -# QMK command -QMK_CONF := $(shell pwd)/qmk/qmk.conf -QMK := qmk --config-file $(QMK_CONF) - -# Where to create venv -VENV := $(shell pwd)/venv - -# Where to build firmware -BUILD_DIR := $(shell pwd)/build - -# Path to submodules -QMK_CLI := $(shell pwd)/qmk/qmk_cli -QMK_DIR := $(shell pwd)/qmk/qmk_fw - - -.PHONY: git-submodule -git-submodule: - @git submodule sync --recursive - @git submodule update --init --recursive --progress - @echo "" - - -# Link keyboards into qmk_fw -KEYBOARDS := $(notdir $(shell find keyboards -maxdepth 1 -mindepth 1 -type d)) -.PHONY: $(KEYBOARDS) -$(KEYBOARDS): - @echo "Linking keyboards into $(QMK_DIR)/keyboards..." - @ln -sT \ - $(shell pwd)/keyboards/$@ \ - $(QMK_DIR)/keyboards/$@ - - @echo "" - -# Clone all repos and configure qmk -.PHONY: setup -setup: git-submodule $(KEYBOARDS) - @echo "Preparing venv..." - @python -m venv $(VENV) --prompt=qmk_venv - - @echo "Building and installing qmk_cli" - @source $(VENV)/bin/activate && \ - cd $(QMK_CLI) && \ - python3 -m pip install build --quiet && \ - python3 -m build > /dev/null && \ - python3 -m pip install $$(find dist -name 'qmk-*.tar.gz') --quiet - - @echo "" - @echo "" - - @source $(VENV)/bin/activate && \ - $(QMK) config user.qmk_home=$(QMK_DIR) && \ - $(QMK) doctor - - -# Undo all changes done in setup -.PHONY: unsetup -unsetup: - -rm -drf $(VENV) $(BUILD_DIR) - -rm $(QMK_CONF) - -rm -dr $(QMK_CLI)/dist $(QMK_CLI)/qmk.egg-info - -rm $(KEYBOARDS:%=$(QMK_DIR)/keyboards/%) - - - -# Compile and flash a keyboard -.PHONY: flash -flash: - @source $(VENV)/bin/activate && \ - $(QMK) flash \ - -e AVR_CFLAGS="-Wno-array-bounds" \ - -e BUILD_DIR=$(BUILD_DIR) \ - -kb betalupi_ergodox \ - -km default - - - -# Compile and flash a keyboard -.PHONY: comp-db -comp-db: - @source $(VENV)/bin/activate && \ - $(QMK) generate-compilation-database \ - -kb betalupi_ergodox \ - -km default diff --git a/README.md b/README.md index 42a2b35..49073a5 100644 --- a/README.md +++ b/README.md @@ -13,22 +13,8 @@ This repository contains everything required to build qmk firmware. ------------------------------------------------- -## Setup -To initialize the build environment, run `make setup`. This does a few things: +## Building - - Updates all submodules - - Symlinks all directories in `keyboards` into `qmk/qmk_fm/keyboards` - - Creates a python virtualenv in `venv` - - Builds and installs `qmk/qmk_cli` into that venv - - Creates a QMK config file in `qmk/qmk.conf` - - Runs `qmk doctor` to make sure everything worked. - -Once `make setup` has been run, this directory (or its parents) CANNOT BE RENAMED OR MOVED! -If you want to move this directory, run `make unsetup`, then run `make setup` again. No data should be lost. - - -## Using QMK - -Run `make flash` to build and flash firmware. If you want to execute qmk manually, activate the virtualenv and use `./qmk.sh`. +Run `./build.sh`. Uses docker, doesn't need a local install of qmk. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..7df2aba --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Uses the qmk container found here: +# https://git.betalupi.com/Mark/docker +# +# Be careful, it may not be using the latest QMK. + +docker run -it \ + --user $(id -u):$(id -g) \ + -v "$(pwd)/output:/build_output" \ + -v "$(pwd)/keyboards:/qmk_firmware/keyboards:ro" \ + -e QMK_TARGET="betalupi_ergodox:default" \ + git.betalupi.com/mark/qmk \ No newline at end of file diff --git a/qmk.sh b/qmk.sh deleted file mode 100755 index 245fc43..0000000 --- a/qmk.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -qmk --config-file qmk/qmk.conf "$@" diff --git a/qmk/qmk_cli b/qmk/qmk_cli deleted file mode 160000 index 7cb41c2..0000000 --- a/qmk/qmk_cli +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7cb41c2daa0e90ced9bbb25e46df810aded78d9c diff --git a/qmk/qmk_fw b/qmk/qmk_fw deleted file mode 160000 index 2106acc..0000000 --- a/qmk/qmk_fw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2106acc24a5c223a5429ea5413bd78f6f0ad038c