minecraft-pi-reborn/scripts/build.sh

66 lines
1.1 KiB
Bash
Raw Normal View History

2020-09-25 16:43:53 +00:00
#!/bin/sh
set -e
2021-09-17 02:00:40 +00:00
# Build
build() {
# Use Build Dir
if [ ! -d "build/${MODE}-${ARCH}" ]; then
./scripts/setup.sh "${MODE}" "${ARCH}"
2021-06-17 21:32:24 +00:00
fi
cd "build/${MODE}-${ARCH}"
2021-06-24 16:40:34 +00:00
# Create Prefix
local prefix="$(cd ../../; pwd)/out/${MODE}-${ARCH}"
2021-06-24 16:40:34 +00:00
rm -rf "${prefix}"
mkdir -p "${prefix}"
# Build ARM Components
cd arm
make -j$(nproc)
make install DESTDIR="${prefix}"
cd ../
# Build Native Components
cd native
make -j$(nproc)
make install DESTDIR="${prefix}"
cd ../
# Exit
cd ../../
}
2021-06-17 21:32:24 +00:00
# Build For ARM
2021-11-11 03:17:04 +00:00
armhf_build() {
# Use Build Dir
if [ ! -d "build/${MODE}-armhf" ]; then
./scripts/setup.sh "${MODE}" armhf
fi
cd "build/${MODE}-armhf"
2021-06-17 21:32:24 +00:00
# Create Prefix
local prefix="$(cd ../../; pwd)/out/${MODE}-armhf"
2021-06-17 21:32:24 +00:00
rm -rf "${prefix}"
mkdir -p "${prefix}"
# Build All Components
make -j$(nproc)
make install DESTDIR="${prefix}"
# Exit
cd ../../
}
# Variables
MODE="$1"
ARCH="$2"
shift 2
2021-06-17 21:32:24 +00:00
# Build
if [ "${ARCH}" = "armhf" ]; then
armhf_build "${MODE}"
else
build "${MODE}" "${ARCH}"
2021-06-17 21:32:24 +00:00
fi