Skip to content

Commit c9e1b3e

Browse files
committed
Cleanup scripts
1 parent d443bf3 commit c9e1b3e

File tree

3 files changed

+40
-17
lines changed

3 files changed

+40
-17
lines changed

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function Start-Build {
9090
Read-LibsToDest -Source $Build\Release -Destination $Dist -RequiredLibs $RequiredBuildLibs
9191

9292
$RequiredExternalLibs = @("projectM-4.dll")
93-
Read-LibsToDest -Source $Env:PROJECTM_ROOT\lib -Destination $Dist -RequiredLibs $RequiredExternalLibs
93+
Read-LibsToDest -Source $Env:PROJECTM_ROOT\bin -Destination $Dist -RequiredLibs $RequiredExternalLibs
9494
}
9595
else {
9696
Write-Host "Build failed!"

build.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/bin/bash
22
set -e
33

4+
# Set variables based on OS
5+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
6+
LIB_EXT="so"
7+
VIDEO_SINK="xvimagesink"
8+
elif [[ "$OSTYPE" == "darwin"* ]]; then
9+
LIB_EXT="dylib"
10+
VIDEO_SINK="osxvideosink"
11+
else
12+
echo "Unsupported OS!"
13+
exit 1
14+
fi
15+
416
# ------------
517
# FUNCTIONS
618

@@ -52,10 +64,8 @@ build() {
5264
cmake --build "$1" --config "Release" --parallel
5365

5466
# Move to dist
55-
if [ -f "$1/libgstprojectm.so" ] ; then
56-
mv "$1/libgstprojectm.so" "$2"
57-
elif [ -f "$1/libgstprojectm.dylib" ] ; then
58-
mv "$1/libgstprojectm.dylib" "$2"
67+
if [ -f "$1/libgstprojectm.$LIB_EXT" ] ; then
68+
mv "$1/libgstprojectm.$LIB_EXT" "$2"
5969
else
6070
echo "Build failed!"
6171
exit 1
@@ -65,7 +75,7 @@ build() {
6575
# Prompt user to install build
6676
prompt_install() {
6777
# Install to gstreamer plugin, if found
68-
if [ -f "$2/libgstprojectm.so" ] || [ -f "$2/libgstprojectm.dylib" ]; then
78+
if [ -f "$2/libgstprojectm.$LIB_EXT" ]; then
6979
if [ "$1" = false ] ; then
7080
echo
7181
echo -n "Install to gstreamer plugins? (Y/n): "
@@ -79,10 +89,8 @@ prompt_install() {
7989
mkdir -p "$HOME/.local/share/gstreamer-1.0/plugins/"
8090

8191
# Move the file to the destination, overwriting if it exists
82-
if [ -f "$2/libgstprojectm.so" ] ; then
83-
mv "$2/libgstprojectm.so" "$HOME/.local/share/gstreamer-1.0/plugins/"
84-
elif [ -f "$2/libgstprojectm.dylib" ] ; then
85-
mv "$2/libgstprojectm.dylib" "$HOME/.local/share/gstreamer-1.0/plugins/"
92+
if [ -f "$2/libgstprojectm.$LIB_EXT" ] ; then
93+
mv "$2/libgstprojectm.$LIB_EXT" "$HOME/.local/share/gstreamer-1.0/plugins/"
8694
else
8795
echo "Install failed!"
8896
exit 1
@@ -91,11 +99,11 @@ prompt_install() {
9199
# Print example command
92100
echo
93101
echo "Done! Here's an example command:"
94-
echo 'gst-launch-1.0 audiotestsrc ! queue ! audioconvert ! projectm ! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! xvimagesink sync=false'
102+
echo "gst-launch-1.0 audiotestsrc ! queue ! audioconvert ! projectm ! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false"
95103
else
96104
echo
97105
echo "Done!"
98-
echo 'You can install the plugin manually by moving <dist/libgstprojectm.so> to <$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.so>'
106+
echo "You can install the plugin manually by moving <dist/libgstprojectm.$LIB_EXT> to <$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.$LIB_EXT>"
99107
fi
100108
else
101109
echo "Install failed!"

test.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Set variables based on OS
5+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
6+
LIB_EXT="so"
7+
VIDEO_SINK="xvimagesink"
8+
elif [[ "$OSTYPE" == "darwin"* ]]; then
9+
LIB_EXT="dylib"
10+
VIDEO_SINK="osxvideosink"
11+
else
12+
echo "Unsupported OS!"
13+
exit 1
14+
fi
15+
116
# Check if gst-inspect-1.0 is installed
217
if ! command -v gst-inspect-1.0 > /dev/null 2>&1; then
318
echo "gst-inspect-1.0 is not installed. Please install it and try again."
@@ -11,8 +26,8 @@ if ! command -v gst-launch-1.0 > /dev/null 2>&1; then
1126
fi
1227

1328
# Check if plugin is installed
14-
if [ ! -f "$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.so" ] && [ ! -f "$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.dylib" ]; then
15-
echo "libgstprojectm.so is missing. Please install it and try again."
29+
if [ ! -f "$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.$LIB_EXT" ]; then
30+
echo "libgstprojectm.$LIB_EXT is missing. Please install it and try again."
1631
exit 1
1732
fi
1833

@@ -37,14 +52,14 @@ case "$1" in
3752
GST_DEBUG=projectm:5 gst-launch-1.0 -v \
3853
audiotestsrc ! queue ! audioconvert ! \
3954
projectm \
40-
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! xvimagesink sync=false
55+
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false
4156
;;
4257

4358
"--preset")
4459
GST_DEBUG=4 gst-launch-1.0 -v \
4560
audiotestsrc ! queue ! audioconvert ! \
4661
projectm preset="test/presets/250-wavecode.milk.milk" \
47-
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! xvimagesink sync=false
62+
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false
4863
;;
4964

5065
"--properties")
@@ -62,7 +77,7 @@ case "$1" in
6277
mesh-size="512,512" \
6378
easter-egg=0.75 \
6479
preset-locked=false \
65-
! "video/x-raw,width=512,height=512,framerate=30/1" ! videoconvert ! xvimagesink sync=false
80+
! "video/x-raw,width=512,height=512,framerate=30/1" ! videoconvert ! $VIDEO_SINK sync=false
6681
;;
6782

6883
"--output-video")

0 commit comments

Comments
 (0)