İçeriğe geç

Relinking the LGPL libraries

Bu içerik henüz dilinizde mevcut değil.

The Ren'Py engine inside Ren'Go links FFmpeg and fribidi under the LGPL 2.1. This page tells you how to replace them with your own build and make a new Ren'Go app from it. It is the rebuild instruction that the written offer in the app's Acknowledgements screen refers to.

On request, Ren'Go provides the materials needed to relink the work that links FFmpeg and fribidi against a different version of those libraries. The materials are:

  • The object files of the engine frameworks RenGoEngine7 and RenGoEngine8, or the unsigned frameworks RenGoEngine7.framework and RenGoEngine8.framework together with the object files of the app that loads them.
  • The build scripts and the entry source needed to relink: scripts/ios/fetch_ios_deps.sh, scripts/ios/generate_app.sh, the scripts that generate_app.sh calls, scripts/ios/project.yml and ios/engine/rengo_engine_entry.c.
  • The exact FFmpeg and fribidi versions that each engine framework links, and their source. The libraries come from the Ren'Py iOS packages listed below. Both engine frameworks (8.5.3 and 7.8.7) link FFmpeg 4.3.1 (source: https://ffmpeg.org/download.html, tarball ffmpeg-4.3.1.tar.gz) and fribidi 1.0.7 (source: https://github.com/fribidi/fribidi/releases, tarball fribidi-1.0.7.tar.bz2). For the licence texts, see the licences page.

The offer is valid for three years. Send the request to the contact address in the app's Acknowledgements screen: rengo@celikyunusemre.dev. The steps below refer to the materials delivered with the offer, not to any public repository.

Ren'Go embeds two Ren'Py engines. Each engine is one framework that links its own static libraries (.a archives) and exports only its entry symbols (rengo_engine<N>_start, _lifecycle, _uiwindow and _mouse, where <N> is 7 or 8). The linker hides every other symbol, so a replaced library takes effect only when you rebuild the framework.

Engine Ren'Py package Python Framework
8.5.3 renpy-8.5.3-renios 3.12 RenGoEngine8
7.8.7 renpy-7.8.7-renios 2.7 RenGoEngine7

The static libraries come from Ren'Py's public iOS builds. scripts/ios/fetch_ios_deps.sh downloads them from https://www.renpy.org/dl/<version>/renpy-<version>-renios.zip and checks the SHA-256 of each file:

  • renpy-8.5.3-renios.zip: c4fae153e8276ed0faed5e84ea3e0b7c4bf337f0e3208e9130c6a41748a83b2b
  • renpy-7.8.7-renios.zip: faaabec4ec65efa8803a5a7222f6e40183c5fe8354c1ee4eeb78e978826cee86

The LGPL libraries in each package are:

  • FFmpeg: libavcodec.a, libavformat.a, libavfilter.a, libavresample.a, libswscale.a, libswresample.a, libavutil.a
  • fribidi: libfribidi.a

The paths below are paths inside the materials delivered with the offer. Put them in one folder and run the commands from that folder.

  1. Run bash scripts/ios/fetch_ios_deps.sh. It puts each package under vendor/renios-<version>/.

  2. Run bash scripts/ios/generate_app.sh. It unpacks the packages and writes the Xcode project to build/xcode/RenGo/. The libraries for each engine are in prebuilt7/release/ and prebuilt8/release/ (device) and in prebuilt7/debug/ and prebuilt8/debug/ (simulator) in that folder.

  3. Build your replacement for iOS arm64 from the library source, with the same version and the same configuration as the package. Replace the archive in prebuilt<N>/release/, for example libavcodec.a or libfribidi.a. Do not run generate_app.sh again, because it restores the original archives.

  4. Rebuild the project with scripts/ios/project.yml as the specification. The RenGoEngine<N> target links the archives with -lavcodec and -lfribidi among others, and compiles ios/engine/rengo_engine_entry.c (the project copies it to RenGoEngineSources/). Run from build/xcode/RenGo/:

    xcodebuild -project RenGo.xcodeproj -scheme RenGo -configuration Release -destination 'generic/platform=iOS' -derivedDataPath dd build

    If you received the object files and the unsigned frameworks instead of the full folder, link your replacement archives with the object files of RenGoEngine<N> to make a new framework, and put the new framework into the app in place of the old one.

  5. Sign the app with your own certificate and provisioning profile, then install it on your device. Xcode does this when you set your team in the signing settings of every target. Apple's rules allow a modified app to run only on devices that your own profile covers.

  • The replacement must be binary compatible with the original: the same library version, the same public symbols and the same configure options. FFmpeg must keep the codecs that Ren'Py uses.
  • The 7.8.7 and 8.5.3 packages link different library builds. Replace the archive in the folder of the engine that you want to change.