This commit is contained in:
Your Name 2025-04-29 20:52:17 +12:00
parent c1f961b96b
commit 11e50eae8c

View File

@ -7,6 +7,10 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Get current user's UID and GID
USER_ID=$(id -u)
GROUP_ID=$(id -g)
# Create output directory if it doesn't exist # Create output directory if it doesn't exist
mkdir -p output mkdir -p output
@ -17,26 +21,24 @@ if ! docker image inspect dropshell-builder:latest >/dev/null 2>&1; then
fi fi
# Build x86_64 executable # Build x86_64 executable
docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c ' docker run --rm -v "$(pwd)/..:/src" -u root dropshell-builder:latest bash -c '
rm -rf build && \ rm -rf build && \
mkdir -p build && \ mkdir -p build && \
cd build && \ cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \ cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && \ make && \
cp dropshell ../packages/output/dropshell-x86_64 cp dropshell ../packages/output/dropshell-x86_64 && \
chown '"$USER_ID:$GROUP_ID"' ../packages/output/dropshell-x86_64
' '
# Build arm64 executable # Build arm64 executable
docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c ' docker run --rm -v "$(pwd)/..:/src" -u root dropshell-builder:latest bash -c '
rm -rf build && \ rm -rf build && \
mkdir -p build && \ mkdir -p build && \
cd build && \ cd build && \
cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ cmake -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DCMAKE_BUILD_TYPE=Release .. && \ -DCMAKE_BUILD_TYPE=Release .. && \
make && \ make && \
cp dropshell ../packages/output/dropshell-arm64 cp dropshell ../packages/output/dropshell-arm64 && \
chown '"$USER_ID:$GROUP_ID"' ../packages/output/dropshell-arm64
' '
# Change ownership to current user
chown $(id -u):$(id -g) output/dropshell-*