Skip to content

Commit 4b20a9a

Browse files
committed
fix yabridge for slackware15 by using rust-opt
1 parent 8e3a840 commit 4b20a9a

File tree

1 file changed

+46
-28
lines changed

1 file changed

+46
-28
lines changed

builds/yabridge/yabridge.SlackBuild

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Slackware build script for yabridge
44

5-
# Copyright 2022 Martin Bångens Sweden
5+
# Copyright 2024 Martin Bångens Sweden
66
# All rights reserved.
77
#
88
# Redistribution and use of this script, with or without modification, is
@@ -22,7 +22,7 @@
2222
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2323
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424

25-
cd $(dirname $0) ; CWD=$(pwd)
25+
cd "$(dirname "$0")" ; CWD=$(pwd)
2626

2727
PRGNAM=yabridge
2828
VERSION=${VERSION:-git}
@@ -41,22 +41,22 @@ fi
4141
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
4242
# the name of the created package would be, and then exit. This information
4343
# could be useful to other scripts.
44-
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
44+
if [ -n "${PRINT_PACKAGE_NAME}" ]; then
4545
TMP=${TMP:-/tmp/SBo}
46-
mkdir -p $TMP
47-
cd $TMP
48-
rm -rf $PRGNAM-$VERSION
46+
mkdir -p "$TMP"
47+
cd "$TMP"
48+
rm -rf "$PRGNAM-$VERSION"
4949
git clone https://github.com/robbert-vdh/yabridge
50-
mv yabridge $PRGNAM-$VERSION
51-
cd $PRGNAM-$VERSION
50+
mv yabridge "$PRGNAM-$VERSION"
51+
cd "$PRGNAM-$VERSION"
5252
VERSION=$(git describe --tags)-git
5353
VERSION=${VERSION::-10}
54-
VERSION=$(echo $VERSION | tr '-' . )
54+
VERSION=$(echo "$VERSION" | tr '-' . )
5555
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
5656
exit 0
5757
fi
5858

59-
if [ $ARCH = "arm" ]; then
59+
if [ "$ARCH" = "arm" ]; then
6060
echo "This script only supports x86 for now but Slackware ARM and ARM64 is happening FIXME"
6161
exit 1
6262
fi
@@ -67,34 +67,52 @@ which wine64 &>/dev/null
6767
WINE64_IN_PATH=$?
6868

6969
if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then
70-
if (($WINE_IN_PATH)); then
70+
if (("$WINE_IN_PATH")); then
7171
echo "This script look for wine in PATH and needs it for compiling yabridge on i586"
7272
exit 1
7373
fi
74-
elif [ $ARCH = "x86_64" ]; then
75-
if (($WINE_IN_PATH)) || (($WINE64_IN_PATH)); then
74+
elif [ "$ARCH" = "x86_64" ]; then
75+
LIBDIRSUFFIX=64
76+
if (("$WINE_IN_PATH")) || (("$WINE64_IN_PATH")); then
7677
echo "This script look for wine and wine64 in PATH and needs them both for compiling yabridge on x86_64"
7778
exit 1
7879
fi
7980
fi
8081

82+
FILE="/etc/slackware-version"
83+
EXPECTED="Slackware 15.0"
84+
if [[ -f "$FILE" ]]; then
85+
if grep -q "$EXPECTED" "$FILE"; then
86+
export PATH="/opt/rust/bin:$PATH"
87+
if [ -z "$LD_LIBRARY_PATH" ]; then
88+
export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX"
89+
else
90+
export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH"
91+
fi
92+
else
93+
echo "Slackware current"
94+
fi
95+
else
96+
echo "File $FILE does not exist."
97+
fi
98+
8199
TMP=${TMP:-/tmp/SBo}
82100
PKG=$TMP/package-$PRGNAM
83101
OUTPUT=${OUTPUT:-/tmp}
84102

85103
set -e
86104

87-
rm -rf $PKG
88-
mkdir -p $TMP $PKG $OUTPUT
89-
cd $TMP
90-
rm -rf $PRGNAM-$VERSION
105+
rm -rf "$PKG"
106+
mkdir -p "$TMP" "$PKG" "$OUTPUT"
107+
cd "$TMP"
108+
rm -rf "$PRGNAM-$VERSION"
91109

92110
git clone https://github.com/robbert-vdh/yabridge
93-
mv yabridge $PRGNAM-$VERSION
94-
cd $PRGNAM-$VERSION
111+
mv yabridge "$PRGNAM-$VERSION"
112+
cd "$PRGNAM-$VERSION"
95113
VERSION=$(git describe --tags)
96114
VERSION=${VERSION::-10}
97-
VERSION=$(echo $VERSION | tr '-' . )
115+
VERSION=$(echo "$VERSION" | tr '-' . )
98116

99117
chown -R root:root .
100118
find -L . \
@@ -158,20 +176,20 @@ install ../tools/yabridgectl/target/release/yabridgectl "$PKG/usr/bin"
158176

159177
cd ..
160178

161-
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
179+
find "$PKG" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
162180
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
163181

164-
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
182+
mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION"
165183
cp -a \
166184
README.md \
167185
docs/architecture.md \
168186
COPYING \
169187
CHANGELOG.md \
170-
$PKG/usr/doc/$PRGNAM-$VERSION
171-
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
188+
"$PKG/usr/doc/$PRGNAM-$VERSION"
189+
cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild"
172190

173-
mkdir -p $PKG/install
174-
cat $CWD/slack-desc > $PKG/install/slack-desc
191+
mkdir -p "$PKG/install"
192+
cat "$CWD/slack-desc" > "$PKG/install/slack-desc"
175193

176-
cd $PKG
177-
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
194+
cd "$PKG"
195+
/sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"

0 commit comments

Comments
 (0)