Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/validate-library-downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:
- run: bash -n scripts/dev/download_libs.sh scripts/dev/downloader.sh scripts/dev/sha_verify.sh
- run: bash scripts/dev/tests/test-download-validation.sh
- run: bash scripts/dev/tests/test-download-vs-switch.sh
- run: bash -n scripts/dev/download_pg.sh scripts/linux/download_projectGenerator.sh scripts/osx/download_projectGenerator.sh scripts/vs/download_projectGenerator.sh scripts/of.sh
- run: python3 scripts/dev/tests/test-download-pg.py
7 changes: 7 additions & 0 deletions docs/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ cd OF/scripts/linux

which will compile the command line version of the project generator and install it in your system so you can create projects from anywhere, it'll also make it possible to use the gui tool which is present in the root of the OF folder.

Prebuilt projectGenerator
------------------------

`of update pg` downloads the GUI and its bundled CLI. On x64, Ubuntu 22.04 and Jammy-based derivatives use `projectGenerator-linux-ubuntu22-gui.gz`; other x64 hosts use `projectGenerator-linux-gui.gz`. ARM64 hosts, including 64-bit Raspberry Pi systems, use `projectGenerator-linux-arm64-gui.gz`.

The GUI is installed at `projectGenerator/projectGenerator` and the CLI at `projectGenerator/projectGeneratorCmd`. The release's `.tar.bz2` archives contain only the standalone CLI and are not needed for this installation. For 32-bit Raspberry Pi targets without prebuilt GUI packages, use `compilePG.sh` to build the CLI.

Linking prebuilt libraries: "recompile with -fPIE"
---------------------------------------------------

Expand Down
176 changes: 80 additions & 96 deletions scripts/dev/download_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cat << EOF
Options:

-v, --version VERSION OF version to download the libraries for. Defaults to master
-p, --platform PLATFORM Platform among: android, emscripten, ios, linux, linux64, linuxarmv6l, linuxarmv7l, msys2, osx, tvos, vs
-p, --platform PLATFORM Platform among: linux, msys2, osx, macos, vs
If not specified tries to autodetect the platform
-s, --silent Silent download progress
-h, --help Shows this message
Expand Down Expand Up @@ -44,26 +44,26 @@ download(){

}

# trap any script errors and exit
trap 'trapError ${LINENO}' ERR
trap "trapError" SIGINT SIGTERM

trapError() {
local parent_lineno="$1"
if [[ "$#" = "3" ]] ; then
local message="$2"
local code="${3:-1}"
echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}"
else
local code="${2:-1}"
echo "Error on or near line ${parent_lineno}; exiting with status ${code}"
linuxPGVariant() (
local ID="" VERSION_ID="" VERSION_CODENAME="" UBUNTU_CODENAME=""
local root="${OF_PG_PROBE_ROOT:-}"
[[ -r "$root/etc/os-release" ]] || return 0
. "$root/etc/os-release"
if [[ "$UBUNTU_CODENAME" == "jammy" || "$VERSION_CODENAME" == "jammy" || ( "$ID" == "ubuntu" && "$VERSION_ID" == 22.04* ) ]]; then
printf '%s' '-ubuntu22'
fi
)

if [ -e openFrameworksLibs* ]; then
echo "removing packages"
rm openFrameworksLibs*
fi
exit "${code}"
trap 'trapError "$LINENO" "$?"' ERR
trap 'trapError "$LINENO" 130' SIGINT
trap 'trapError "$LINENO" 143' SIGTERM

trapError() {
local parent_lineno="${1:-unknown}"
local code="${2:-1}"
trap - ERR SIGINT SIGTERM
echo "Error on or near line ${parent_lineno}; exiting with status ${code}" >&2
exit "$code"
}


Expand Down Expand Up @@ -161,86 +161,70 @@ cd "$SCRIPT_DIR"

OUTDIR=../../

ZIP="zip"
if [[ $BLEEDING_EDGE = 1 ]] ; then
VER=latest
fi

if [[ $TAG != "" ]] ; then
VER="$TAG"
fi

if [ "$PLATFORM" == "linux" ]; then
ZIP="tar.bz2"
fi
if [ "$PLATFORM" == "vs" ]; then
EXT=".exe"
else
EXT=".app"
fi

OUTPUT=projectGenerator
if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then
GUI="-gui"
else
GUI=""
fi
PKG="projectGenerator-${PLATFORM}${GUI}.${ZIP}"
echo " openFrameworks download_pg.sh"
case "$PLATFORM" in
linux)
case "$ARCH" in
x86_64|amd64|64) PKG="projectGenerator-linux$(linuxPGVariant)-gui.gz" ;;
aarch64|arm64) PKG="projectGenerator-linux-arm64-gui.gz" ;;
*) echo "No Linux projectGenerator GUI release for architecture: $ARCH" >&2; exit 1 ;;
esac
;;
vs|msys2) PKG="projectGenerator-vs-gui.zip" ;;
osx|macos) PKG="projectGenerator-osx.zip" ;;
*) echo "Unsupported projectGenerator platform: $PLATFORM" >&2; exit 1 ;;
esac

