-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Detecting the platform | ||
OS=$(uname -s) | ||
|
||
# Check for UPX | ||
UPX_DIR="" | ||
if [ "$OS" == "Linux" ] || [ "$OS" == "Darwin" ]; then | ||
UPX_DIR=$(command -v upx) | ||
elif [ "$OS" == "MINGW64_NT-10.0" ]; then | ||
UPX_DIR=$(where.exe upx) | ||
fi | ||
|
||
if [ -z "$UPX_DIR" ]; then | ||
echo "UPX is not installed or not found in the PATH." | ||
echo "Please install UPX for better compression or remove '--upx-dir' option." | ||
exit 1 | ||
fi | ||
|
||
# Set icon file based on platform | ||
ICON_FILE="" | ||
if [ "$OS" == "MINGW64_NT-10.0" ]; then | ||
ICON_FILE="icon.ico" | ||
else | ||
ICON_FILE="icon.png" | ||
fi | ||
|
||
# Set script file | ||
SCRIPT_FILE="onefile.py" | ||
|
||
# Run PyInstaller | ||
pyinstaller --windowed --icon "$ICON_FILE" --name RayCast --upx-dir "$UPX_DIR" --clean --add-data "$ICON_FILE:." --noconfirm "$SCRIPT_FILE" | ||
exit_code=$? | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
echo "PyInstaller failed to compile the script. Please make sure it is installed." | ||
exit 1 | ||
fi | ||
|
||
echo "Compilation successful." | ||
exit 0 |