Skip to content

Commit

Permalink
fix yabridge for slackware15 by using rust-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
noisecode3 committed Nov 23, 2024
1 parent 8e3a840 commit 4b20a9a
Showing 1 changed file with 46 additions and 28 deletions.
74 changes: 46 additions & 28 deletions builds/yabridge/yabridge.SlackBuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Slackware build script for yabridge

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

cd $(dirname $0) ; CWD=$(pwd)
cd "$(dirname "$0")" ; CWD=$(pwd)

PRGNAM=yabridge
VERSION=${VERSION:-git}
Expand All @@ -41,22 +41,22 @@ fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
if [ -n "${PRINT_PACKAGE_NAME}" ]; then
TMP=${TMP:-/tmp/SBo}
mkdir -p $TMP
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p "$TMP"
cd "$TMP"
rm -rf "$PRGNAM-$VERSION"
git clone https://github.com/robbert-vdh/yabridge
mv yabridge $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
mv yabridge "$PRGNAM-$VERSION"
cd "$PRGNAM-$VERSION"
VERSION=$(git describe --tags)-git
VERSION=${VERSION::-10}
VERSION=$(echo $VERSION | tr '-' . )
VERSION=$(echo "$VERSION" | tr '-' . )
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

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

if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ]; then
if (($WINE_IN_PATH)); then
if (("$WINE_IN_PATH")); then
echo "This script look for wine in PATH and needs it for compiling yabridge on i586"
exit 1
fi
elif [ $ARCH = "x86_64" ]; then
if (($WINE_IN_PATH)) || (($WINE64_IN_PATH)); then
elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX=64
if (("$WINE_IN_PATH")) || (("$WINE64_IN_PATH")); then
echo "This script look for wine and wine64 in PATH and needs them both for compiling yabridge on x86_64"
exit 1
fi
fi

FILE="/etc/slackware-version"
EXPECTED="Slackware 15.0"
if [[ -f "$FILE" ]]; then
if grep -q "$EXPECTED" "$FILE"; then
export PATH="/opt/rust/bin:$PATH"
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX"
else
export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH"
fi
else
echo "Slackware current"
fi
else
echo "File $FILE does not exist."
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
rm -rf "$PKG"
mkdir -p "$TMP" "$PKG" "$OUTPUT"
cd "$TMP"
rm -rf "$PRGNAM-$VERSION"

git clone https://github.com/robbert-vdh/yabridge
mv yabridge $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
mv yabridge "$PRGNAM-$VERSION"
cd "$PRGNAM-$VERSION"
VERSION=$(git describe --tags)
VERSION=${VERSION::-10}
VERSION=$(echo $VERSION | tr '-' . )
VERSION=$(echo "$VERSION" | tr '-' . )

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

cd ..

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

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION"
cp -a \
README.md \
docs/architecture.md \
COPYING \
CHANGELOG.md \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
"$PKG/usr/doc/$PRGNAM-$VERSION"
cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild"

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
mkdir -p "$PKG/install"
cat "$CWD/slack-desc" > "$PKG/install/slack-desc"

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

0 comments on commit 4b20a9a

Please sign in to comment.