This has multiple advantages:
* It's tool agnostic (e.g. if we were to drop the ninja symlink
for samu, we wouldn't have to change anything here)
* It allows for more fine grained control, e.g. in meson test,
where we can increase timeouts and print the test log to stdout,
something which we can't control when invoking it via ninja.
* We can pass --no-rebuild to test and install, so ninja doesn't
have to check if anything has to be rebuild against in the test
and install phase, when we built everything in the build phase
already
This is similiar to dd24cdf85f, but
for meson.
With the None build type used nowadays these should be picked up
automatically by the environment. If not, we would also need to pass
CPPFLAGS and LDFLAGS explicitly.
GitHub allows to reference https://github.com/<user>/<proj>/archive/<ver>.tar.gz
also as https://github.com/<user>/<proj>/archive/<ver>/<anything>.tar.gz.
Since the obsolete 'cd "$builddir"' statements have been removed in [1],
build(), check() and package() can generate empty functions if no build
system is specified or if there is no default for the given build
system. newapkbuild will then fail, as it tries to parse the script it
generated:
$ cd /home/pmos && newapkbuild test
/usr/bin/abuild: /home/pmos/test/APKBUILD: line 18: syntax error: unexpected "}"
$ cat test/APKBUILD
...
build() {
}
...
Fix this by placing ":" in functions that would be empty.
[1]: f83d19ce79
Changes:
* argument sanity checks:
* `PKGNAME[-PKGVER] | SRCURL`
* check if missing
* check if specified more than once (see below)
* specifying more than one buildtype flag
* `-n` (set pkgname) without using SRCURL as last argument
* `-s` (sourceforge source) without using PKGNAME as last argument
* Typo fix: exist -> exists
* `usage()`:
* always print PKGNAME and PKGDESC (instead of NAME and DESC,
NAME was used in one place and PKGNAME in another)
* link to <https://spdx.org/licenses/>
* `-m` (meson) flag was missing in short usage line at the top
* indicate that the buildtypes are exclusive
* `-c` flag: remove "to new directory" wording to make the
message shorter (this should be obvious)
* remove empty line at the end
NOTE: Before this commit, the `PKGNAME[-PKGVER] | SRCURL` was allowed
to be specified more than once, and the code looped over the arguments.
But this was not documented in `usage()` and had unexpected results:
```
$ newapkbuild first second third
$ tree
.
___ first
___ APKBUILD
___ first
___ ___ APKBUILD
___ ___ first
___ ___ ___ APKBUILD
___ ___ ___ src
___ ___ src
___ src
```
unpack will no longer unpack without a checksum, even with -f. This
means that newapkbuild will not be able to deduce what kind of build
system is contained within, so the templates for CMake, Perl, etc are
never used.
This patch ensures checksumming is done right after fetch, so that
unpack works properly.
It is documented in the help output but didn't work because getopts(1)
didn't check for that option. I am assuming the person who added cmake
support simply forgot to adjust the getopts line.
If $sdir is not defined find writes an error message to stderr. For
example when running:
newapkbuild -n foo -a foo
You will see a find error message because no source url was provided.
This commit silences any find error message. An alternative solution
would be to not invoke find unless $sdir is set.