diff --git a/INSTALL_OFRASP.md b/INSTALL_OFRASP.md new file mode 100644 index 00000000000..7fedfa34aa3 --- /dev/null +++ b/INSTALL_OFRASP.md @@ -0,0 +1,76 @@ +# Install ofRasp from GitHub + +Short guide to clone this fork and get a **buildable** tree. For stock openFrameworks see **[INSTALL_FROM_GITHUB.md](INSTALL_FROM_GITHUB.md)**. + +--- + +## Before you start + +- Use a path **without spaces** (many scripts assume that). +- You need **Git** and **Bash** (Git Bash on Windows, or MSYS2 / WSL / Terminal on Unix). + +--- + +## 1. Clone + +Default branch is **`ofrasp`**. + +**HTTPS** (no SSH key): + +```bash +git clone https://github.com/ofrasp/openFrameworks.git +cd openFrameworks +``` + +**SSH**: + +```bash +git clone git@github.com:ofrasp/openFrameworks.git +cd openFrameworks +``` + +Confirm branch: + +```bash +git branch --show-current # expect: ofrasp +``` + +To work from **development** checkout: + +```bash +git checkout ofrasp-dev +``` + +--- + +## 2. One-shot install (openFrameworks + ofRasp) + +From the **openFrameworks repo root**, in **Bash** (Git Bash, MSYS2, Linux, macOS): + +```bash +bash ./scripts/install_ofrasp_from_git.sh +``` + +--- + +## 3. Build something + +- Follow your platform’s usual OF workflow: **Makefile**, **Visual Studio**, or **Xcode**, as in **[download / setup](https://openframeworks.cc/download/)**. +- Examples that ship **`build.bat`** / **`build.sh`** can be built from their folder (see comments in those scripts). +- **CMake / CLion:** if you use **ofxCMake**, see **[docs/CMAKE_OFRASP.md](docs/CMAKE_OFRASP.md)** — set **`OF_ROOT`** to this ofRasp repo, run the same deps/spine steps, then configure **per app**. + +ofRasp aims to rely on **package managers** and small scripts instead of apothecary / Project Generator for day-to-day use; PG is still valid if you prefer it. + +--- + +## 6. Stay in sync with upstream openFrameworks + +```bash +git remote add upstream https://github.com/openframeworks/openFrameworks.git # once +git fetch upstream +git merge upstream/master # or rebase, per your workflow +``` + +Resolve conflicts, then re-run **`install_ofrasp_from_git.sh`** (or at least **`install_ofrasp_spine.sh`**) if addon scripts or forks changed. + +--- diff --git a/README.md b/README.md index 4961160465e..60d7caaedf0 100644 --- a/README.md +++ b/README.md @@ -1,87 +1,28 @@ -[openFrameworks](http://openframeworks.cc/) -================ +# ofRasp -openFrameworks is a C++ toolkit for creative coding. If you are new to OF, welcome! +*openFrameworks with Edit mode. Pi-native. Web-native.* -- [Grab the Nightly Release (to avoid submodule cloning)](https://github.com/openframeworks/openFrameworks/releases) -- [Setup guides for different Platforms](https://openframeworks.cc/download/) -- [Join Our Slack](https://join.slack.com/t/openframeworks/shared_invite/zt-1r2brqms0-dZMMFZgZhFTgomjJ0vlCjA) -- [Discuss on the Forum](https://forum.openframeworks.cc) -- [Follow OF on Mastodon](https://fosstodon.org/@openframeworks) +This repo is a distribution of [openFrameworks](https://openframeworks.cc/) aimed at **always-on Edit mode**, **Raspberry Pi**, and the **web**. The toolkit is still openFrameworks: `ofApp`, `ofMain.h`, and the addon ecosystem behave the same way. -## Build status +**→ [More Info, pillars, non-goals, and status](docs/OF_RASP.md)** +**→ [Install from GitHub](INSTALL_OFRASP.md)** (clone, deps, spine, build) +**→ [CMake + ofxCMake](docs/CMAKE_OFRASP.md)** (optional) -* The **master** branch contains the newest, most recently updated code. This code is packaged and available for download in the "Nightly Builds" section of [openframeworks.cc/download](https://openframeworks.cc/download/). -* The **stable** branch contains the code corresponding to the last stable openFrameworks release. This stable code is packaged and available for download at [openframeworks.cc/download](https://openframeworks.cc/download/). +## Quick start -Platform | Master branch | Stable branch ------------------------------|:---------|:--------- -Windows MSYS2 | [![Build status](https://github.com/openframeworks/openFrameworks/workflows/build-msys2/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![Build status](https://github.com/openframeworks/openFrameworks/workflows/build-msys2/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) -Windows Visual Studio | [![Build status](https://github.com/openframeworks/openFrameworks/workflows/build-vs/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![Build status](https://github.com/openframeworks/openFrameworks/workflows/build-vs/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) -Linux 64 & Arm | [![Linux Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-linux64-and-arm/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![Linux Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-linux64-and-arm/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) -Emscripten | [![Emscripten Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-emscripten/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![Emscripten Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-emscripten/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) -macos | [![macos Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-macos/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![macos Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-macos/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) -iOS & tvOS | [![iOS tvOS Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-ios-tvos/badge.svg)](https://github.com/openframeworks/openFrameworks/actions) | [![iOS tvOS Build Status](https://github.com/openframeworks/openFrameworks/workflows/build-ios-tvos/badge.svg?branch=stable)](https://github.com/openframeworks/openFrameworks/actions) +1. Clone the repository. The **default branch is `ofrasp`** use ofrasp-dev for development. You can still switch to **stock openFrameworks** in this fork with `git checkout master` (branch name may differ; use `git branch -a`). - +2. **One-shot from git:** from the repo root run + `bash ./scripts/install_ofrasp_from_git.sh` + **OR** run those pieces yourself (e.g. **[INSTALL_FROM_GITHUB.md](INSTALL_FROM_GITHUB.md)** for **`download_libs`**, then **`install_ofrasp_deps.sh`**, then **`install_ofrasp_spine.sh`**). +3. Build sketches as the usual. More context: **[docs/OF_RASP.md](docs/OF_RASP.md)**. -## folder structure +## Contributing -This release of OF comes with several folders: +Contributing conventions in this tree still follow **[CONTRIBUTING.md](CONTRIBUTING.md)** where they apply; ofRasp-specific work is discussed on **this fork’s** issues and PRs. -* addons -* apps -* docs -* examples -* export (on some systems) -* libs -* other -* scripts -* projectGenerator +## License - -`docs` has some documentation around OF usage, per platform things to consider, etc. You should definitely take a look in there; for example, if you are on OSX, read the osx.md. `apps` and `examples` are where projects go -- `examples` contains a variety of projects that show you how to use OF, and `apps` is where your own projects will go. `libs` contains the libraries that OF uses, including the openframeworks core itself. `addons` are for additional functionality that's not part of the core. `export` is for DLLs and dylibs that need to be put in each compiled project. The `scripts` folder has the templates and small scripts for automating OF per platform. `project generator` is a GUI based tool for making new projects - this folder is only there in packaged releases. - -One idea that's important is that OF releases are designed to be self-contained. You can put them anywhere on your hard drive, but it's not possible to mix different releases of OF together, so please keep each release (0.8.0, 0.8.1) separate. Projects may generally work from release to release, but this is not guaranteed. Because OF is self-contained, there's extensive use of local file paths (ie, ../../../) throughout OF. It's important to be aware of how directories are structured. A common error is to take a project and move it so that it's a level below or above where it used to be compared to the root of OF. This means that links such as ../../../libs will break. - -## Get involved - -The openframeworks forum: - -[http://forum.openframeworks.cc/](http://forum.openframeworks.cc/) - -is a warm and friendly place. Please ask or answer a question. The most important part of this project is that it's a community, more than just a tool, so please join us! Also, this is free software, and we learn so much about what is hard, what doesn't make sense, what is useful, etc. The most basic questions are acceptable here! Don't worry, just join the conversation. Learning in OF is social, it's hard to do it alone, but together we can get far! - -Our GitHub site is active: - -[https://github.com/openframeworks/openFrameworks](https://github.com/openframeworks/openFrameworks) - -if you have bugs or feature requests, consider opening an issue. If you are a developer and want to help, pull requests are warmly welcome. Please read the contributing guide for guidelines: - -[https://github.com/openframeworks/openFrameworks/blob/master/CONTRIBUTING.md](https://github.com/openframeworks/openFrameworks/blob/master/CONTRIBUTING.md -) - -We also have a developer's mailing list, which is useful for discussing issues around the development and future of OF. - -## Developers - -To grab a copy of openFrameworks for your platform, check the [download page](http://openframeworks.cc/download) on the main site. - -If you are working with the Git repository, the `stable` branch of the OF repository corresponds to the most recent release, with a few important differences: - -1. The release includes a simple openFrameworks project generator. -2. This GitHub repository contains code and libs for all the platforms, but the releases are done on a per-platform basis. -3. This GitHub repository has no project files for the different examples. They are generated automatically for each release using a tool in `apps/projectGenerator/`. -4. There are no external dependencies in this repository, you can download them using the download_libs.sh script for each platform in the particular platform folder inside scripts. - -If you want to work with the openFrameworks GitHub repository, you need to download the external dependencies and you should use the project generator to create project files for all the code in `examples/`. To generate the project files with the project generator enable the 'Advanced Options' in the settings tab, then use 'Update Multiple' to update the projects for the `examples/` folder path in the repo. - -To set up the project generator submodule within the OF repo, use the command `git submodule init` then `git submodule update` whilst inside the openFrameworks repo. - -For more info on working with the Project Generator, for per-platform readmes, and more information, see the [documentation](docs/table_of_contents.md). - -## Versioning - -openFrameworks uses [Semantic Versioning](http://semver.org/), although strict adherence will only come into effect at version 1.0.0. +MIT — see **[LICENSE.md](LICENSE.md)** (same as upstream openFrameworks). diff --git a/docs/OF_RASP.md b/docs/OF_RASP.md new file mode 100644 index 00000000000..5df8a17d0bf --- /dev/null +++ b/docs/OF_RASP.md @@ -0,0 +1,61 @@ +# ofRasp + +*openFrameworks with Edit mode. Pi-native. Web-native.* + +> A long-running branch of [openFrameworks](http://openframeworks.cc) that prioritizes always-on editing. + +## What is this? + +ofRasp **is openFrameworks.** Your sketches compile unchanged — `ofApp`, `ofMain.h`, every `ofx`* addon still works the same way. + +## Edit mode + +Every sketch ships with always-on editor. While your sketch is running, hit `Ctrl-E` to see: + + - **Nodes** panel listing every entity in the scene + - **Properties** panel to scrub any `ofParameter`, position, color, radius, or other reflected field + - **Viewport** gizmo for direct manipulation + - **Toolbar** with your app name and menu hooks + +Hit `Ctrl-E` again and the editor disappears — your sketch is a clean render again, frame-perfect, zero overhead. +It's what Unity calls Play/Edit, what Max/MSP calls locked/unlocked. + +## The three pillars + +### 1. Edit mode + +The reflection plumbing that powers ofRasp is an ECS called EnTT. The intent is that *every* future OF-style sketch shipped on ofRasp is editable by its author (or viewer) without writing a line of GUI code. Human Altering. + +ofRasp's reflection layer is built on EnTT, an ECS framework. The intent is that *every* sketch run through ofRasp should be editable by its author—or its viewer—without writing a single line of GUI code. We call this Human Editable. + +### 2. Pi-native + +Upstream OF's Raspberry Pi support has drifted. ofRasp tries to keep Pi as a first-class target: GLES3 renderer maintained, headless-friendly build paths, reproducible one-command setup on a fresh Raspberry Pi OS install. Pi is the smallest full-stack Edit-mode machine we can ship, and embedded systems with limited memory tend to run better on 32-bit than 64-bit. + +### 3. Web-native + +Export to web should be easy. ofrasp.com itself runs as an ofRasp sketch, compiled to the browser via Emscripten. + +## Relationship to upstream openFrameworks + +We send fixes that make sense upstream back as PRs. ofRasp-specific changes (Edit mode core, build system, ImGui-in-core) stay on this branch. However most of it will be in seperate addons. + +If you want stock openFrameworks: `git checkout master`. If you want ofRasp: `git checkout ofrasp` + +## Status + +Early. Interface is unstable — in particular, the exact API for how Edit mode plugs into a sketch is still in flux. The compatibility promise for upstream OF code is stable. + +## License + +MIT, same as upstream openFrameworks. See [LICENSE.md](../LICENSE.md). + +## Contact + +- **Website:** [ofrasp.com](https://ofrasp.com) +- **Upstream:** [openframeworks.cc](http://openframeworks.cc) — everything OF's forum/Slack/docs say is still true here. +- **Issues / discussion:** on this fork's GitHub repo. + +--- + +*ofRasp is an unofficial fork. Not affiliated with or endorsed by the openFrameworks project. openFrameworks is the work of many people over many years; ofRasp stands on their shoulders.* diff --git a/scripts/install_ofrasp_deps.sh b/scripts/install_ofrasp_deps.sh new file mode 100644 index 00000000000..b9995d13f0f --- /dev/null +++ b/scripts/install_ofrasp_deps.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# ----------------------------------------------------------------------------- +# install_ofrasp_deps.sh +# +# Platform-aware ofRasp dependency helper (openFrameworks repo root). +# +# Windows (MSYS2 UCRT64): full pacman install for OF +# macOS / Linux: prints upstream OF install pointers +# +# ofRasp addon sources (ofxFft, ofxLibTess2, ImGui, EnTT, …) come from +# ./scripts/install_ofrasp_spine.sh — run that after this script, or use +# ./scripts/install_ofrasp_from_git.sh for the full chain. +# +# Usage (always from openFrameworks repo root): +# ./scripts/install_ofrasp_deps.sh +# ./scripts/install_ofrasp_deps.sh --fixups-only # runs install_ofrasp_spine.sh only (legacy name) +# +# ----------------------------------------------------------------------------- + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +OF_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +export OF_ROOT + +FIXUPS_ONLY=0 +if [[ "${1:-}" == "--fixups-only" ]] || [[ "${1:-}" == "-F" ]]; then + FIXUPS_ONLY=1 +fi + +if [[ "${FIXUPS_ONLY}" -eq 1 ]]; then + echo "=== --fixups-only: running ./scripts/install_ofrasp_spine.sh (ofRasp addons) ===" + bash "${SCRIPT_DIR}/install_ofrasp_spine.sh" + exit 0 +fi + +uname_s="$(uname -s 2>/dev/null || echo unknown)" + +# MSYS2 / MinGW: full installer lives next to this file +case "${uname_s}" in + MINGW* | MSYS* | CYGWIN*) + if [[ -n "${MINGW_PACKAGE_PREFIX:-}" ]] && [[ -n "${MINGW_PREFIX:-}" ]]; then + exec "${SCRIPT_DIR}/msys2/install_ofrasp_deps.sh" + fi + echo "NOTE: MSYS2 UCRT64 shell not detected (MINGW_* unset)." >&2 + echo " For full Windows deps, open 'MSYS2 UCRT64' and run:" >&2 + echo " ${SCRIPT_DIR}/msys2/install_ofrasp_deps.sh" >&2 + echo "=== Next: ./scripts/install_ofrasp_spine.sh (ofxFft, ofxLibTess2, …) ===" >&2 + exit 0 + ;; +esac + +case "${uname_s}" in + Darwin) + echo "=== macOS ===" + echo "Install Xcode Command Line Tools (xcode-select --install) and follow:" + echo " https://openframeworks.cc/download/" + echo "Use OF’s macOS project templates / download_libs.sh as documented upstream." + echo + echo "=== Next: ./scripts/install_ofrasp_spine.sh (ofxFft, ofxLibTess2, …) ===" + ;; + Linux) + echo "=== Linux (includes Raspberry Pi OS) ===" + echo "Install openFrameworks system packages for your distro (same as upstream OF), e.g.:" + if command -v apt-get >/dev/null 2>&1; then + echo " sudo ${SCRIPT_DIR}/linux/debian/install_dependencies.sh" + echo " # or: sudo ${SCRIPT_DIR}/linux/ubuntu/install_dependencies.sh" + elif command -v dnf >/dev/null 2>&1; then + echo " sudo ${SCRIPT_DIR}/linux/fedora/install_dependencies.sh" + elif command -v pacman >/dev/null 2>&1 && [[ -f /etc/arch-release ]]; then + echo " ${SCRIPT_DIR}/linux/archlinux/install_dependencies.sh (see script for sudo)" + else + echo " See scripts/linux// in this repo." + fi + echo + echo "=== Next: ./scripts/install_ofrasp_spine.sh (ofxFft, ofxLibTess2, …) ===" + ;; + *) + echo "=== Unknown OS: ${uname_s} ===" >&2 + echo "Install OF system deps manually, then:" >&2 + echo " ./scripts/install_ofrasp_spine.sh" >&2 + ;; +esac diff --git a/scripts/install_ofrasp_from_git.sh b/scripts/install_ofrasp_from_git.sh new file mode 100644 index 00000000000..26bb11a021b --- /dev/null +++ b/scripts/install_ofrasp_from_git.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash +# ----------------------------------------------------------------------------- +# install_ofrasp_from_git.sh +# +# One-shot setup after cloning the ofRasp openFrameworks repo: +# 1) git submodule update --init --recursive (Project Generator, apothecary, …) +# 2) scripts/dev/download_libs.sh (prebuilt libs/ for this platform) +# 3) install_ofrasp_deps.sh — MSYS2: pacman; others: OS package hints +# 4) install_ofrasp_spine.sh — ofRasp addon forks (ofxFft, ofxLibTess2, …) +# +# Skip core OF steps (only ofRasp layer): --ofrasp-layer-only +# Fine-grained skips: --no-submodules --no-download-libs +# +# Usage (openFrameworks repo root): +# ./scripts/install_ofrasp_from_git.sh +# ./scripts/install_ofrasp_from_git.sh --ofrasp-layer-only +# ./scripts/install_ofrasp_from_git.sh --fixups-only +# ./scripts/install_ofrasp_from_git.sh --no-spine +# ./scripts/install_ofrasp_from_git.sh --spine-only [--full] +# +# Extra args for download_libs.sh (platform override, etc.): +# OFRASP_DOWNLOAD_LIBS_ARGS='-p osx' ./scripts/install_ofrasp_from_git.sh +# +# Alias: ./scripts/bootstrap_ofrasp.sh +# ----------------------------------------------------------------------------- + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +OF_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +cd "${OF_ROOT}" + +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then + cat <<'EOF' +Usage: ./scripts/install_ofrasp_from_git.sh [options] + + (default) Submodules + download_libs + ofRasp deps + spine + --ofrasp-layer-only Only steps 3–4 (deps + spine); skip submodules + download_libs + --no-submodules Skip git submodule update + --no-download-libs Skip scripts/dev/download_libs.sh + --fixups-only Runs install_ofrasp_spine only via install_ofrasp_deps (skips duplicate spine step) + --no-spine Skip install_ofrasp_spine.sh + --spine-only Only install_ofrasp_spine.sh (extra args forwarded, e.g. --full) + +download_libs extras: set OFRASP_DOWNLOAD_LIBS_ARGS before running, e.g. + OFRASP_DOWNLOAD_LIBS_ARGS='-p linux64' ./scripts/install_ofrasp_from_git.sh + +Requires: bash, git. download_libs expects curl/wget tools per upstream OF. +See INSTALL_OFRASP.md and INSTALL_FROM_GITHUB.md. + +Same as: ./scripts/bootstrap_ofrasp.sh +EOF + exit 0 +fi + +if [[ "${1:-}" == "--spine-only" ]]; then + shift + exec bash "${SCRIPT_DIR}/install_ofrasp_spine.sh" "$@" +fi + +DO_SUBMODULES=1 +DO_DOWNLOAD_LIBS=1 +DEPS_ARGS=() +DO_SPINE=1 + +while [[ $# -gt 0 ]]; do + case "$1" in + --ofrasp-layer-only) + DO_SUBMODULES=0 + DO_DOWNLOAD_LIBS=0 + shift + ;; + --no-submodules) + DO_SUBMODULES=0 + shift + ;; + --no-download-libs) + DO_DOWNLOAD_LIBS=0 + shift + ;; + --fixups-only | -F) + DEPS_ARGS+=(--fixups-only) + DO_SPINE=0 + shift + ;; + --no-spine) + DO_SPINE=0 + shift + ;; + *) + echo "Unknown option: $1 (try --help)" >&2 + exit 1 + ;; + esac +done + +if [[ "${DO_SUBMODULES}" -eq 1 ]]; then + echo "=== openFrameworks: git submodules (init + update) ===" + git -C "${OF_ROOT}" submodule update --init --recursive + echo +fi + +if [[ "${DO_DOWNLOAD_LIBS}" -eq 1 ]]; then + echo "=== openFrameworks: download_libs (prebuilt libs/) ===" + # shellcheck disable=SC2086 + bash "${OF_ROOT}/scripts/dev/download_libs.sh" ${OFRASP_DOWNLOAD_LIBS_ARGS:-} + echo +fi + +echo "=== ofRasp: install_ofrasp_deps.sh ===" +bash "${SCRIPT_DIR}/install_ofrasp_deps.sh" "${DEPS_ARGS[@]}" + +if [[ "${DO_SPINE}" -eq 1 ]]; then + echo + echo "=== ofRasp: spine addons ===" + bash "${SCRIPT_DIR}/install_ofrasp_spine.sh" +fi + +echo +echo "=== install_ofrasp_from_git finished ===" +echo "Next: platform packages if any are still missing (see INSTALL_OFRASP.md), then build" +echo " with Makefile / VS / Xcode, or per-app CMake — docs/CMAKE_OFRASP.md" diff --git a/scripts/install_ofrasp_spine.sh b/scripts/install_ofrasp_spine.sh new file mode 100644 index 00000000000..65ba47baa20 --- /dev/null +++ b/scripts/install_ofrasp_spine.sh @@ -0,0 +1,133 @@ +#!/usr/bin/env bash +# ----------------------------------------------------------------------------- +# install_ofrasp_spine.sh +# +# Clone or update the ofRasp "spine" addons into /addons. +# Default remote: https://github.com/ofrasp/.git +# +# Requires: git, bash +# Works from: MSYS2 UCRT64, Linux, macOS, WSL (anywhere git works). +# +# Usage (from openFrameworks repo root): +# ./scripts/install_ofrasp_spine.sh +# ./scripts/install_ofrasp_spine.sh --full # full clone (no --depth) +# +# Override org or URLs: +# OFRASP_ORG=myfork ./scripts/install_ofrasp_spine.sh +# OFRASP_GIT_BASE=https://github.com/ofrasp ./scripts/install_ofrasp_spine.sh +# +# Add or remove repos by editing SPINE_REPOS below. +# ----------------------------------------------------------------------------- + +set -euo pipefail + +OF_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +ADDONS_DIR="${OF_ROOT}/addons" +ORG="${OFRASP_ORG:-ofrasp}" +GIT_BASE="${OFRASP_GIT_BASE:-https://github.com/${ORG}}" +DEPTH_ARG=(--depth 1) +DO_PULL=1 + +usage() { + cat <<'EOF' +Usage: ./scripts/install_ofrasp_spine.sh [--full] [--no-pull] + + --full Full clone (omit --depth 1) + --no-pull Skip git pull on existing clones + +Environment: + OFRASP_ORG GitHub org or user (default: ofrasp) + OFRASP_GIT_BASE e.g. https://github.com/ofrasp (overrides org-based URL) + +Edit SPINE_REPOS in this script to add spine addons. +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + -h | --help) + usage + exit 0 + ;; + --full) + DEPTH_ARG=() + shift + ;; + --no-pull) + DO_PULL=0 + shift + ;; + *) + echo "Unknown option: $1 (try --help)" >&2 + exit 1 + ;; + esac +done + +# GitHub repo name = folder name under addons/ (OF convention). +SPINE_REPOS=( + ofxCMake + ofxEnTT + ofxEnTTKit + ofxFft + ofxImGui + ofxLibTess2 +) + +if [[ ${#DEPTH_ARG[@]} -eq 0 ]]; then + depth_note="full clone (no --depth)" +else + depth_note="${DEPTH_ARG[*]}" +fi + +echo "=== ofRasp spine addons ===" +echo " OF_ROOT = ${OF_ROOT}" +echo " ADDONS_DIR = ${ADDONS_DIR}" +echo " GIT_BASE = ${GIT_BASE}" +echo " depth = ${depth_note}" +echo + +mkdir -p "${ADDONS_DIR}" + +for repo in "${SPINE_REPOS[@]}"; do + dest="${ADDONS_DIR}/${repo}" + url="${GIT_BASE}/${repo}.git" + + if [[ -d "${dest}/.git" ]]; then + if [[ "${DO_PULL}" -eq 1 ]]; then + echo ">>> ${repo}: existing clone — updating (ff-only)" + git -C "${dest}" fetch --tags --prune origin + head_branch="$(git -C "${dest}" rev-parse --abbrev-ref HEAD)" + git -C "${dest}" pull --ff-only origin "${head_branch}" || { + echo " WARN: ff-only pull failed for ${repo}; resolve manually in ${dest}" >&2 + } + else + echo ">>> ${repo}: existing clone — skipped (--no-pull)" + fi + continue + fi + + # Vendored copy shipped in the ofRasp tree (or a manual checkout): do not clone over it. + if [[ "${repo}" == "ofxLibTess2" ]] && [[ -d "${dest}/libtess2/Source" ]]; then + echo ">>> ${repo}: vendored in-tree (libtess2 present), skip clone" + continue + fi + + # Old skeleton without sources: move aside so we can clone the git addon. + if [[ "${repo}" == "ofxLibTess2" ]] && [[ -d "${dest}" ]] && [[ ! -d "${dest}/.git" ]]; then + backup="${dest}.pre_spine_$(date +%s)" + echo ">>> ${repo}: moving non-git folder aside -> ${backup}" + mv "${dest}" "${backup}" + fi + + if [[ -e "${dest}" ]]; then + echo "ERROR: ${dest} exists but is not a git repo; move it aside or remove it." >&2 + exit 1 + fi + + echo ">>> ${repo}: cloning ${url}" + git clone "${DEPTH_ARG[@]}" "${url}" "${dest}" +done + +echo +echo "=== Done. Spine addons are under: ${ADDONS_DIR} ===" diff --git a/scripts/msys2/install_ofrasp_deps.sh b/scripts/msys2/install_ofrasp_deps.sh new file mode 100644 index 00000000000..fde6d66d837 --- /dev/null +++ b/scripts/msys2/install_ofrasp_deps.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# ----------------------------------------------------------------------------- +# install_ofrasp_deps.sh (MSYS2 / MinGW entry) +# +# Full pacman install for Windows MSYS2 UCRT64. Normally invoked via: +# ./scripts/install_ofrasp_deps.sh +# which detects MSYS2 and execs this script. +# +# Direct usage (MSYS2 UCRT64 shell only): +# ./scripts/msys2/install_ofrasp_deps.sh +# +# ----------------------------------------------------------------------------- + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +OF_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +export OF_ROOT + +# --- sanity checks ----------------------------------------------------------- + +if [[ -z "${MINGW_PACKAGE_PREFIX:-}" ]]; then + echo "ERROR: \$MINGW_PACKAGE_PREFIX is not set." >&2 + echo " Open the 'MSYS2 UCRT64' shell and re-run (not plain MSYS)." >&2 + exit 1 +fi + +if [[ -z "${MINGW_PREFIX:-}" ]]; then + echo "ERROR: \$MINGW_PREFIX is not set." >&2 + exit 1 +fi + +echo "=== Environment ===" +echo " MSYSTEM = ${MSYSTEM:-?}" +echo " MINGW_PACKAGE_PREFIX = ${MINGW_PACKAGE_PREFIX}" +echo " MINGW_PREFIX = ${MINGW_PREFIX}" +echo + +# --- packages ---------------------------------------------------------------- + +msys_pkgs=( + make + unzip + git +) + +mingw_pkgs=( + gcc + pkgconf + assimp cairo curl freeimage + glew glfw glm fmt zlib brotli libpng + harfbuzz libsndfile libusb libxml2 mpg123 + nlohmann-json openal opencv + pugixml rtaudio uriparser utf8cpp + ntldd-git +) + +full_pkgs=("${msys_pkgs[@]}") +for p in "${mingw_pkgs[@]}"; do + full_pkgs+=("${MINGW_PACKAGE_PREFIX}-${p}") +done + +echo "=== Syncing pacman database ===" +pacman -Sy --noconfirm + +echo +echo "=== Installing ${#full_pkgs[@]} packages (idempotent) ===" +printf ' %s\n' "${full_pkgs[@]}" +echo +pacman -S --noconfirm --needed "${full_pkgs[@]}" + +echo +echo "=== Done. Next: ./scripts/install_ofrasp_spine.sh (ofxFft, ofxLibTess2, …) from repo root. ==="