← Back to index

patches/ports/port.sh downloads, patches and installs a package into the sysroot. Run it in the configured cross-toolchain environment:

(cd patches/ports && bash port.sh libpng/1.6.34)

A recipe lives at patches/ports/NAME/VERSION/package.sh, with an optional patch.diff. It defines the archive location, extracted directory and two functions:

REMOTE_ARCHIVE="https://example.org/example-1.0.tar.gz"
ARCHIVE="example-1.0.tar.gz"
UNPACKED_DIR="example-1.0"

port_unpack() {
    tar -xf "$ARCHIVE"
}

port_install() {
    ../"$UNPACKED_DIR"/configure --host="$TARGET" --prefix="$PREFIX"
    make
    make DESTDIR="$SYSROOT" install
}

port_unpack runs in the package’s download directory. port_install normally runs in a separate build directory; set REQUIRES_INSTALL_IN_SOURCE_DIR=1 for packages that require an in-source build. The script applies patch.diff before installation and writes compiler output to ghost-build.log.