gdal.SlackBuild 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #!/bin/bash
  2. # Slackware build script for GDAL
  3. # Copyright 2009 Marco Cecchetti <mrc.ild@gmail.com>
  4. # Updated 2019-2021 Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
  5. # Updated 2021-2022 Gregory J. L. Tourte <artourter@gmail.com>
  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. #
  25. # Maintained by David Spencer <baildon.research@googlemail.com>
  26. cd $(dirname $0) ; CWD=$(pwd)
  27. PRGNAM=gdal
  28. VERSION=${VERSION:-3.4.3}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. if [ -z "$ARCH" ]; then
  33. case "$( uname -m )" in
  34. i?86) ARCH=i586 ;;
  35. arm*) ARCH=arm ;;
  36. *) ARCH=$( uname -m ) ;;
  37. esac
  38. fi
  39. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  40. # the name of the created package would be, and then exit. This information
  41. # could be useful to other scripts.
  42. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  43. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  44. exit 0
  45. fi
  46. TMP=${TMP:-/tmp/SBo}
  47. PKG=$TMP/package-$PRGNAM
  48. OUTPUT=${OUTPUT:-/tmp}
  49. if [ "$ARCH" = "i586" ]; then
  50. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "i686" ]; then
  53. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  54. LIBDIRSUFFIX=""
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. else
  59. SLKCFLAGS="-O2"
  60. LIBDIRSUFFIX=""
  61. fi
  62. set -e
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$VERSION
  67. tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
  68. cd $PRGNAM-$VERSION
  69. chown -R root:root .
  70. find -L . \
  71. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  72. -o -perm 511 \) -exec chmod 755 {} \; -o \
  73. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  74. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  75. # OpenCL, webp, Spatialite and Grass support need special arrangements.
  76. # Everything else is handled automatically by configure.
  77. WITHLIST=""
  78. # Request OpenCL support:
  79. if [ ${OPENCL:-no} = "yes" ]; then
  80. WITHLIST+=" --with-opencl=yes"
  81. fi
  82. # Request webp support if it's installed:
  83. if pkg-config --exists libwebp; then
  84. WITHLIST+=" --with-webp=yes"
  85. fi
  86. # Spatialite support if package is installed:
  87. if pkg-config --exists spatialite; then
  88. WITHLIST+=" --with-spatialite=yes"
  89. fi
  90. # Also, enabling Grass support in gdal introduces a circular dependency,
  91. # so here is another undocumented option.
  92. if pkg-config --exists grass; then
  93. if [ ${GRASS:-no} = "yes" ]; then
  94. WITHLIST+=" --with-grass=$(pkg-config --variable=prefix grass)"
  95. fi
  96. fi
  97. # 12 bit JPEG support is handled by internal modified versions of libjpeg
  98. # and libtiff, but this can cause segfaults in other software linked against
  99. # the real libjpeg (eg. qgis calling qt). Enable JPEG12 only if you need it:
  100. if [ ${JPEG12:-no} = "yes" ]; then
  101. WITHLIST+=" --with-jpeg=internal"
  102. else
  103. WITHLIST+=" --with-jpeg=yes"
  104. fi
  105. # The CPPFLAGS are for the newer mariadb (thanks pprkut!)
  106. CPPFLAGS="-I/usr/include/mysql/server" \
  107. CFLAGS="$SLKCFLAGS" \
  108. CXXFLAGS="$SLKCFLAGS" \
  109. ./configure \
  110. --prefix=/usr \
  111. --libdir=/usr/lib${LIBDIRSUFFIX} \
  112. --sysconfdir=/etc \
  113. --localstatedir=/var \
  114. --mandir=/usr/man \
  115. --docdir=/usr/doc/$PRGNAM-$VERSION \
  116. --enable-static=no \
  117. --with-threads=yes \
  118. --with-cpp14=yes \
  119. --without-libtool \
  120. --with-bash-completion \
  121. --with-geos=yes \
  122. --with-libz=yes \
  123. --with-liblzma=yes \
  124. --with-curl=yes \
  125. --with-crypto=yes \
  126. --with-mysql=yes \
  127. --with-python=/usr/bin/python3 \
  128. --with-poppler=yes \
  129. --with-libtiff=internal \
  130. --with-rename-internal-libtiff-symbols=yes \
  131. --with-geotiff=internal \
  132. --with-rename-internal-libgeotiff-symbols=yes \
  133. --with-jasper=no \
  134. $WITHLIST \
  135. --build=$ARCH-slackware-linux
  136. make
  137. make install DESTDIR=$PKG
  138. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  139. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  140. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  141. cp -a \
  142. COMMITTERS HOWTO-RELEASE LICENSE.TXT MIGRATION_GUIDE.TXT NEWS.md PROVENANCE.TXT VERSION \
  143. $PKG/usr/doc/$PRGNAM-$VERSION
  144. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  145. rm -f $PKG/usr/lib*/*.la
  146. mkdir -p $PKG/install
  147. cat $CWD/slack-desc > $PKG/install/slack-desc
  148. cd $PKG
  149. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE