zathura.SlackBuild 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #!/bin/bash
  2. # Slackware build script for zathura
  3. # Copyright 2010 Binh Nguyen <email removed>
  4. # Copyright 2018 B. Watson <urchlay@slackware.uk>
  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. # 20230105 bkw: update for v0.5.1 and zathura-pdf-poppler 0.3.1.
  24. # 20221114 bkw:
  25. # - update for v0.5.1. zathura-pdf-poppler is still 0.3.0.
  26. # - fix bash/zsh/fish completion.
  27. # - change symlink name from pdf.so to libpdf.so (helps with completion).
  28. # - make zathura-pdf-poppler optional.
  29. # - update prebuilt man pages.
  30. # - stop installing duplicate man pages if Sphinx is installed.
  31. # 20210801 bkw:
  32. # - update for v0.4.8 and -current. build uses meson now, so this script
  33. # can no longer build old zathura versions.
  34. # - removed dlopen hack and synctex fix, since they're no longer needed.
  35. # - this changelog was getting long, so move to ChangeLog.old.
  36. cd $(dirname $0) ; CWD=$(pwd)
  37. PRGNAM=zathura
  38. VERSION=${VERSION:-0.5.2}
  39. BUILD=${BUILD:-1}
  40. TAG=${TAG:-_SBo}
  41. PKGTYPE=${PKGTYPE:-tgz}
  42. # zathura no longer includes PDF support in the core. Instead it uses
  43. # plugins. This build includes the default PDF plugin, without which zathura
  44. # is completely useless.
  45. PLUGIN=$PRGNAM-pdf-poppler
  46. PLUGINVER=${PLUGINVER:-0.3.1}
  47. if [ -z "$ARCH" ]; then
  48. case "$( uname -m )" in
  49. i?86) ARCH=i586 ;;
  50. arm*) ARCH=arm ;;
  51. *) ARCH=$( uname -m ) ;;
  52. esac
  53. fi
  54. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  55. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  56. exit 0
  57. fi
  58. TMP=${TMP:-/tmp/SBo}
  59. PKG=$TMP/package-$PRGNAM
  60. OUTPUT=${OUTPUT:-/tmp}
  61. if [ "$ARCH" = "i586" ]; then
  62. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  63. LIBDIRSUFFIX=""
  64. elif [ "$ARCH" = "i686" ]; then
  65. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  66. LIBDIRSUFFIX=""
  67. elif [ "$ARCH" = "x86_64" ]; then
  68. SLKCFLAGS="-O2 -fPIC"
  69. LIBDIRSUFFIX="64"
  70. else
  71. SLKCFLAGS="-O2"
  72. LIBDIRSUFFIX=""
  73. fi
  74. set -e
  75. fixperms() {
  76. chown -R root:root .
  77. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  78. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  79. }
  80. rm -rf $PKG
  81. mkdir -p $TMP $PKG $OUTPUT
  82. cd $TMP
  83. rm -rf $PRGNAM-$VERSION
  84. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  85. cd $PRGNAM-$VERSION
  86. fixperms
  87. # 20221114 bkw: Maik Wagner and Alexander Verbovetsky reported that
  88. # fish and bash completion weren't working, due to the symlink I use
  89. # to switch between the PDF plugins. This patch should fix it.
  90. patch -p1 < $CWD/fix_completion.diff
  91. mkdir build
  92. cd build
  93. CFLAGS="$SLKCFLAGS" \
  94. CXXFLAGS="$SLKCFLAGS" \
  95. meson .. \
  96. --buildtype=release \
  97. --infodir=/usr/info \
  98. --libdir=/usr/lib${LIBDIRSUFFIX} \
  99. --localstatedir=/var \
  100. --mandir=/usr/man \
  101. --prefix=/usr \
  102. --sysconfdir=/etc \
  103. -Dstrip=true
  104. "${NINJA:=ninja}"
  105. DESTDIR=$PKG $NINJA install
  106. cd ..
  107. # man pages prebuilt on a Slackware box with Sphinx installed. I did
  108. # this to avoid a dependency on Sphinx (and its tree of 13 deps).
  109. rm -rf $PKG/usr/man # in case we had Sphinx already...
  110. for i in $CWD/man/*.*; do
  111. dest="$PKG/usr/man/man$( echo $i | sed 's,.*\.,,' )"
  112. mkdir -p "$dest"
  113. gzip -9c < $i > "$dest/$( basename "$i" )".gz
  114. done
  115. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  116. cp -a AUTHORS LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
  117. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  118. # Include the API docs. Sphinx would be needed to build HTML or PDF docs, but
  119. # the doc sources are RST, which are perfectly human-readable already (though
  120. # less easy to navigate).
  121. cp -a doc/api $PKG/usr/doc/$PRGNAM-$VERSION
  122. # Now build the plugin, unless the user disabled it.
  123. if [ "${POPPLER:-yes}" != "no" ]; then
  124. INCLUDES="includes"
  125. cd $TMP
  126. rm -rf $PLUGIN-$PLUGINVER
  127. tar xvf $CWD/$PLUGIN-$PLUGINVER.tar.gz
  128. cd $PLUGIN-$PLUGINVER
  129. fixperms
  130. export PKG_CONFIG_PATH=$PKG/usr/lib$LIBDIRSUFFIX/pkgconfig:$PKG_CONFIG_PATH
  131. mkdir build
  132. cd build
  133. CFLAGS="$SLKCFLAGS -I$PKG/usr/include" \
  134. CXXFLAGS="$SLKCFLAGS -I$PKG/usr/include" \
  135. meson .. \
  136. --buildtype=release \
  137. --infodir=/usr/info \
  138. --libdir=/usr/lib${LIBDIRSUFFIX} \
  139. --localstatedir=/var \
  140. --mandir=/usr/man \
  141. --prefix=/usr \
  142. --sysconfdir=/etc \
  143. -Dstrip=true \
  144. -Dplugindir=/usr/lib$LIBDIRSUFFIX/$PRGNAM/pdf
  145. "${NINJA:=ninja}"
  146. DESTDIR=$PKG $NINJA install
  147. cd ..
  148. ln -s pdf/libpdf-poppler.so $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/libpdf.so
  149. else
  150. # if we don't include the plugin, we still want the empty plugin dir.
  151. mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM
  152. INCLUDES="DOES NOT include"
  153. fi
  154. mkdir -p $PKG/install
  155. sed "s,@INCLUDES@,$INCLUDES," $CWD/slack-desc > $PKG/install/slack-desc
  156. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  157. cd $PKG
  158. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE