flann.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/sh
  2. # Slackware build script for flann
  3. # Written by João Felipe Santos <joao.eel@gmail.com>
  4. # Copyright (c) 2010 João Felipe Santos
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a copy
  7. # of this software and associated documentation files (the "Software"), to deal
  8. # in the Software without restriction, including without limitation the rights
  9. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. # copies of the Software, and to permit persons to whom the Software is
  11. # furnished to do so, subject to the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included in
  14. # all copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. # THE SOFTWARE.
  23. PRGNAM=flann
  24. VERSION=${VERSION:-1.2}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i486 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. if [ "$ARCH" = "i486" ]; then
  39. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "i686" ]; then
  42. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SLKCFLAGS="-O2 -fPIC"
  46. LIBDIRSUFFIX="64"
  47. else
  48. SLKCFLAGS="-O2"
  49. LIBDIRSUFFIX=""
  50. fi
  51. set -e
  52. rm -rf $PKG
  53. mkdir -p $TMP $PKG $OUTPUT
  54. cd $TMP
  55. rm -rf $PRGNAM-$VERSION-src
  56. unzip $CWD/$PRGNAM-$VERSION-src.zip
  57. cd $PRGNAM-$VERSION-src
  58. chown -R root:root .
  59. find -L . \
  60. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  61. -exec chmod 755 {} \; -o \
  62. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  63. -exec chmod 644 {} \;
  64. # Hack to deactivate MATLAB bindings
  65. if [ -z $WITH_MATLAB ]; then
  66. sed -i '/matlab/d' src/CMakeLists.txt
  67. fi
  68. sed -i '/CMAKE_INSTALL_PREFIX/d' src/CMakeLists.txt
  69. mkdir -p tmp
  70. cd tmp
  71. cmake \
  72. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  73. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  74. -DCMAKE_INSTALL_PREFIX=/usr \
  75. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  76. -DMAN_INSTALL_DIR=/usr/man \
  77. -DCMAKE_BUILD_TYPE=Release ../src
  78. make
  79. make install DESTDIR=$PKG
  80. cd ..
  81. # Install Python bindings, then remove the source files from the package
  82. cd $PKG/usr/python
  83. python setup.py install --root=$PKG
  84. cd $TMP/$PRGNAM-$VERSION-src
  85. rm -rf $PKG/usr/python/
  86. # LIB_SUFFIX seems ignored and $prefix/lib is hardcoded
  87. if [ "$LIBDIRSUFFIX" = "64" ]; then
  88. mv $PKG/usr/lib/* $PKG/usr/lib64/
  89. rmdir $PKG/usr/lib
  90. fi
  91. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  92. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  93. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  94. cp -a \
  95. doc/manual.pdf README \
  96. $PKG/usr/doc/$PRGNAM-$VERSION
  97. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  98. mkdir -p $PKG/install
  99. cat $CWD/slack-desc > $PKG/install/slack-desc
  100. cd $PKG
  101. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}