Create shell script to conveniently install makedepends for any package
When I want to build something from source on a phone running postmarketOS, I clone the upstream git repository. Next I need to install all makedepends, it would be great if this could be automated, like apt-get build-dep
and similar.
Idea:
- usage:
install-makedepends PKGNAME [[PKGNAME] ...]
- for each PKGNAME
- use apk to figure out from which repository it comes from
- get the APKBUILD
- if it's from alpine, download the APKBUILD from their gitlab or the other git webview:
- if it's from postmarketOS, we don't know which subdir of pmaports holds the APKBUILD (could be in main, or device/testing, or ...).
- Therefore, if using for the first time, clone pmaports.git
- On subsequent runs, do
git fetch
in the cloned repo - find the apkbuild in the appropriate branch (v20.05, v21.03, master)
- subshell: source the APKBUILD, echo $makedepends
- add the result to the total packages to install
- run
sudo apk add $makedepends_from_all_packages
(but with a nicer variable name)
The resulting script should be pretty short, so I'd just put it in pmaports.git main/install-makedepends/install-makedepends.sh
, together with an APKBUILD
.
EDIT: thoughts for an improved version: instead of cloning the git repo for pmaports, let pmaports.git CI upload a mapping from device name to path to gitlab pages. Then let the script download that. But having the other version working first would also be nice, we could improve on it later.
Edited by Administrator