This `pkg.sh` file is for the `which` package (version `2.21`). Let's start by breaking down the
variables:
-`NAME`: Specifies the package name. A package should be named after the software, tool or libary
it provides. Preferably the name should not contain `_` to avoid confusion with naming.
-`DESC`: A short description about the software, tool or the libary that package provides.
Explain what it does, what it contains etc.
-`VERSION`: Version of the software, tool or libary the package provides. If you are using a
git commit version, you can name the version `LAST_VERSION+COMMIT_ID`
-`FILES`: Upstream files and patches needed to build this package, you can use `http`, `https`
or `ftp` protocols.
You can also specify multiple files. These files will be downloaded by `mp-repo` in the build
process.
-`HASHES`: Hashes for the files you specify. You can use `MD5`, `SHA1`, `SHA256` or `SHA512` sums.
And yes, you need to specify hashes for all the files, using the same order with the `FILES` variable.
-`DEPENDS`: Package(s) that this package depends on.
Now let's take a look at the `build` function. Each package needs a `build` function, this
function is called by `mp-repo` after downloading and verifying all the packages. It will be
called in the `$ROOTDIR`. This directory will contain all the downloaded files, any files
in this directory will be included into the build, so don't forget to cleanup.
**Note:** You don't need to cleanup the downloaded files, they will be cleaned by the `mp-repo`.
-`tar xf $NAME-$VERSION.tar.gz`: Extract the downloaded archive file.
-`cd $NAME-$VERSION`: Change directory into the extracted directory.
-`./configure --prefix=/usr && make`: Builds the `which` tool, different packages may have
different build instructions. These instruction are usually provided by the upstream. You can
also check out [LFS](https://www.linuxfromscratch.org/lfs/view/12.0-systemd/) and [BLFS](https://www.linuxfromscratch.org/blfs/view/12.0-systemd/) for instructions.
-`make DESTDIR=$ROOTDIR install`: Install the package. Make sure that you are installing the package
into the `$ROOTDIR` and not the root file system.
-`cd .. && rm -rf $NAME-$VERSION`: Change directory back into `$ROOTDIR` and clean the extracted archive.