abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2022-04-24 20:52:36 +0200
committerJules Aguillon2022-04-24 20:52:36 +0200
commit39952f8bdf2ee77e32152bf67df456a83e3e03fe (patch)
tree0287109a42d37cb41e55aa456382df7184b513e3
parentab4c73f9f3dda374e0ff60f2eab382612093263e (diff)
downloadunexpected-keyboard-39952f8bdf2ee77e32152bf67df456a83e3e03fe.tar.gz
unexpected-keyboard-39952f8bdf2ee77e32152bf67df456a83e3e03fe.zip
Remove build dependency on Fontforge
The required version of fontforge (from 2020!) is not available in many distros. This is an annoying for contributors and greatly complicated the CI and F-Droid scripts. The generated font file is now included in the sources. Fontforge is still needed when adding new glyphs but this is not a common operation.
-rw-r--r--.github/workflows/make-apk.yml17
-rw-r--r--CONTRIBUTING.md10
-rw-r--r--Makefile19
-rw-r--r--srcs/special_font/build.pe4
-rw-r--r--srcs/special_font/result.ttfbin0 -> 6260 bytes
5 files changed, 16 insertions, 34 deletions
diff --git a/.github/workflows/make-apk.yml b/.github/workflows/make-apk.yml
index 6457576..3f872ba 100644
--- a/.github/workflows/make-apk.yml
+++ b/.github/workflows/make-apk.yml
@@ -9,19 +9,6 @@ jobs:
Build-Apk:
runs-on: ubuntu-latest
steps:
- - name: Cache fontforge and extra dependencies
- uses: actions/cache@v2
- with:
- path: /usr/local/bin
- key: usr-local-bin
- - name: Install latest FontForge version (using AppImage)
- run: |
- # Get most recent version of FontForge
- # Using AppImage there is no dependecy problem, it is the latest version and it's easier to cache
- cd /usr/local/bin
- sudo wget -c -N https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage
- sudo chmod +x ./FontForge-2022-03-08-582bd41-x86_64.AppImage
- sudo ln --symbolic --force /usr/local/bin/FontForge-2022-03-08-582bd41-x86_64.AppImage /usr/local/bin/fontforge
- uses: actions/setup-java@v2
with:
distribution: 'zulu' # See 'Supported distributions' for available options
@@ -36,11 +23,11 @@ jobs:
- name: Restore debug keystore from github Secrets
run: |
mkdir -p _build
- cd "$GITHUB_WORKSPACE/_build"
+ cd "_build"
# Check if exist and use the secret named DEBUG_KEYSTORE
# The contents of the secret can be obtained -
# from the debug.keystore.asc from you local _build folder
- if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" == "" ]]; then
+ if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" = "" ]]; then
echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc"
if [[ -s "debug.keystore.asc" ]]; then
gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bc4b288..4a107b1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -11,9 +11,9 @@ Fortunately, there's not many dependencies:
- OpenJDK 8
- Android SDK: build tools (minimum `28.0.1`), platform `30`
- Make sure to have the `$ANDROID_HOME` environment variable set.
-- FontForge version >= 20201107
-For Nix users, there's a `shell.nix` for setting-up the right environment.
+For Nix users, the right environment can be obtained with `nix-shell ./shell.nix`.
+Instructions to install Nix are [here](https://nixos.wiki/wiki/Nix_Installation_Guide).
Building the debug apk:
@@ -21,11 +21,7 @@ Building the debug apk:
make
```
-If the build succeed, the debug apk is located in
-`_build/juloo.keyboard2.debug.apk`.
-
-If the build doesn't succeeded check the FontForge version, the version needed is 20201107.
-Try to use the nix-shell, instructions to install [here](https://nixos.wiki/wiki/Nix_Installation_Guide)
+If the build succeed, the debug apk is located in `_build/juloo.keyboard2.debug.apk`.
## Using the local debug.keystore on the Github CI actions
diff --git a/Makefile b/Makefile
index a606299..a731a0b 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,10 @@ clean:
rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \
_build/*.idsig _build/assets
-.PHONY: release debug installd clean
+rebuild_special_font:
+ cd srcs/special_font && fontforge -lang=ff -script build.pe *.svg
+
+.PHONY: release debug installd clean rebuild_special_font
$(shell mkdir -p _build)
@@ -85,6 +88,11 @@ _build/%.unaligned-apk: $(addprefix _build/,$(APK_EXTRA_FILES)) $(MANIFEST_FILE)
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES)
+# Copy the special font file into _build because aapt requires relative paths
+_build/assets/special_font.ttf: srcs/special_font/result.ttf
+ mkdir -p $(@D)
+ cp "$<" "$@"
+
# R.java
GEN_DIR = _build/gen
@@ -95,15 +103,6 @@ $(R_FILE): $(RES_FILES) $(MANIFEST_FILE)
$(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(RES_DIR) -J $(GEN_DIR) \
-M $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar
-# Special font
-
-SPECIAL_FONT_GLYPHS = $(wildcard $(CURDIR)/srcs/special_font/*.svg)
-SPECIAL_FONT_SCRIPT = $(CURDIR)/srcs/special_font/build.pe
-
-_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS)
- mkdir -p $(@D)
- fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $(CURDIR)/$@ $(SPECIAL_FONT_GLYPHS)
-
# Compile java classes and build classes.dex
OBJ_DIR = _build/class
diff --git a/srcs/special_font/build.pe b/srcs/special_font/build.pe
index 4e2754d..962917f 100644
--- a/srcs/special_font/build.pe
+++ b/srcs/special_font/build.pe
@@ -3,7 +3,7 @@
New()
# Imports glyphs, file name is position in the font.
-i = 2
+i = 1
while (i < $argc)
Select(Strtol($argv[i]:t:r, 16))
Import($argv[i], 0, 0, 4.0, 0.1)
@@ -11,4 +11,4 @@ while (i < $argc)
i++
endloop
-Generate($1)
+Generate("result.ttf")
diff --git a/srcs/special_font/result.ttf b/srcs/special_font/result.ttf
new file mode 100644
index 0000000..8434a3f
--- /dev/null
+++ b/srcs/special_font/result.ttf
Binary files differ