Class: Libpng::OHOS::Recipe

Inherits:
Recipe
  • Object
show all
Defined in:
lib/libpng/ohos/recipe.rb

Overview

OHOS-specific libpng build recipe. Inherits the standard download/compile/install flow from Libpng::Recipe and layers on:

- NDK discovery + download (idempotent, ~1.5GB cached across runs)
- Static zlib built with the same OHOS toolchain
- CMake flags: -DCMAKE_TOOLCHAIN_FILE=<ohos.toolchain.cmake>
             -DOHOS_ARCH=arm64-v8a -DOHOS_PLATFORM=OHOS
             -DZLIB_LIBRARY=<static libz.a>
- Post-install code signing via OHOS::CodeSigner

The standard recipe already maps aarch64-linux-ohos to the right cpu_type, cmake_system_name, and target_format, so those are not overridden here.

Constant Summary

Constants inherited from Recipe

Recipe::LIBPNG_SHA256, Recipe::LIBPNG_URL, Recipe::ROOT

Instance Method Summary collapse

Methods inherited from Recipe

#checkpoint, #cook_if_not, #execute, for_target, #message, ohos_target?, #verify_libs

Constructor Details

#initializeRecipe

Returns a new instance of Recipe.



22
23
24
25
26
# File 'lib/libpng/ohos/recipe.rb', line 22

def initialize
  super
  @ndk = OHOS::NDK.new(root: ROOT.join('ext/ohos/ndk'))
  @zlib = OHOS::ZlibBuilder.new(ndk: @ndk)
end

Instance Method Details

#configure_defaultsObject



40
41
42
# File 'lib/libpng/ohos/recipe.rb', line 40

def configure_defaults
  super + ohos_toolchain_flags + zlib_flags
end

#cookObject

Ensures NDK is downloaded and static zlib is built before the libpng CMake configure runs. MiniPortile's #cook is idempotent (checks downloaded?/configured?/installed?), so calling @zlib.cook on every libpng cook is cheap when nothing changed.



32
33
34
35
36
37
38
# File 'lib/libpng/ohos/recipe.rb', line 32

def cook
  @ndk.download unless @ndk.exist?
  raise 'OHOS NDK setup failed; see ext/ohos/setup-ndk.sh output' unless @ndk.exist?

  @zlib.cook
  super
end

#installObject



44
45
46
47
# File 'lib/libpng/ohos/recipe.rb', line 44

def install
  super
  each_built_lib { |path| sign_lib(path) }
end