-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
76 lines (63 loc) · 1.64 KB
/
install.sh
File metadata and controls
76 lines (63 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Light Sampler LV2 plugin build and install script
set -e
PLUGIN_URI="<urn:simdott:light_sampler>"
PLUGIN_NAME="light_sampler"
BUILD_DIR="build"
# Detect installation type based on sudo
if [ "$(id -u)" -eq 0 ]; then
# Running as root (with sudo)
INSTALL_DIR="/usr/lib/lv2/${PLUGIN_NAME}.lv2"
SUDO=""
echo "Installing system-wide (detected sudo)"
else
# Running as normal user
INSTALL_DIR="${HOME}/.lv2/${PLUGIN_NAME}.lv2"
SUDO=""
echo "Installing for current user only"
fi
# Check for LV2 headers
LV2_HEADER_FOUND=0
for path in /usr/include/lv2/lv2.h \
/usr/local/include/lv2/lv2.h \
/usr/include/lv2.h; do
if [ -f "$path" ]; then
LV2_HEADER_FOUND=1
break
fi
done
if [ $LV2_HEADER_FOUND -eq 0 ]; then
if pkg-config --exists lv2; then
LV2_HEADER_FOUND=1
else
echo "Error: LV2 headers not found."
echo "Install lv2-dev (Debian/Ubuntu) or lv2-devel (Fedora)"
exit 1
fi
fi
# Get include flags
if pkg-config --exists lv2; then
LV2_CFLAGS=$(pkg-config --cflags lv2)
else
LV2_CFLAGS="-I/usr/include/lv2"
fi
# Create build directory
mkdir -p $BUILD_DIR
cd $BUILD_DIR
# Compile
echo "Compiling..."
gcc -std=c99 -fPIC -shared -O2 -march=native -o ${PLUGIN_NAME}.so ../${PLUGIN_NAME}.c \
$LV2_CFLAGS \
-lm
cd ..
# Install
echo "Installing to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
cp $BUILD_DIR/${PLUGIN_NAME}.so "$INSTALL_DIR/"
cp ${PLUGIN_NAME}.ttl "$INSTALL_DIR/"
cp manifest.ttl "$INSTALL_DIR/"
# Clean up
echo "Cleaning up..."
rm -rf $BUILD_DIR
rm -f ${PLUGIN_NAME}.so
echo "Done. Plugin installed to: $INSTALL_DIR"