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:
|
Build-Apk:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
@ -36,11 +23,11 @@ jobs:
|
|||||||
- name: Restore debug keystore from github Secrets
|
- name: Restore debug keystore from github Secrets
|
||||||
run: |
|
run: |
|
||||||
mkdir -p _build
|
mkdir -p _build
|
||||||
cd "$GITHUB_WORKSPACE/_build"
|
cd "_build"
|
||||||
# Check if exist and use the secret named DEBUG_KEYSTORE
|
# Check if exist and use the secret named DEBUG_KEYSTORE
|
||||||
# The contents of the secret can be obtained -
|
# The contents of the secret can be obtained -
|
||||||
# from the debug.keystore.asc from you local _build folder
|
# 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"
|
echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc"
|
||||||
if [[ -s "debug.keystore.asc" ]]; then
|
if [[ -s "debug.keystore.asc" ]]; then
|
||||||
gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore"
|
gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore"
|
||||||
|
@ -11,9 +11,9 @@ Fortunately, there's not many dependencies:
|
|||||||
- OpenJDK 8
|
- OpenJDK 8
|
||||||
- Android SDK: build tools (minimum `28.0.1`), platform `30`
|
- Android SDK: build tools (minimum `28.0.1`), platform `30`
|
||||||
- Make sure to have the `$ANDROID_HOME` environment variable set.
|
- 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:
|
Building the debug apk:
|
||||||
|
|
||||||
@ -21,11 +21,7 @@ Building the debug apk:
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
If the build succeed, the debug apk is located in
|
If the build succeed, the debug apk is located in `_build/juloo.keyboard2.debug.apk`.
|
||||||
`_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)
|
|
||||||
|
|
||||||
## Using the local debug.keystore on the Github CI actions
|
## 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 \
|
rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \
|
||||||
_build/*.idsig _build/assets
|
_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)
|
$(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)
|
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
|
||||||
cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES)
|
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
|
# R.java
|
||||||
|
|
||||||
GEN_DIR = _build/gen
|
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) \
|
$(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(RES_DIR) -J $(GEN_DIR) \
|
||||||
-M $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar
|
-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
|
# Compile java classes and build classes.dex
|
||||||
|
|
||||||
OBJ_DIR = _build/class
|
OBJ_DIR = _build/class
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
New()
|
New()
|
||||||
|
|
||||||
# Imports glyphs, file name is position in the font.
|
# Imports glyphs, file name is position in the font.
|
||||||
i = 2
|
i = 1
|
||||||
while (i < $argc)
|
while (i < $argc)
|
||||||
Select(Strtol($argv[i]:t:r, 16))
|
Select(Strtol($argv[i]:t:r, 16))
|
||||||
Import($argv[i], 0, 0, 4.0, 0.1)
|
Import($argv[i], 0, 0, 4.0, 0.1)
|
||||||
@ -11,4 +11,4 @@ while (i < $argc)
|
|||||||
i++
|
i++
|
||||||
endloop
|
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