swlodc.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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-2020 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. r=0; cwd="$(pwd)"
  28. while [ $# -gt 0 ]; do
  29. v=1; arg="$1"; shift
  30. case "$arg" in
  31. ''|*/ )
  32. :
  33. ;;
  34. /* )
  35. if [ -f "$arg" ] && [ -x "$arg" ]; then
  36. printf %s\\n "$arg"
  37. v=0
  38. fi
  39. ;;
  40. ./* )
  41. if [ -f "$arg" ] && [ -x "$arg" ]; then
  42. pre="$(cd -- "${arg%%/*}/" && pwd)"
  43. printf %s\\n "${pre%/}/$arg"
  44. v=0
  45. fi
  46. ;;
  47. */* )
  48. if [ -f "$arg" ] && [ -x "$arg" ]; then
  49. printf %s\\n "$(cd -- "${arg%%/*}/.." && pwd)/$arg"
  50. v=0
  51. fi
  52. ;;
  53. * )
  54. if [ -n "${PATH+x}" ]; then
  55. p=":${PATH:-$cwd}"
  56. while [ "$p" != "${p#*:}" ] && [ -n "${p#*:}" ]; do
  57. p="${p#*:}"; x="${p%%:*}"; z="${x:-$cwd}"; d="${z%/}/$arg"
  58. if [ -f "$d" ] && [ -x "$d" ]; then
  59. case "$d" in
  60. /* ) : ;;
  61. ./* ) pre="$(cd -- "${d%/*}/" && pwd)"; d="${pre%/}/$d" ;;
  62. * ) d="$(cd -- "${d%/*}/" && pwd)/$arg" ;;
  63. esac
  64. printf %s\\n "$d"
  65. v=0
  66. break
  67. fi
  68. done
  69. fi
  70. ;;
  71. esac
  72. [ $v = 0 ] || r=1
  73. done
  74. return $r
  75. }
  76. check_type () {
  77. case "$1" in
  78. -b )
  79. exists "$PKG" >/dev/null 2>&1 && return 0
  80. TYPE="bin/$PKG"
  81. CMD="printf %s\\n \"warning: binary file for \$PRGNAM not found\""
  82. ;;
  83. -i )
  84. [ -d "/usr/include/$PKG" ] && return 0
  85. TYPE="include/$PKG"
  86. CMD="printf %s\\n \"warning: include directory for \$PRGNAM not found\""
  87. ;;
  88. -l )
  89. ldconfig -p | grep -q "$PKG" && return 0
  90. TYPE="$PKG"
  91. CMD="printf %s\\n \"warning: shared library for \$PRGNAM not found\""
  92. ;;
  93. -p )
  94. pkg-config --exists "$PKG" && return 0
  95. TYPE="$PKG.pc"
  96. CMD="grep pkgconfig/.*.pc \$PKGDIR/$PRGNAM-[0-9]*"
  97. ;;
  98. esac
  99. return 1
  100. }
  101. check_pkg () {
  102. PRGNAM="$2"
  103. case "$3" in
  104. '' ) PKG="$2" ;;
  105. * ) eval "PKG=$3" ;;
  106. esac
  107. if check_type "$1"; then
  108. printf %s\\n "$PRGNAM: ok"
  109. else
  110. printf %s\\n "$PRGNAM: not found" "warning: $TYPE is missing" >&2
  111. set -- "${PKGDIR}/${PRGNAM}*"
  112. if [ -r "$1" ]; then
  113. eval "$CMD" >&2
  114. else
  115. printf %s\\n "warning: $PRGNAM is not installed" >&2
  116. fi
  117. fi
  118. }
  119. # Check dependencies
  120. check_pkg -p apr \$PRGNAM-1
  121. check_pkg -p bluez ''
  122. check_pkg -i boost ''
  123. check_pkg -b bzip2 ''
  124. check_pkg -p cairo ''
  125. check_pkg -p clucene lib\$PRGNAM-core
  126. check_pkg -p coinmp ''
  127. check_pkg -p cppunit ''
  128. check_pkg -p curl lib\$PRGNAM
  129. check_pkg -p epoxy ''
  130. check_pkg -p expat ''
  131. check_pkg -p gc atomic_ops
  132. check_pkg -i glm ''
  133. check_pkg -p graphite2 ''
  134. check_pkg -p gstreamer \$PRGNAM-1.0
  135. check_pkg -p gtk+-3.0 ''
  136. check_pkg -p harfbuzz ''
  137. check_pkg -p hunspell ''
  138. check_pkg -p icu4c icu-i18n
  139. check_pkg -p lcms2 ''
  140. check_pkg -p libabw \$PRGNAM-0.1
  141. check_pkg -p libcdr \$PRGNAM-0.1
  142. check_pkg -p libcmis \$PRGNAM-0.5
  143. check_pkg -p libe-book \$PRGNAM-0.1
  144. check_pkg -p libeot ''
  145. check_pkg -p libepubgen \$PRGNAM-0.1
  146. check_pkg -p libetonyek \$PRGNAM-0.1
  147. check_pkg -p libexttextcat ''
  148. check_pkg -p libfreehand \$PRGNAM-0.1
  149. check_pkg -p libiodbc ''
  150. check_pkg -p liblangtag ''
  151. check_pkg -p libmspub \$PRGNAM-0.1
  152. check_pkg -p libmwaw \$PRGNAM-0.3
  153. check_pkg -p libnumbertext ''
  154. check_pkg -p libodfgen \$PRGNAM-0.1
  155. check_pkg -p liborcus \$PRGNAM-0.16
  156. check_pkg -p libpagemaker \$PRGNAM-0.0
  157. check_pkg -p libpng "\${PRGNAM}16"
  158. check_pkg -p libqxp \$PRGNAM-0.0
  159. check_pkg -p librevenge \$PRGNAM-0.0
  160. check_pkg -p libstaroffice \$PRGNAM-0.0
  161. check_pkg -l libtommath \$PRGNAM.so.1
  162. check_pkg -p libvisio \$PRGNAM-0.1
  163. check_pkg -p libwpd \$PRGNAM-0.10
  164. check_pkg -p libwpg \$PRGNAM-0.3
  165. check_pkg -p libwps \$PRGNAM-0.4
  166. check_pkg -p libxml \$PRGNAM-2.0
  167. check_pkg -p libzmf \$PRGNAM-0.0
  168. check_pkg -b lpsolve lp_solve
  169. check_pkg -b mariadb mysql
  170. check_pkg -p mdds \$PRGNAM-1.5
  171. check_pkg -p mozilla-nss ''
  172. check_pkg -p mythes ''
  173. check_pkg -p neon ''
  174. check_pkg -p openjpeg libopenjp2
  175. check_pkg -b openldap ldapurl
  176. check_pkg -p openssl ''
  177. check_pkg -p poppler ''
  178. check_pkg -p postgresql libpq
  179. check_pkg -p python3 ''
  180. check_pkg -i qrcodegen ''
  181. check_pkg -p redland ''
  182. check_pkg -p sane \$PRGNAM-backends
  183. check_pkg -p serf \$PRGNAM-1
  184. check_pkg -p ucpp lib\$PRGNAM
  185. check_pkg -p xmlsec "\${PRGNAM}1-nss"
  186. check_pkg -p zlib ''