diff options
Diffstat (limited to 'development/lm-studio-bin/lm-studio-bin.SlackBuild')
-rw-r--r-- | development/lm-studio-bin/lm-studio-bin.SlackBuild | 144 |
1 files changed, 16 insertions, 128 deletions
diff --git a/development/lm-studio-bin/lm-studio-bin.SlackBuild b/development/lm-studio-bin/lm-studio-bin.SlackBuild index 2ab531df52..01c1783f18 100644 --- a/development/lm-studio-bin/lm-studio-bin.SlackBuild +++ b/development/lm-studio-bin/lm-studio-bin.SlackBuild @@ -24,8 +24,8 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=lm-studio-bin -VERSION=${VERSION:-0.3.16.8} -SRCNAM64=LM-Studio-0.3.16-8-x64 +VERSION=${VERSION:-0.3.24.6} +SRCNAM64=LM-Studio-0.3.24-6-x64 BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -66,143 +66,31 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm $SRCNAM64.$COMPRESS || true +rm -rf LMS_STUFF || true +cp -R "$CWD/LMS_STUFF.tar.gz.diff" "$CWD/LMS_STUFF.tar.gz" +tar -xzf "$CWD/LMS_STUFF.tar.gz" +rm "$CWD/LMS_STUFF.tar.gz" +mkdir -p $PKG/opt/ +cp $CWD/$SRCNAM64.$COMPRESS $PKG/opt/ +chmod +x $PKG/opt/$SRCNAM64.$COMPRESS -if [[ $COMPRESS = "deb" ]]; then -# extract directly to $PKG/ - ar x "$CWD"/$SRCNAM.$COMPRESS 2>/dev/null || \ - ar x "$CWD"/"$DISPO"."$COMPRESS" 2>/dev/null || \ - { echo "No valid archive found!"; exit 1; } - rm debian-binary control.tar.* - tar -xJf data.tar.xz -C "$PKG" 2>/dev/null || \ - tar --use-compress-program=unzstd -xf data.tar.zst -C "$PKG" 2>/dev/null || \ - tar -xzf data.tar.gz -C "$PKG" 2>/dev/null || \ - { echo "No valid archive found!"; exit 1; } -cd "$PKG" -# Everything extracted in $PKG/ and you are in $PKG/ also. -elif -[[ $COMPRESS = "pkg.tar.zst" ]]; then -# extract directly to $PKG/ -tar --use-compress-program=unzstd -xf "$CWD"/*.$COMPRESS -C "$PKG" || tar -I unzstd -xf "$CWD"/*.$COMPRESS -C "$PKG" 2>/dev/null || \ - { echo "No valid archive found!"; exit 1; } -cd "$PKG" -# Everything extracted in $PKG/ and you are in $PKG/ also. -elif - [[ $COMPRESS == "AppImage" ]]; then - if [ -d "$TMP"/squashfs-root ]; then - rm -rf "$TMP"/squashfs-root - fi - if [ -d "$TMP"/"$PRGNAM-$VERSION" ]; then - rm -rf "$TMP"/"$PRGNAM-$VERSION" - fi - mv "$CWD"/"$SRCNAM"*."$COMPRESS" "$TMP"/"$SRCNAM-$VERSION"."$COMPRESS" - chmod +x "$TMP"/"$SRCNAM-$VERSION"."$COMPRESS" - pushd "$TMP" || exit 1 - ./"$SRCNAM-$VERSION"."$COMPRESS" --appimage-extract - popd || exit 1 - mv "$TMP"/squashfs-root "$TMP"/"$PRGNAM-$VERSION" - cd "$TMP"/"$PRGNAM-$VERSION" -elif -# extract to $TMP/ - [[ $COMPRESS == "snap" ]]; then - cd "$TMP" - unsquashfs -d "$CWD"/"$SRCNAM"."$COMPRESS" - mv squashfs-root "$PRGNAM-$VERSION" - cd "$PRGNAM-$VERSION" -elif - [[ $COMPRESS = "rpm" ]]; then -# extract to $PKG/ - rpm -Kv "$CWD"/"$SRCNAM.$COMPRESS" - rpm2cpio "$CWD"/"$SRCNAM"."$COMPRESS" > "$TMP"/"$SRCNAM"."$COMPRESS".cpio - cd "$PKG" - cpio -idv < "$TMP"/"$SRCNAM"."$COMPRESS".cpio -# Everything extracted in $PKG/ and you are in $PKG/ also. -else -# If you repackage other type of $COMPRESS here you can add commands to extract it... -# You are in $CWD/ -echo "COMPRESS is not deb or rpm or snap or AppImage or pkg.tar.zst file" -echo "Add here custom commands for $COMPRESS to proceed binary repackage..." -exit 1 -fi - -chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; - -rm AppRun ${PRGNAM%-bin}.png lm-studio.desktop -mkdir -p $PKG/opt/$PRGNAM -mkdir -p $PKG/usr/{bin,share/applications} +cp -R ./LMS_STUFF/* $PKG/ +mkdir -p $PKG/usr/bin cat $CWD/$PRGNAM.sh > $PKG/usr/bin/${PRGNAM%-bin} chmod +x $PKG/usr/bin/${PRGNAM%-bin} -cp -R ./usr/share/icons $PKG/usr/share -rm -rf ./usr/share -cat << EOF > $PKG/usr/share/applications/lm-studio.desktop -[Desktop Entry] -Name=LM Studio -Exec=lm-studio -Terminal=false -Type=Application -Icon=lm-studio -StartupWMClass=LM Studio -Comment=Discover, download, and run LLMs locally -Categories=Utility;Development; -EOF chmod 0644 $PKG/usr/share/applications/lm-studio.desktop -cp -R * "$PKG/opt/$PRGNAM"/ - -SOURCE_IMAGE="$PKG/usr/share/icons/hicolor/0x0/apps/lm-studio.png" -ICON_SIZES=( 16 20 22 24 32 36 44 48 64 72 80 96 128 150 192 256 310 512 1024 ) -ICON_DIR="$PKG/usr/share/icons/hicolor" - -for SIZE in "${ICON_SIZES[@]}"; do - mkdir -p "${ICON_DIR}/${SIZE}x${SIZE}/apps" - convert "$SOURCE_IMAGE" -resize "${SIZE}x${SIZE}" "${ICON_DIR}/${SIZE}x${SIZE}/apps/lm-studio.png" -done - -rm -rf "$PKG/usr/share/icons/hicolor/0x0" - -find $PKG/opt/$PRGNAM/resources/app/.webpack/ -type f -name "*.node" -exec chmod 755 {} \; -chmod 755 $PKG/opt/lm-studio-bin/resources/app/.webpack/bin/esbuild -# Strip binaries and libraries -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 -find "$PKG"/ -type f -name "*.so*" -exec chmod 755 {} \; - -mkdir -p "$PKG"/usr/doc/$PRGNAM-"$VERSION" -if [[ $COMPRESS != "rpm" && $COMPRESS != "deb" && $COMPRESS != "pkg.tar.zst" ]]; then -cp -a \ - LICENSE* \ - $PKG/usr/doc/$PRGNAM-$VERSION -else -# If COMPRESS = rpm,deb or Arch pkg.tar.zst it fix docs and man pages following Slackware culture. -if [ -d "$PKG/usr/share/doc/$PRGNAM" ]; then - mv "$PKG/usr/share/doc/$PRGNAM" "$PKG/usr/doc/$PRGNAM-$VERSION/" -fi - -# Move man pages, if exists -if [ -d "$PKG/usr/share/man" ]; then - mv "$PKG/usr/share/man" "$PKG/usr/man/" -fi - -# Move licenses, if exists -if [ -d "$PKG/usr/share/licenses" ]; then - mv "$PKG/usr/share/licenses" "$PKG/usr/doc/$PRGNAM-$VERSION/" -elif [ -f "$PKG/usr/share/LICENSE" ]; then - mv "$PKG/usr/share/LICENSE" "$PKG/usr/doc/$PRGNAM-$VERSION/" -fi -find "$PKG"/usr/doc/"$PRGNAM"-"$VERSION" -type f -exec chmod 644 {} \; -fi -cat "$CWD"/$PRGNAM.SlackBuild > $PKG/usr/doc/"$PRGNAM-$VERSION"/$PRGNAM.SlackBuild +mkdir -p $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 cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -/sbin/makepkg --remove-tmp-rpaths -l y -c n "$OUTPUT"/"$PRGNAM"-"$VERSION"-"$ARCH"-"$BUILD""$TAG"."$PKGTYPE" +/sbin/makepkg -l y -c n "$OUTPUT"/"$PRGNAM"-"$VERSION"-"$ARCH"-"$BUILD""$TAG"."$PKGTYPE" |