forked from extern/Unexpected-Keyboard
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.
This commit is contained in:
parent
ab4c73f9f3
commit
39952f8bdf
17
.github/workflows/make-apk.yml
vendored
17
.github/workflows/make-apk.yml
vendored
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
19
Makefile
19
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
|
||||
|
@ -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")
|
||||
|
BIN
srcs/special_font/result.ttf
Normal file
BIN
srcs/special_font/result.ttf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user