- Fork the repository
- Create a feature branch from
develop - Make your changes
- Run syntax checks:
for f in lib/*.sh recipes/**/*.sh; do sh -n "$f"; done - Test a full build:
./mediaforge.sh build --enable-nonfree - Submit a pull request targeting
develop
All code must be POSIX sh — no Bashisms.
[ "$var" = value ]not[[ ]]command -vnotwhichprintfnotecho(where output matters)- No arrays, no
local, no+=, no=~, no process substitution - Prefix local-scope variables with
_(e.g.,_pkg,_ver) sed ... > tmp && mv tmp orignotsed -i- Prefer
awkoversedfor field-based edits - Use
patch -p1for complex multi-line source fixes (store inpatches/)
- Create
recipes/<category>/<name>.sh:
PKG_NAME="mylib"
PKG_VERSION="${PKG_VERSION_MYLIB:-1.0.0}"
PKG_URL="https://example.com/mylib-${PKG_VERSION}.tar.gz"
PKG_FFMPEG_OPT="--enable-mylib"
# Override phases as needed
pkg_configure() {
run ./configure --prefix="$PREFIX" --disable-shared --enable-static
}- Add the recipe path to
recipes/_order.conf(respecting dependency order) - Add a version pin to each profile in
profiles/ffmpeg-*.conf:PKG_VERSION_MYLIB="1.0.0" - Test:
./mediaforge.sh build
| Variable | Required | Description |
|---|---|---|
PKG_NAME |
Yes | Package identifier |
PKG_VERSION |
Yes | Version string (use ${PKG_VERSION_NAME:-default} for profile support) |
PKG_URL |
Yes* | Download URL (*not required if PKG_SKIP_EXTRACT=true) |
PKG_FFMPEG_OPT |
No | FFmpeg configure flag to accumulate |
PKG_GPL |
No | Set true to require --enable-gpl |
PKG_NONFREE |
No | Set true to require --enable-nonfree |
PKG_CMAKE |
No | Set true to use cmake instead of autoconf |
PKG_CMAKE_FLAGS |
No | Extra cmake flags |
PKG_CONFIGURE_FLAGS |
No | Extra configure flags |
PKG_REQUIRES_CMD |
No | Space-separated list of required commands |
PKG_REQUIRES_MESON |
No | Set true to require meson + ninja |
PKG_LINUX_ONLY |
No | Set true to skip on non-Linux |
PKG_SKIP_ON_ARCH |
No | Architecture to skip (e.g., arm64) |
PKG_FILENAME |
No | Override tarball filename |
PKG_DIRNAME |
No | Override extracted directory name |
PKG_SKIP_EXTRACT |
No | Set true for header-only packages |
PKG_GITHUB_REPO |
No | owner/repo for update checking |
Override any subset — unoverridden phases use defaults:
| Phase | Default | Purpose |
|---|---|---|
pkg_prepare() |
no-op | Patches, env setup |
pkg_configure() |
./configure or cmake |
Configure build |
pkg_build() |
make -j $MJOBS |
Compile |
pkg_install() |
make install |
Install to $PREFIX |
pkg_post_install() |
no-op | pkgconfig fixups, extra flags |
For complex multi-line source fixes, use patch files instead of inline sed/awk:
- Extract the clean source tarball
- Copy the target file
- Make your fix
- Generate the patch:
diff -u original fixed > patches/<name>.patch - Apply in
pkg_prepare():patch -p1 < "$SCRIPT_DIR/patches/<name>.patch"
Use conventional commits:
feat:new recipe or featurefix:bug fixrefactor:code change that doesn't add features or fix bugsdocs:documentation onlychore:maintenance (deps, CI, tooling)
main— stable releasesdevelop— integration branchfeature/*— new features (branch fromdevelop)bugfix/*— bug fixes (branch fromdevelop)hotfix/*— production fixes (branch frommain)