swlodc.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #!/bin/sh
  2. # Slackware LibreOffice Dependency Check - swlodc
  3. # A simple shell script to check if the dependency autodetection
  4. # variables for the LibreOffice slackbuild are still sane.
  5. # Copyright 2015-2019 Hunter Sezen California, USA
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  17. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  22. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  23. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. PKGDIR=${PKGDIR:-/var/log/packages}
  25. set -eu
  26. exists () {
  27. v=1
  28. while [ $# -gt 0 ]; do
  29. arg="$1"; shift
  30. case "$arg" in ''|*/) continue ;; esac
  31. x="${arg##*/}" z="${arg%/*}"
  32. [ ! -f "$z/$x" ] || [ ! -x "$z/$x" ] && [ "$z/$x" = "$arg" ] && continue
  33. [ "$x" = "$z" ] && [ -x "$z/$x" ] && [ ! -f "$arg" ] && z=
  34. p=":$z:$PATH"
  35. while [ "$p" != "${p#*:}" ]; do
  36. p="${p#*:}"; d="${p%%:*}"
  37. if [ -f "$d/$x" ] && [ -x "$d/$x" ]; then
  38. printf %s\\n "$d/$x"
  39. v=0
  40. break
  41. fi
  42. done
  43. done
  44. return $v
  45. }
  46. check_type () {
  47. case "$1" in
  48. -b )
  49. exists "$PKG" >/dev/null 2>&1 && return 0
  50. TYPE="bin/$PKG"
  51. CMD="printf %s\\n \"warning: binary file for \$PRGNAM not found\""
  52. ;;
  53. -i )
  54. [ -d "/usr/include/$PKG" ] && return 0
  55. TYPE="include/$PKG"
  56. CMD="printf %s\\n \"warning: include directory for \$PRGNAM not found\""
  57. ;;
  58. -l )
  59. ldconfig -p | grep -q "$PKG" && return 0
  60. TYPE="$PKG"
  61. CMD="printf %s\\n \"warning: shared library for \$PRGNAM not found\""
  62. ;;
  63. -p )
  64. pkg-config --exists "$PKG" && return 0
  65. TYPE="$PKG.pc"
  66. CMD="grep pkgconfig/.*.pc \$PKGDIR/$PRGNAM-[0-9]*"
  67. ;;
  68. esac
  69. return 1
  70. }
  71. check_pkg () {
  72. PRGNAM="$2"
  73. case "$3" in
  74. '' ) PKG="$2" ;;
  75. * ) eval "PKG=$3" ;;
  76. esac
  77. if check_type "$1"; then
  78. printf %s\\n "$PRGNAM: ok"
  79. else
  80. printf %s\\n "$PRGNAM: not found" "warning: $TYPE is missing" >&2
  81. set -- "${PKGDIR}/${PRGNAM}*"
  82. if [ -r "$1" ]; then
  83. eval "$CMD" >&2
  84. else
  85. printf %s\\n "warning: $PRGNAM is not installed" >&2
  86. fi
  87. fi
  88. }
  89. # Check dependencies
  90. check_pkg -p apr \$PRGNAM-1
  91. check_pkg -p bluez ''
  92. check_pkg -i boost ''
  93. check_pkg -b bzip2 ''
  94. check_pkg -p cairo ''
  95. check_pkg -p clucene lib\$PRGNAM-core
  96. check_pkg -p coinmp ''
  97. check_pkg -p cppunit ''
  98. check_pkg -p curl lib\$PRGNAM
  99. check_pkg -p epoxy ''
  100. check_pkg -p expat ''
  101. check_pkg -p gc atomic_ops
  102. check_pkg -i glm ''
  103. check_pkg -p graphite2 ''
  104. check_pkg -p gstreamer \$PRGNAM-1.0
  105. check_pkg -p harfbuzz ''
  106. check_pkg -p hunspell ''
  107. check_pkg -p icu4c icu-i18n
  108. check_pkg -p lcms2 ''
  109. check_pkg -p libabw \$PRGNAM-0.1
  110. check_pkg -p libcdr \$PRGNAM-0.1
  111. check_pkg -p libcmis \$PRGNAM-0.5
  112. check_pkg -p libe-book \$PRGNAM-0.1
  113. check_pkg -p libeot ''
  114. check_pkg -p libepubgen \$PRGNAM-0.1
  115. check_pkg -p libetonyek \$PRGNAM-0.1
  116. check_pkg -p libexttextcat ''
  117. check_pkg -p libfreehand \$PRGNAM-0.1
  118. check_pkg -p libiodbc ''
  119. check_pkg -p liblangtag ''
  120. check_pkg -p libmspub \$PRGNAM-0.1
  121. check_pkg -p libmwaw \$PRGNAM-0.3
  122. check_pkg -p libnumbertext ''
  123. check_pkg -p libodfgen \$PRGNAM-0.1
  124. check_pkg -p liborcus \$PRGNAM-0.15
  125. check_pkg -p libpagemaker \$PRGNAM-0.0
  126. check_pkg -p libpng "\${PRGNAM}16"
  127. check_pkg -p libqxp \$PRGNAM-0.0
  128. check_pkg -p librevenge \$PRGNAM-0.0
  129. check_pkg -p libstaroffice \$PRGNAM-0.0
  130. check_pkg -l libtommath \$PRGNAM.so.1
  131. check_pkg -p libvisio \$PRGNAM-0.1
  132. check_pkg -p libwpd \$PRGNAM-0.10
  133. check_pkg -p libwpg \$PRGNAM-0.3
  134. check_pkg -p libwps \$PRGNAM-0.4
  135. check_pkg -p libxml \$PRGNAM-2.0
  136. check_pkg -p libzmf \$PRGNAM-0.0
  137. check_pkg -b lpsolve lp_solve
  138. check_pkg -b mariadb mysql
  139. check_pkg -p mdds \$PRGNAM-1.5
  140. check_pkg -p mozilla-nss ''
  141. check_pkg -p mythes ''
  142. check_pkg -p neon ''
  143. check_pkg -p openjpeg libopenjp2
  144. check_pkg -b openldap ldapurl
  145. check_pkg -p openssl ''
  146. check_pkg -p poppler ''
  147. check_pkg -p postgresql libpq
  148. check_pkg -p python3 ''
  149. check_pkg -p redland ''
  150. check_pkg -p sane \$PRGNAM-backends
  151. check_pkg -p serf \$PRGNAM-1
  152. check_pkg -p ucpp lib\$PRGNAM
  153. check_pkg -p xmlsec "\${PRGNAM}1-nss"
  154. check_pkg -p zlib ''