Haxe bindings for koreader
修订版 | 00b33b96752bb00d06ab2ce4c77eba2a20fb6789 (tree) |
---|---|
时间 | 2022-03-02 06:31:20 |
作者 | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fast...> |
Commiter | Jaime Marquínez Ferrándiz |
Setup build of lua libraries required by haxe
@@ -3,4 +3,7 @@ | ||
3 | 3 | |
4 | 4 | # Documentation |
5 | 5 | pages/ |
6 | -docs/doc.xml | |
\ No newline at end of file | ||
6 | +docs/doc.xml | |
7 | + | |
8 | +# Generated libraries | |
9 | +lualibs/output | |
\ No newline at end of file |
@@ -3,4 +3,8 @@ | ||
3 | 3 | |
4 | 4 | Haxe definitions for the [Koreader LUA api](http://koreader.rocks/doc/index.html). |
5 | 5 | |
6 | -The project is released to the public domain under the Unlicense license. See LICENSE.txt. | |
\ No newline at end of file | ||
6 | +The project is released to the public domain under the Unlicense license. See LICENSE.txt. | |
7 | + | |
8 | +# Dependencies | |
9 | + | |
10 | +The lua code generated by haxe may requires some libraries (see https://haxe.org/manual/target-lua-getting-started.html ). A [Earthfile](https://earthly.dev/) is provided in the `lualibs` directory, to generate the libraries for the supported targets run `earthly +build-all`. | |
\ No newline at end of file |
@@ -0,0 +1,33 @@ | ||
1 | +build-all: | |
2 | + BUILD +build \ | |
3 | + --target=kobo \ | |
4 | + --target=kindle | |
5 | + | |
6 | +build: | |
7 | + ARG --required target | |
8 | + BUILD +build-allluarocks --target=$target | |
9 | + | |
10 | +base-env: | |
11 | + ARG --required target | |
12 | + FROM koreader/ko"$target":0.2.2 | |
13 | + GIT CLONE https://github.com/koreader/koxtoolchain.git koxtoolchain | |
14 | + COPY build_luarocks_cross.sh . | |
15 | + | |
16 | +build-allluarocks: | |
17 | + ARG --required target | |
18 | + BUILD +build-luarock --target=$target \ | |
19 | + --rock=luautf8 \ | |
20 | + --rock=environ \ | |
21 | + --rock=luv \ | |
22 | + --rock=lrexlib-pcre | |
23 | + | |
24 | +build-luarock: | |
25 | + ARG --required target | |
26 | + ARG --required rock | |
27 | + FROM +base-env --target=$target | |
28 | + RUN echo Building on "$target" rock "$rock" | |
29 | + RUN ./build_luarocks_cross.sh "$target" "$rock" | |
30 | + SAVE ARTIFACT local/lib/lua/*/* AS LOCAL output/"$target"/ | |
31 | + IF [ "${rock}" = lrexlib-pcre ] | |
32 | + SAVE ARTIFACT local/lib/libpcre* AS LOCAL output/"$target"/ | |
33 | + END |
@@ -0,0 +1,30 @@ | ||
1 | +#!/bin/bash | |
2 | +DEVICE=$1 | |
3 | +ROCK=$2 | |
4 | + | |
5 | +echo "Building ${ROCK} for ${DEVICE}" | |
6 | + | |
7 | +source ~/.profile | |
8 | + | |
9 | +source koxtoolchain/refs/x-compile.sh "${DEVICE}" env | |
10 | +set -ex | |
11 | + | |
12 | +export CC="${CROSS_PREFIX}cc" | |
13 | +export CXX="${CROSS_PREFIX}c++" | |
14 | +export CFLAGS="${CFLAGS}" | |
15 | +export LD="${CROSS_PREFIX}ld" | |
16 | + | |
17 | +if [ "${ROCK}" = "lrexlib-pcre" ] | |
18 | +then | |
19 | + echo "building pcre" | |
20 | + export CFLAGS="${CFLAGS} -fPIC" | |
21 | + export LD="${CC}" | |
22 | + curl https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz/download -L -o pcre.tar.gz | |
23 | + tar --extract -z -f pcre.tar.gz | |
24 | + pushd pcre-8.45 | |
25 | + cmake . -DCMAKE_INSTALL_PREFIX=~/local -DPCRE_SUPPORT_UTF=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON | |
26 | + make install -j8 | |
27 | + popd | |
28 | +fi | |
29 | + | |
30 | +luarocks build "$ROCK" CC="${CC}" CFLAGS="${CFLAGS}" LD="${LD}" CROSS_TC="${CROSS_TC}" RANLIB="${RANLIB}" AR="${AR}" CHOST="${CHOST}" PCRE_DIR=~/local |