• R/O
  • SSH

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Haxe bindings for koreader


Commit MetaInfo

修订版00b33b96752bb00d06ab2ce4c77eba2a20fb6789 (tree)
时间2022-03-02 06:31:20
作者Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fast...>
CommiterJaime Marquínez Ferrándiz

Log Message

Setup build of lua libraries required by haxe

更改概述

差异

diff -r 1c84635bdb5d -r 00b33b96752b .hgignore
--- a/.hgignore Mon Mar 29 21:01:04 2021 +0200
+++ b/.hgignore Tue Mar 01 22:31:20 2022 +0100
@@ -3,4 +3,7 @@
33
44 # Documentation
55 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
diff -r 1c84635bdb5d -r 00b33b96752b README.md
--- a/README.md Mon Mar 29 21:01:04 2021 +0200
+++ b/README.md Tue Mar 01 22:31:20 2022 +0100
@@ -3,4 +3,8 @@
33
44 Haxe definitions for the [Koreader LUA api](http://koreader.rocks/doc/index.html).
55
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
diff -r 1c84635bdb5d -r 00b33b96752b lualibs/Earthfile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lualibs/Earthfile Tue Mar 01 22:31:20 2022 +0100
@@ -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
diff -r 1c84635bdb5d -r 00b33b96752b lualibs/build_luarocks_cross.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lualibs/build_luarocks_cross.sh Tue Mar 01 22:31:20 2022 +0100
@@ -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