WolframEngine.SlackBuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #!/bin/bash
  2. # Slackware build script for WolframEngine
  3. # Copyright 2023, Alexander Verbovetsky, Moscow, Russia
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=WolframEngine
  24. VERSION=${VERSION:-13.2.0}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. ARCH="$( uname -m )"
  30. fi
  31. if [ "$ARCH" != "x86_64" ]; then
  32. echo "Only x86_64 is supported."
  33. exit 1
  34. fi
  35. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  36. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  37. exit 0
  38. fi
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. mkdir $PRGNAM-$VERSION
  48. cd $PRGNAM-$VERSION
  49. SCRIPT=$(find -L $CWD -maxdepth 1 -type f -name "*LINUX*")
  50. eval $(grep -a "^filesizes=" -m 1 $SCRIPT)
  51. eval $(grep -a "^MD5=" $SCRIPT)
  52. ssize=$(grep -a offset -m 1 $SCRIPT | sed 's/^.* \([0-9]\+\) .*$/\1/')
  53. ((ssize++))
  54. tail +$ssize $SCRIPT | head -c $filesizes | tee >(tar x) \
  55. | md5sum | grep $MD5 > /dev/null
  56. MDIR="/opt/$PRGNAM"
  57. mkdir -p $PKG$MDIR
  58. find -L Unix/Files -maxdepth 2 -type f -name "contents.tar.?z" \
  59. -exec tar xvf '{}' -C $PKG$MDIR \;
  60. chown -R root:root $PKG$MDIR
  61. find -L $PKG$MDIR \
  62. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  63. -o -perm 511 \) -exec chmod 755 {} \; -o \
  64. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  65. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  66. mkdir -p $PKG/usr/bin
  67. for i in $(find -L $PKG$MDIR/Executables \
  68. -maxdepth 1 -type f -printf "%f\n"); do
  69. ln -s $MDIR/Executables/${i} $PKG/usr/bin
  70. done
  71. ln -s $MDIR/SystemFiles/Kernel/Binaries/Linux-x86-64/wolframscript \
  72. $PKG/usr/bin
  73. mkdir -p $PKG/usr/share/mime/application
  74. cp -a $PKG$MDIR/SystemFiles/Installation/*.xml \
  75. $PKG/usr/share/mime/application
  76. mkdir -p $PKG/usr/share/icons/hicolor/{32x32,64x64,128x128}/{apps,mimetypes}
  77. for i in 32 64 128; do
  78. cp -a $PKG$MDIR/SystemFiles/FrontEnd/SystemResources/X/App-$i.png \
  79. $PKG/usr/share/icons/hicolor/${i}x${i}/apps/wolfram-wolframlanguage.png
  80. for m in $(basename -a \
  81. $(ls $PKG$MDIR/SystemFiles/FrontEnd/SystemResources/X/vnd.wolfram.*${i}.png) \
  82. | cut -d- -f1); do
  83. cp -a $PKG$MDIR/SystemFiles/FrontEnd/SystemResources/X/${m}-${i}.png \
  84. $PKG/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-${m}.png
  85. done
  86. done
  87. mkdir -p $PKG/usr/man/man1
  88. for i in $(find -L $PKG$MDIR/SystemFiles/SystemDocumentation/Unix \
  89. -maxdepth 1 -type f -name "*.1" -printf "%f\n"); do
  90. gzip -9 -c $PKG$MDIR/SystemFiles/SystemDocumentation/Unix/${i} \
  91. > $PKG/usr/man/man1/${i}.gz
  92. done
  93. INFO=$(find -L Unix/Files -maxdepth 2 -type f -name "info" -exec cat '{}' \+ \
  94. | sort -u)
  95. CreationID=$(echo "$INFO" | grep "^CreationID" | awk '{print $2}')
  96. VersionNumber=$(echo "$INFO" | grep "^VersionNumber" | awk '{print $2}')
  97. ReleaseNumber=$(echo "$INFO" | grep "^ReleaseNumber" | awk '{print $2}')
  98. MinorReleaseNumber=$(echo "$INFO" | grep "^MinorReleaseNumber" \
  99. | awk '{print $2}')
  100. FullVersionNumber="${VersionNumber}.${ReleaseNumber}.${MinorReleaseNumber}"
  101. echo "${CreationID}" > $PKG$MDIR/.CreationID
  102. echo "FullVersionNumber: ${FullVersionNumber}" > $PKG$MDIR/.Revision
  103. echo "CreationID: ${CreationID}" >> $PKG$MDIR/.Revision
  104. echo "${FullVersionNumber}" > $PKG$MDIR/.VersionID
  105. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  106. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  107. mkdir -p $PKG/install
  108. cat $CWD/slack-desc > $PKG/install/slack-desc
  109. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  110. cd $PKG
  111. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE