fix: prioritize pre-built engine binary and handle non-Debian systems
This commit is contained in:
@ -231,41 +231,59 @@ chown "$REAL_USER:$REAL_USER" "$REAL_HOME/mpvj/backend/.env"
|
|||||||
chmod 600 "$REAL_HOME/mpvj/backend/.env"
|
chmod 600 "$REAL_HOME/mpvj/backend/.env"
|
||||||
|
|
||||||
# 4.5 Install ofxPiMapper Engine
|
# 4.5 Install ofxPiMapper Engine
|
||||||
echo "Installing OpenFrameworks and ofxPiMapper (This will take ~1 hour)..."
|
echo "Installing ofxPiMapper Engine..."
|
||||||
cd "$REAL_HOME"
|
|
||||||
if [ ! -d "openFrameworks" ]; then
|
# 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
|
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
|
cd openFrameworks/scripts/linux/debian
|
||||||
./install_dependencies.sh -y > /dev/null 2>&1
|
./install_dependencies.sh -y
|
||||||
cd ../../../
|
cd ../../../
|
||||||
cd scripts/linux/debian
|
cd scripts/linux/debian
|
||||||
./install_codecs.sh > /dev/null 2>&1
|
./install_codecs.sh
|
||||||
cd ../../../
|
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
|
||||||
fi
|
else
|
||||||
|
echo "WARNING: Non-Debian system detected. Please install OpenFrameworks dependencies manually."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$REAL_HOME/openFrameworks/addons"
|
cd "$REAL_HOME/openFrameworks/addons"
|
||||||
if [ ! -d "ofxPiMapper" ]; then
|
[ ! -d "ofxPiMapper" ] && sudo -u "$REAL_USER" git clone https://github.com/kr15h/ofxPiMapper.git
|
||||||
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
|
||||||
sudo -u "$REAL_USER" git clone https://github.com/vanderlin/ofxOfelia.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build Example with Highlight Patch
|
# Patch and Build
|
||||||
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper"
|
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper"
|
||||||
if [ -f src/Osc/OscControl.cpp ]; then
|
if [ -f src/Osc/OscControl.cpp ] && ! grep -q "highlight" src/Osc/OscControl.cpp; then
|
||||||
echo "Applying highlight surface OSC listener modification..."
|
echo "Applying highlight patch..."
|
||||||
sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/i \
|
sed -i '/if (m.getAddress() == "\/ofxPiMapper\/surface\/select"){/i \
|
||||||
if (m.getAddress() == "/ofxPiMapper/surface/highlight"){ \
|
if (m.getAddress() == "/ofxPiMapper/surface/highlight"){ \
|
||||||
int surfaceIndex = m.getArgAsInt32(0); \
|
int surfaceIndex = m.getArgAsInt32(0); \
|
||||||
mapper->getSurfaceManager()->selectSurface(surfaceIndex); \
|
mapper->getSurfaceManager()->selectSurface(surfaceIndex); \
|
||||||
return; \
|
return; \
|
||||||
}' src/Osc/OscControl.cpp
|
}' src/Osc/OscControl.cpp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example-basic"
|
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
|
cp bin/example-basic /usr/local/bin/ofxPiMapper
|
||||||
chmod +x /usr/local/bin/ofxPiMapper
|
chmod +x /usr/local/bin/ofxPiMapper
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# 5. FINALIZATION
|
# 5. FINALIZATION
|
||||||
echo "Finalizing..."
|
echo "Finalizing..."
|
||||||
|
|||||||
Reference in New Issue
Block a user