mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 02:17:39 +00:00
Dockerfile overhaul (#1726)
Create entrypoint to orchestrate the build steps Supported commands: make, ninja Passes additional arguments to the make / ninja command at the end (like -jNN) There is a shortcut to make -jNN by just specifying -jNN Anything else will be directly executed (like getting a shell into the container with bash -li is still possible)
This commit is contained in:
34
firmware/tools/docker-entrypoint.sh
Executable file
34
firmware/tools/docker-entrypoint.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # exit immediatelly on any failure
|
||||
|
||||
build_make() {
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake ..
|
||||
make "$@"
|
||||
exit 0 # Report success :)
|
||||
}
|
||||
|
||||
build_ninja() {
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -G Ninja ..
|
||||
ninja "$@"
|
||||
exit 0 # Report success :)
|
||||
}
|
||||
|
||||
if [ "$1" = 'make' ]; then # build the default (or specified) target with make
|
||||
shift # remove the first item from $@ as we consumed it, we can then pass the rest on to make
|
||||
build_make "$@"
|
||||
elif [[ $1 == -j* ]]; then # allow passing -j without typing make_default
|
||||
# dont shift here as we wanna pass the -j
|
||||
build_make "$@"
|
||||
elif [ "$1" = 'ninja' ]; then # build the default (or specified) target with ninja
|
||||
shift # remove the first item from $@ as we consumed it, we can then pass the rest on to make
|
||||
build_ninja "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
Reference in New Issue
Block a user