zathura.SlackBuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #!/bin/bash
  2. # Slackware build script for zathura
  3. # Copyright 2010 Binh Nguyen <email removed>
  4. # Copyright 2018 B. Watson <yalhcru@gmail.com>
  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. # 20210801 bkw:
  24. # - update for v0.4.8 and -current. build uses meson now, so this script
  25. # can no longer build old zathura versions.
  26. # - removed dlopen hack and synctex fix, since they're no longer needed.
  27. # - this changelog was getting long, so move to ChangeLog.old.
  28. cd $(dirname $0) ; CWD=$(pwd)
  29. PRGNAM=zathura
  30. VERSION=${VERSION:-0.4.8}
  31. BUILD=${BUILD:-1}
  32. TAG=${TAG:-_SBo}
  33. PKGTYPE=${PKGTYPE:-tgz}
  34. # zathura no longer includes PDF support in the core. Instead it uses
  35. # plugins. This build includes the default PDF plugin, without which zathura
  36. # is completely useless.
  37. PLUGIN=$PRGNAM-pdf-poppler
  38. PLUGINVER=${PLUGINVER:-0.3.0}
  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. fixperms() {
  68. chown -R root:root .
  69. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  70. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  71. }
  72. rm -rf $PKG
  73. mkdir -p $TMP $PKG $OUTPUT
  74. cd $TMP
  75. rm -rf $PRGNAM-$VERSION
  76. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  77. cd $PRGNAM-$VERSION
  78. fixperms
  79. mkdir build
  80. cd build
  81. CFLAGS="$SLKCFLAGS" \
  82. CXXFLAGS="$SLKCFLAGS" \
  83. meson .. \
  84. --buildtype=release \
  85. --infodir=/usr/info \
  86. --libdir=/usr/lib${LIBDIRSUFFIX} \
  87. --localstatedir=/var \
  88. --mandir=/usr/man \
  89. --prefix=/usr \
  90. --sysconfdir=/etc \
  91. -Dstrip=true
  92. "${NINJA:=ninja}"
  93. DESTDIR=$PKG $NINJA install
  94. cd ..
  95. # man pages taken from Debian. I did this to avoid a dependency
  96. # on Sphinx (and its tree of 13 deps).
  97. for i in $CWD/man/*.*; do
  98. dest="$PKG/usr/man/man$( echo $i | sed 's,.*\.,,' )"
  99. mkdir -p "$dest"
  100. gzip -9c < $i > "$dest/$( basename "$i" )".gz
  101. done
  102. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  103. cp -a AUTHORS LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
  104. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  105. # Include the API docs. Sphinx would be needed to build HTML or PDF docs, but
  106. # the doc sources are RST, which are perfectly human-readable already (though
  107. # less easy to navigate).
  108. cp -a doc/api $PKG/usr/doc/$PRGNAM-$VERSION
  109. # Now build the plugin.
  110. cd $TMP
  111. rm -rf $PLUGIN-$PLUGINVER
  112. tar xvf $CWD/$PLUGIN-$PLUGINVER.tar.gz
  113. cd $PLUGIN-$PLUGINVER
  114. fixperms
  115. export PKG_CONFIG_PATH=$PKG/usr/lib$LIBDIRSUFFIX/pkgconfig:$PKG_CONFIG_PATH
  116. mkdir build
  117. cd build
  118. CFLAGS="$SLKCFLAGS -I$PKG/usr/include" \
  119. CXXFLAGS="$SLKCFLAGS -I$PKG/usr/include" \
  120. meson .. \
  121. --buildtype=release \
  122. --infodir=/usr/info \
  123. --libdir=/usr/lib${LIBDIRSUFFIX} \
  124. --localstatedir=/var \
  125. --mandir=/usr/man \
  126. --prefix=/usr \
  127. --sysconfdir=/etc \
  128. -Dstrip=true \
  129. -Dplugindir=/usr/lib$LIBDIRSUFFIX/$PRGNAM/pdf
  130. "${NINJA:=ninja}"
  131. DESTDIR=$PKG $NINJA install
  132. cd ..
  133. ln -s pdf/libpdf-poppler.so $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/pdf.so
  134. mkdir -p $PKG/install
  135. cat $CWD/slack-desc > $PKG/install/slack-desc
  136. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  137. cd $PKG
  138. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE