Compare commits

...

3 Commits

Author SHA1 Message Date
1c213ed8da
Comments 2022-11-18 23:34:12 -08:00
065ab5b166
Fixed weird characters 2022-11-18 23:33:26 -08:00
7082172bc4
Reworked build system 2022-11-18 23:33:15 -08:00
10 changed files with 23 additions and 123 deletions

4
.gitignore vendored
View File

@ -1,5 +1,3 @@
/venv
/build
qmk/qmk.conf
output
secrets.h

10
.gitmodules vendored
View File

@ -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

View File

@ -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

View File

@ -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.

13
build.sh Executable file
View File

@ -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

View File

@ -10,15 +10,17 @@
// Values that should not be saved to git.
// Create a `secrets.h` in the keymap directory.
//
// It should define the following:
// SECRET_EMAIL
// It should contain the following:
// #define SECRET_EMAIL "val"
// #define SECRET_GMAIL "val"
// #define SECRET_SCHOOL_EMAIL "val"
#include "secrets.h"
// Send a special character.
// Returns false if character was caught, true otherwise.
bool send_special_character(uint16_t keycode) {
if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTОM) ) {
if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTOM) ) {
hid_send_special_char(keycode - M_SPECIAL_TOP - 1);
return false;
}
@ -123,4 +125,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
}

View File

@ -55,5 +55,5 @@ enum custom_keycodes {
M_SC_BYUS,
M_SC_YAE,
M_SC_SHRUG,
M_SPECIAL_BOTTОM
M_SPECIAL_BOTTOM
};

2
qmk.sh
View File

@ -1,2 +0,0 @@
#!/bin/bash
qmk --config-file qmk/qmk.conf "$@"

@ -1 +0,0 @@
Subproject commit 7cb41c2daa0e90ced9bbb25e46df810aded78d9c

@ -1 +0,0 @@
Subproject commit 2106acc24a5c223a5429ea5413bd78f6f0ad038c