grass.SlackBuild 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #!/bin/bash
  2. # Slackware build script for grass
  3. # Copyright 2011 David Spencer, Baildon, West Yorkshire, U.K.
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=grass
  24. VERSION=${VERSION:-7.8.0}
  25. SHRTVER=`echo $VERSION | sed "s/\([0-9]*\).\([0-9]*\)..*/\1\2/"`
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. rm -rf $PKG
  61. mkdir -p $TMP $PKG $OUTPUT
  62. cd $TMP
  63. rm -rf $PRGNAM-$VERSION
  64. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  65. cd $PRGNAM-$VERSION
  66. chown -R root:root .
  67. find -L . \
  68. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  69. -o -perm 511 \) -exec chmod 755 {} \; -o \
  70. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  71. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  72. # Option handling:
  73. set -- $(echo $ENABLE | sed 's/,/ /g')
  74. patch -p1 < $CWD/gdal-3.3.patch
  75. while [ "$1" != "" ]; do
  76. case "$1"
  77. in
  78. sqlite | \
  79. netcdf | \
  80. opencl )
  81. WITHLIST="$WITHLIST --with-$1"
  82. shift
  83. ;;
  84. # blas and lapack are both needed, so provide a single option ...
  85. # (Maybe atlas would be better, but the docs are unclear about how the
  86. # dependencies are used.)
  87. gmath )
  88. WITHLIST="$WITHLIST --with-blas --with-lapack"
  89. shift
  90. ;;
  91. # ... but for compatibility with previous versions of this SlackBuild,
  92. # allow blas and lapack to be enabled individually.
  93. blas | lapack )
  94. WITHLIST="$WITHLIST --with-$1"
  95. shift
  96. ;;
  97. mysql | mariadb )
  98. WITHLIST="$WITHLIST --with-mysql"
  99. WITHLIST="$WITHLIST --with-mysql-includes=/usr/include/mysql"
  100. shift
  101. ;;
  102. postgres | postgresql )
  103. WITHLIST="$WITHLIST --with-postgres"
  104. shift
  105. ;;
  106. unixODBC )
  107. WITHLIST="$WITHLIST --with-odbc"
  108. shift
  109. ;;
  110. libLAS | liblas )
  111. WITHLIST="$WITHLIST --with-liblas"
  112. shift
  113. ;;
  114. * )
  115. shift
  116. ;;
  117. esac
  118. done
  119. # geos now always enabled: it's an indirect hard dep (via gdal), and makes grass nicer :-)
  120. CFLAGS="$SLKCFLAGS" \
  121. CXXFLAGS="$SLKCFLAGS -fpermissive" \
  122. LDFLAGS="-ldl -lncurses" \
  123. ./configure \
  124. --prefix=/opt \
  125. --exec-prefix=/wibble/usr \
  126. --enable-largefile \
  127. --with-cairo \
  128. --with-cxx \
  129. --with-fftw \
  130. --with-freetype \
  131. --with-freetype-includes=/usr/include/freetype2 \
  132. --with-geos \
  133. --with-nls \
  134. --with-openmp \
  135. --with-python \
  136. --with-pthread \
  137. --with-proj-share=/usr/share/proj \
  138. --with-readline \
  139. --with-wxwidgets \
  140. $WITHLIST \
  141. --build=$ARCH-slackware-linux \
  142. --host=$ARCH-slackware-linux
  143. make
  144. make prefix=$PKG/opt exec_prefix=$PKG/usr install
  145. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  146. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  147. # Install the pkgconfig file:
  148. install -D -m0644 grass.pc $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/grass.pc
  149. # Create unversioned symlinks:
  150. ( cd $PKG/opt ; ln -s $PRGNAM$SHRTVER $PRGNAM )
  151. ( cd $PKG/usr/bin ; ln -s $PRGNAM$SHRTVER $PRGNAM )
  152. # Remove hardcoded version strings:
  153. sed -i -e "s/-${VERSION}//g" \
  154. $PKG/usr/bin/$PRGNAM$SHRTVER \
  155. $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/grass.pc
  156. # Remove packaging directory pollution:
  157. sed -i -e "s;$PKG;;" \
  158. $PKG/usr/bin/$PRGNAM$SHRTVER \
  159. $PKG/opt/$PRGNAM$SHRTVER/demolocation/.grassrc$SHRTVER \
  160. $PKG/opt/$PRGNAM$SHRTVER/etc/fontcap \
  161. $PKG/opt/$PRGNAM$SHRTVER/include/Make/Grass.make \
  162. $PKG/opt/$PRGNAM$SHRTVER/include/Make/Platform.make
  163. # Documentation:
  164. PKGOPTMAN=$PKG/opt/$PRGNAM$SHRTVER/docs/man
  165. find $PKGOPTMAN -type f -exec gzip -9 {} \;
  166. for i in $( find $PKGOPTMAN -type l ) ; do \
  167. ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  168. mkdir -p $PKG/usr/man/man1
  169. cp -a \
  170. $PKGOPTMAN/man1/grass7.1.gz \
  171. $PKG/usr/man/man1/grass.1.gz
  172. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  173. cp -a \
  174. AUTHORS CHANGES COPYING GPL.TXT REQUIREMENTS.html INSTALL README.md SUBMITTING* TODO \
  175. $PKG/usr/doc/$PRGNAM-$VERSION
  176. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  177. # Desktop:
  178. mkdir -p $PKG/usr/share/applications
  179. cp -a \
  180. $CWD/$PRGNAM.desktop \
  181. $PKG/usr/share/applications/$PRGNAM.desktop
  182. mkdir -p $PKG/usr/share/pixmaps
  183. cp -a \
  184. gui/icons/$PRGNAM-64x64.png \
  185. $PKG/usr/share/pixmaps/${PRGNAM}.png
  186. # Cleanup:
  187. rm -rf $PKG/opt/$PRGNAM/demolocation/PERMANENT/.tmp
  188. rm $PKG/opt/$PRGNAM/config.status
  189. rm -rf $PKG/opt/$PRGNAM/share/
  190. mkdir -p $PKG/install
  191. cat $CWD/slack-desc > $PKG/install/slack-desc
  192. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  193. cd $PKG
  194. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE