Guest User

PKGBUILD: freecad-git

a guest
Sep 21st, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.44 KB | None | 0 0
  1. # Maintainer: Mineko
  2. # Submitter: Giuseppe Borzi <gborzi@ieee.org> (Previous maintainer)
  3.  
  4. pkgname=freecad-git
  5. _gitname="free-cad-code"
  6.  
  7. #-----------------------[[Because being smart is fun!]]-----------------------#
  8. if [ -f "version" ]; then
  9.    echo -e $(tput bold) "\e[91m"
  10.    echo "Oh good, version is here.." #Unnecessary but why the hell not.
  11.    echo $(tput sgr0)
  12. else
  13.    echo -e $(tput bold) "\e[91m"
  14.    echo "Oh teh noes, version isn't here!"
  15.    echo "Then I only have one choice.. I must make it myself!"
  16.    echo $(tput sgr0)
  17.  
  18.    echo "1" > version
  19. fi
  20. #----------------------------[[It never ends...]]-----------------------------#
  21.  
  22. pkgrel=$(cat version)
  23. pkgver=git
  24. pkgdesc="FreeCAD Parametric 3D & 2D CAD-CAE modeler"
  25. arch=('i686' 'x86_64')
  26. url="http://www.freecadweb.org/"
  27. license=('LGPL2+')
  28.  
  29. #-----------------------[[Because we can't have a friggin' OR statement]]-----------------------#
  30. if pacman -Qq opencascade >/dev/null 2>&1; then
  31.    depends=('opencascade>=6.6.0' 'boost-libs' 'python2-matplotlib' 'python2-pyqt4' 'xerces-c' 'freetype2' 'wget' 'ode' 'coin' 'soqt')
  32. elif pacman -Qq oce >/dev/null 2>&1; then
  33.    depends=('oce' 'boost-libs' 'python2-matplotlib' 'python2-pyqt4' 'xerces-c' 'freetype2' 'wget' 'ode' 'coin' 'soqt')
  34. elif pacman -Qq oce-git >/dev/null 2>&1; then
  35.    depends=('oce-git' 'boost-libs' 'python2-matplotlib' 'python2-pyqt4' 'xerces-c' 'freetype2' 'wget' 'ode' 'coin' 'soqt')
  36. else
  37.    echo -e $(tput bold) "\e[91m"
  38.    echo "This package requires either Opencascade Community Edition (OCE) or Opencascade, but neither is installed."
  39.    echo "Install one or the other, but not both, they both work fine, just trying to give a choice.."
  40.    echo "Compilation aborted."
  41.    echo $(tput sgr0)
  42.  
  43.    return 1
  44. fi
  45. #-------------------------------------------[[qq]]----------------------------------------------#
  46.  
  47. makedepends=('boost' 'eigen3' 'gcc-fortran' 'git' 'swig' 'cmake' 'coin>=3.1.3-9' 'zlib')
  48. optdepends=('python2-matplotlib' 'pycollada-git' 'pivy-hg' 'libspnav' 'gts')
  49. provides=('freecad-git')
  50. source=($pkgname.desktop)
  51. md5sums=('0c358dd504e837c60acec71a3f741710')
  52. _gitroot="git://git.code.sf.net/p/free-cad/code"
  53.  
  54. prepare() {
  55.    cd ..
  56.  
  57.    if [ ! -d $_gitname ]; then
  58.       git clone $_gitroot $_gitname
  59.    else
  60.       echo -e $(tput bold) "\e[91m"
  61.  
  62.       read -p "Would you like to update FreeCAD to the latest git version? [Y/N]"
  63.        
  64.       if [[ $REPLY == [yY] ]]; then
  65.          echo "Fetching latest FreeCAD git version..."
  66.  
  67.          echo $(expr $pkgrel + 1) > version
  68.          pkgrel=$(expr $pkgrel + 1)
  69.  
  70.          cd $_gitname
  71.          git pull
  72.       else
  73.          echo "Alright then, your choice."
  74.       fi
  75.  
  76.       echo $(tput sgr0)
  77.    fi
  78. }
  79.  
  80. build() {
  81.    cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/lib/$pkgname \
  82.       -DCMAKE_INSTALL_DATADIR:PATH=/usr/share/$pkgname \
  83.       -DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include/$pkgname \
  84.       -DCMAKE_INSTALL_DOCDIR:PATH=/usr/share/doc/$pkgname \
  85.       -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2 \
  86.       -DFREECAD_USE_EXTERNAL_PIVY:BOOL=ON \
  87.        -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4 \
  88.       ../$_gitname
  89.  
  90.       make
  91. }
  92.  
  93. package() {
  94.    make DESTDIR="$pkgdir/" install
  95.  
  96.    install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
  97.    install -dm755 "$pkgdir/usr/bin"
  98.    ln -sf /usr/lib/$pkgname/bin/FreeCAD "$pkgdir/usr/bin/$pkgname"
  99.    ln -sf /usr/lib/$pkgname/bin/FreeCADCmd "$pkgdir/usr/bin/freecadcmd-git"
  100. }
Add Comment
Please, Sign In to add comment