fix: prioritize pre-built engine binary and handle non-Debian systems

This commit is contained in:
Timothy Hofland
2026-03-11 09:10:48 +01:00
parent 99755cff26
commit 1bcfabeb98

View File

@ -231,29 +231,45 @@ chown "$REAL_USER:$REAL_USER" "$REAL_HOME/mpvj/backend/.env"
chmod 600 "$REAL_HOME/mpvj/backend/.env"
# 4.5 Install ofxPiMapper Engine
echo "Installing OpenFrameworks and ofxPiMapper (This will take ~1 hour)..."
echo "Installing ofxPiMapper Engine..."
# Priority 1: Check for pre-built binary in the repo
if [ -f "$REAL_HOME/mpvj/bin/ofxPiMapper" ]; then
echo "Pre-built ofxPiMapper binary detected in repo. Installing..."
cp "$REAL_HOME/mpvj/bin/ofxPiMapper" /usr/local/bin/ofxPiMapper
chmod +x /usr/local/bin/ofxPiMapper
echo "ofxPiMapper installed successfully (Binary)."
else
# Priority 2: Build from source (Fall-back)
if [ -f "/usr/local/bin/ofxPiMapper" ]; then
echo "ofxPiMapper already installed in /usr/local/bin. Skipping build."
else
echo "No pre-built binary found. Falling back to source build (This takes ~1 hour)..."
cd "$REAL_HOME"
if [ ! -d "openFrameworks" ]; then
sudo -u "$REAL_USER" git clone --depth 1 --branch master https://github.com/openframeworks/openFrameworks.git
# Only run apt-get if we are on a Debian-based system
if command -v apt-get > /dev/null; then
cd openFrameworks/scripts/linux/debian
./install_dependencies.sh -y > /dev/null 2>&1
./install_dependencies.sh -y
cd ../../../
cd scripts/linux/debian
./install_codecs.sh > /dev/null 2>&1
./install_codecs.sh
cd ../../../
sudo -u "$REAL_USER" make -j1 -C libs/openFrameworksCompiled/project/linux64 > /dev/null 2>&1
sudo -u "$REAL_USER" make -j1 -C libs/openFrameworksCompiled/project/linux64
else
echo "WARNING: Non-Debian system detected. Please install OpenFrameworks dependencies manually."
fi
fi
cd "$REAL_HOME/openFrameworks/addons"
if [ ! -d "ofxPiMapper" ]; then
sudo -u "$REAL_USER" git clone https://github.com/kr15h/ofxPiMapper.git
sudo -u "$REAL_USER" git clone https://github.com/vanderlin/ofxOfelia.git
fi
[ ! -d "ofxPiMapper" ] && sudo -u "$REAL_USER" git clone https://github.com/kr15h/ofxPiMapper.git
[ ! -d "ofxOfelia" ] && sudo -u "$REAL_USER" git clone https://github.com/vanderlin/ofxOfelia.git
# Build Example with Highlight Patch
# Patch and Build
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper"
if [ -f src/Osc/OscControl.cpp ]; then
echo "Applying highlight surface OSC listener modification..."
if [ -f src/Osc/OscControl.cpp ] && ! grep -q "highlight" src/Osc/OscControl.cpp; then
echo "Applying highlight patch..."
sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/i \
if (m.getAddress() == "/ofxPiMapper/surface/highlight"){ \
int surfaceIndex = m.getArgAsInt32(0); \
@ -263,9 +279,11 @@ if [ -f src/Osc/OscControl.cpp ]; then
fi
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example-basic"
sudo -u "$REAL_USER" make -j1 > /dev/null 2>&1
sudo -u "$REAL_USER" make -j1
cp bin/example-basic /usr/local/bin/ofxPiMapper
chmod +x /usr/local/bin/ofxPiMapper
fi
fi
# 5. FINALIZATION
echo "Finalizing..."