echo " openFrameworks download_pg.sh"
cd ../../
mkdir -p libs
cd libs

mkdir -p download
cd download

download $PKG

if [ -d "${OUTDIR}/${OUTPUT}" ] || [ -f "${OUTDIR}/${OUTPUT}" ]; then
rm -rf "${OUTDIR}/${OUTPUT}"
fi

echo " Uncompressing Project Generator for [$PLATFORM] from [$PKG] to [${OUTDIR}/${OUTPUT}]"
if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then
unzip -q "$PKG" -d "${OUTDIR}/${OUTPUT}"
#rm $PKG
else
mkdir -p "${OUTDIR}${OUTPUT}"
tar xjf "$PKG" -C "${OUTDIR}${OUTPUT}"
if [ "$PLATFORM" == "osx" ]; then
mv "${OUTDIR}/${OUTPUT}/projectGenerator-osx/projectGenerator$EXT" "${OUTDIR}/${OUTPUT}/projectGenerator$EXT"
rm -rf "${OUTDIR}/${OUTPUT}/projectGenerator-osx/"
fi
fi
mkdir -p libs/download
cd libs/download

download "$PKG"

PG_STAGE=$(mktemp -d "${OUTDIR}/${OUTPUT}.XXXXXX")
trap 'rm -rf "$PG_STAGE"' EXIT
echo " Uncompressing Project Generator for [$PLATFORM] from [$PKG]"
case "$PLATFORM" in
linux)
tar -xzf "$PKG" --strip-components=1 -C "$PG_STAGE"
RESOURCES="$PG_STAGE/resources"
GUI_BIN="$PG_STAGE/projectGenerator"
CLI_NAME=projectGenerator
CLI_DEST="$PG_STAGE/projectGeneratorCmd"
;;
vs|msys2)
unzip -q "$PKG" -d "$PG_STAGE"
RESOURCES="$PG_STAGE/resources"
GUI_BIN="$PG_STAGE/projectGenerator.exe"
CLI_NAME=projectGenerator.exe
CLI_DEST="$PG_STAGE/projectGeneratorCmd.exe"
;;
osx|macos)
unzip -q "$PKG" -d "$PG_STAGE"
if [ -d "$PG_STAGE/projectGenerator-osx/projectGenerator.app" ]; then
mv "$PG_STAGE/projectGenerator-osx/projectGenerator.app" "$PG_STAGE/projectGenerator.app"
rm -rf "$PG_STAGE/projectGenerator-osx"
fi
RESOURCES="$PG_STAGE/projectGenerator.app/Contents/Resources"
GUI_BIN="$PG_STAGE/projectGenerator.app/Contents/MacOS/projectGenerator"
CLI_NAME=projectGenerator
CLI_DEST="$PG_STAGE/projectGenerator"
;;
esac

if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then
if ! command -v rsync &> /dev/null; then
cp -ar "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe" "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe"
else
rsync -avzp "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe" "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe"
fi
# if command -v chmod &> /dev/null; then
chmod +x "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe"
chmod +x "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe"
# else
# echo "Warning: chmod command not found, skipping permission adjustment."
# fi
elif [ "$PLATFORM" == "linux" ]; then
chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator"
else
if ! command -v rsync &> /dev/null; then
cp -arX "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/Resources/app/app/projectGenerator" "${OUTDIR}/${OUTPUT}/projectGenerator"
else
rsync -avzp "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/Resources/app/app/projectGenerator" "${OUTDIR}/${OUTPUT}/projectGenerator"
fi
# if command -v chmod &> /dev/null; then
chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator"
chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/MacOS/projectGenerator"
# else
# echo "Warning: chmod command not found, skipping permission adjustment."
# fi
CLI=""
for candidate in \
"$RESOURCES/app.asar.unpacked/app/$CLI_NAME" \
"$RESOURCES/app/app/$CLI_NAME"; do
if [ -f "$candidate" ]; then CLI="$candidate"; break; fi
done
if [[ ! -f "$GUI_BIN" || -z "$CLI" ]]; then
echo "ProjectGenerator package for $PLATFORM is missing the GUI or bundled CLI" >&2
exit 1
fi

echo " ------ "
cp "$CLI" "$CLI_DEST"
chmod +x "$GUI_BIN" "$CLI_DEST" "$CLI"
rm -rf "${OUTDIR}/${OUTPUT}"
mv "$PG_STAGE" "${OUTDIR}/${OUTPUT}"
echo " openFrameworks download projectGenerator and install complete!"
Loading
Loading