equalx.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. # Slackware build script for equalx
  3. # Copyright 2015 Charles E. Kauffman
  4. # Copyright 2020 B. Watson
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # Now maintained by B. Watson <yalhcru@gmail.com>
  24. # 20210802 bkw: BUILD=3, update for qt5 on -current.
  25. # 20200101 bkw:
  26. # - take over maintenance
  27. # - BUILD=2
  28. # - fix default paths for applications (gs, pdflatex, pdftocairo)
  29. # - actually use SLKCFLAGS
  30. # - strip binary
  31. # - use a .desktop file that validates
  32. # - minor cleanups/etc in script, slack-desc, README
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=equalx
  35. VERSION=${VERSION:-0.7.1}
  36. BUILD=${BUILD:-3}
  37. TAG=${TAG:-_SBo}
  38. PKGTYPE=${PKGTYPE:-tgz}
  39. if [ -z "$ARCH" ]; then
  40. case "$( uname -m )" in
  41. i?86) ARCH=i586 ;;
  42. arm*) ARCH=arm ;;
  43. *) ARCH=$( uname -m ) ;;
  44. esac
  45. fi
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. if [ "$ARCH" = "i586" ]; then
  54. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. else
  63. SLKCFLAGS="-O2"
  64. LIBDIRSUFFIX=""
  65. fi
  66. set -e
  67. rm -rf $PKG
  68. mkdir -p $TMP $PKG $OUTPUT
  69. cd $TMP
  70. rm -rf $PRGNAM-$VERSION
  71. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  72. cd $PRGNAM-$VERSION
  73. chown -R root:root .
  74. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  75. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  76. # Note: patches are gzipped because they have a mix of \n and \r\n
  77. # line endings. git can have issues with that.
  78. # Make sure the application can find the external binaries it runs,
  79. # without defaulting to silly things like .exe files. The patch actually
  80. # makes it look for pdflatex in both places it might be found (/usr/bin
  81. # for texlive, /usr/share/texmf/bin for tetex).
  82. zcat $CWD/externpaths.diff.gz | patch -p1
  83. zcat $CWD/qt5fix.diff.gz | patch -p1
  84. CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" qmake-qt5
  85. sed -i "s,-O2,$SLKCFLAGS," Makefile
  86. make
  87. # No install target in .pro file, do it manually.
  88. mkdir -p \
  89. $PKG/usr/doc/$PRGNAM-$VERSION \
  90. $PKG/usr/bin \
  91. $PKG/usr/man/man1 \
  92. $PKG/usr/share/pixmaps \
  93. $PKG/usr/share/applications
  94. install -s -m0755 -oroot -groot $PRGNAM $PKG/usr/bin
  95. gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  96. cp -a resources/icons/equalx/equalx-64x64.png $PKG/usr/share/pixmaps
  97. cp -a LICENSE README THANKS changelog $PKG/usr/doc/$PRGNAM-$VERSION
  98. # Edited version of the .desktop that actually validates.
  99. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  100. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. mkdir -p $PKG/install
  102. cat $CWD/slack-desc > $PKG/install/slack-desc
  103. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  104. cd $PKG
  105. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE