Skip to content

Commit

Permalink
WIP build for arm64, in qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Jan 9, 2024
1 parent fdf2c52 commit d2943dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
10 changes: 6 additions & 4 deletions build-words-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

set -e

IMAGE=docker.io/ids1024/ada-android:6.4.0
# IMAGE=docker.io/ids1024/ada-android:6.4.0
IMAGE=words-build

podman pull $IMAGE
# podman pull $IMAGE

# Disable seccomp for 'personality' syscall, which is used by bionic (in qemu)
podman run \
--rm \
-it \
-v "$PWD/words:/words" \
-w /words \
-u $(id -u):$(id -g) \
--security-opt seccomp=unconfined \
--arch arm64 \
$IMAGE \
./build-words.sh

Expand All @@ -22,7 +25,6 @@ mv words/words src/main/assets/words
echo "Words built in src/main/assets/words."

rm -rf libs
mkdir -p libs/{armeabi-v7a,arm64-v8a}
cp src/main/assets/words/words libs/armeabi-v7a/libwords.so
mkdir -p libs/arm64-v8a
cp src/main/assets/words/words libs/arm64-v8a/libwords.so
echo "Copied to libs/"
7 changes: 7 additions & 0 deletions words/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# sudo podman run --rm --privileged docker.io/multiarch/qemu-user-static --reset -p yes -c yes
# podman build --arch arm64 --tag words-build .

# Issue with dos2unix version in jammy
FROM ubuntu:mantic
RUN apt-get update && apt-get install -y gnat-12 unzip wget dos2unix

26 changes: 14 additions & 12 deletions words/build-words.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -e

export PATH=$PWD/toolchain/bin:$PATH
TARGET=arm-linux-androideabi
# TARGET=arm-linux-androideabi-
# QEMU=qemu-arm
ANDROID_SYSROOT="$PWD/ndk-chain/sysroot"
BUILD_ARGS="-cargs -fPIE -largs -pie"
STATIC_ARGS="-bargs -static -largs -static"
Expand All @@ -23,25 +24,26 @@ cd words-build
unzip ../wordsall.zip

echo "Fix line endings..."
dos2unix ADDONS.LAT
dos2unix -O ADDONS.LAT > ADDONS.LAT.new
mv ADDONS.LAT.new ADDONS.LAT

echo "Building words..."
$TARGET-gnatmake -O3 words $STATIC_ARGS
$TARGET-gnatmake makedict $STATIC_ARGS
$TARGET-gnatmake makestem $STATIC_ARGS
$TARGET-gnatmake makeefil $STATIC_ARGS
$TARGET-gnatmake makeinfl $STATIC_ARGS
${TARGET}gnatmake -O3 words $STATIC_ARGS
${TARGET}gnatmake makedict $STATIC_ARGS
${TARGET}gnatmake makestem $STATIC_ARGS
${TARGET}gnatmake makeefil $STATIC_ARGS
${TARGET}gnatmake makeinfl $STATIC_ARGS

echo "Building data files in qemu..."
echo G | qemu-arm ./makedict
echo G | qemu-arm ./makestem
echo G | qemu-arm ./makeefil
echo G | qemu-arm ./makeinfl | sed '/\*\*\*\*/d'
echo G | $QEMU ./makedict
echo G | $QEMU ./makestem
echo G | $QEMU ./makeefil
echo G | $QEMU ./makeinfl | sed '/\*\*\*\*/d'

echo "Copying output to 'words'..."
mkdir ../words
cp ADDONS.LAT DICTFILE.GEN EWDSFILE.GEN INDXFILE.GEN INFLECTS.SEC STEMFILE.GEN UNIQUES.LAT words ../WORD.MDV ../words
cd ..

echo "Stripping words..."
$TARGET-strip words/words
${TARGET}strip words/words

0 comments on commit d2943dc

Please sign in to comment.