OpenCASCADE.SlackBuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #!/bin/sh
  2. # Slackware build script for OpenCASCADE
  3. # With some inspiration from the Arch PKGBUILD script
  4. # Copyright 2010-2012 Niels Horn, Rio de Janeiro, RJ, Brazil
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # revision date: 2012/01/03
  24. PRGNAM=OpenCASCADE
  25. VERSION=${VERSION:-6.5.2}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. SRCVERSION=$( echo $VERSION | sed "s/\.//g" )
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i486 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. CWD=$(pwd)
  37. TMP=${TMP:-/tmp/SBo}
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp}
  40. if [ "$ARCH" = "i486" ]; then
  41. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "i686" ]; then
  44. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "x86_64" ]; then
  47. SLKCFLAGS="-O2 -fPIC"
  48. LIBDIRSUFFIX="64"
  49. else
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. fi
  53. set -e
  54. rm -rf $PKG
  55. mkdir -p $TMP $PKG $OUTPUT
  56. cd $TMP
  57. rm -rf $PRGNAM-$VERSION
  58. # Source untars in current directory...
  59. mkdir $PRGNAM-$VERSION
  60. cd $PRGNAM-$VERSION
  61. tar xvf $CWD/${PRGNAM}${SRCVERSION}.tar.gz
  62. chown -R root:root .
  63. chmod -R u+w,go+r-w,a-s .
  64. # Patch source for newer gcc versions
  65. # (avoids "not declared in this scope" errors)
  66. patch -p1 < $CWD/newgcc.patch
  67. # Fix for newer fgtl versions
  68. # (based on earlier patch from openSUSE)
  69. patch -p1 < $CWD/OpenCASCADE-6.5.2_ftgl.patch
  70. # Change to the directory where we'll build from
  71. cd ros
  72. autoreconf -f -i
  73. CFLAGS="$SLKCFLAGS" \
  74. CXXFLAGS="$SLKCFLAGS" \
  75. ./configure \
  76. --prefix=/usr \
  77. --libdir=/usr/lib${LIBDIRSUFFIX} \
  78. --sysconfdir=/etc \
  79. --localstatedir=/var \
  80. --mandir=/usr/man \
  81. --with-tcl=/usr/lib${LIBDIRSUFFIX} \
  82. --with-tk=/usr/lib${LIBDIRSUFFIX} \
  83. --disable-debug \
  84. --enable-production \
  85. --build=$ARCH-slackware-linux
  86. # Change the resulting Makefile so that we can use DESTDIR
  87. sed -e "s|\$(prefix)|\$(DESTDIR)\$(prefix)|g" -i Makefile
  88. make
  89. make install DESTDIR=$PKG
  90. cd ..
  91. # Correct path of include files
  92. mkdir -p $PKG/usr/include
  93. mv $PKG/usr/inc $PKG/usr/include/$PRGNAM
  94. # Correct path of source files
  95. mkdir -p $PKG/usr/src/$PRGNAM
  96. ( set -e
  97. cd $PKG/usr
  98. mv config.h src/$PRGNAM/
  99. cd src
  100. for d in *; do
  101. if [ "$d" != "$PRGNAM" ]; then
  102. mv $d $PRGNAM/
  103. fi
  104. done
  105. ) || exit 1
  106. # Remove unnecessary (and confusing) files
  107. rm -r $PKG/usr/{lin,Linux,env_DRAW.sh}
  108. mkdir -p $PKG/usr/share/$PRGNAM
  109. cp -a data samples $PKG/usr/share/$PRGNAM
  110. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  111. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  112. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  113. cp -a \
  114. README LICENSE ros/README.txt \
  115. $PKG/usr/doc/$PRGNAM-$VERSION
  116. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  117. # If you want *all* documentation in the package, use INSTALL_FULL_DOCS=yes
  118. # but be warned: we're talking about ~ 600MB of documentation...
  119. if [ "${INSTALL_FULL_DOCS:-no}" = "yes" ]; then
  120. cp -a \
  121. doc/* \
  122. $PKG/usr/doc/$PRGNAM-$VERSION
  123. fi
  124. mkdir -p $PKG/install
  125. cat $CWD/slack-desc > $PKG/install/slack-desc
  126. cd $PKG
  127. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}