summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6fce087cf700f3358efc44e20bfa83498f092137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# $Id$
# Maintainer: Grey Christoforo <first name at last name dot net>

pkgname=opencascade-rc
_pkgver="V7_6_0"
pkgver=$(echo ${_pkgver} | sed 's,^V,,g;s,_,.,g')
pkgrel=1
pkgdesc="An object-oriented C++ class library designed for rapid production of sophisticated domain-specific CAD/CAM/CAE applications -- release candidates and dev snapshots"
arch=(x86_64)
url="https://dev.opencascade.org/"
license=('LGPL' 'custom:OCCTLGPLEXCEPTION')
provides=(opencascade)
conflicts=(opencascade opencascade-git)

depends=(
tk
vtk
gl2ps
ffmpeg
freeimage
intel-tbb
#openvr
)

makedepends=(
cmake
qt5-base
ninja
rapidjson
)

#checkdepends=()

#options=(!strip)

source=(
"${pkgname}-${pkgver}.tgz::https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=refs/tags/${_pkgver};sf=tgz"
opencascade.sh
opencascade-cmake.patch
#"fix-freecad-build.patch::https://git.dev.opencascade.org/gitweb/?p=occt.git;a=patch;h=5e7632824302761b84cfceb5bfb2241d906d0eb4"
)
sha256sums=('e7f989d52348c3b3acb7eb4ee001bb5c2eed5250cdcceaa6ae97edc294f2cabd'
            '9acb2439f1f7f066c111adef5d9f34dcb19c906cc928f87b71eb194317948dfb'
            'b3a2583fd21576d454952894f92a2a9e710015051403a3759b4a2ccbfc78a048')

prepare() {
  cd occt-${_pkgver}

  #patch -p1 -i ../fix-freecad-build.patch # Fix build of FreeCAD

  patch -p1 -i ../opencascade-cmake.patch
  
  #curl https://src.fedoraproject.org/rpms/opencascade/raw/rawhide/f/opencascade-cmake.patch | patch -p1

  #curl https://raw.githubusercontent.com/archlinux/svntogit-community/packages/opencascade/trunk/vtk9.patch | patch -p1

  # https://tracker.dev.opencascade.org/view.php?id=32264
  #curl -L 'http://git.dev.opencascade.org/gitweb/?p=occt.git;a=patch;h=refs/heads/CR32264' | patch -p1
  
  # fix for None type build
  sed '/OpenCASCADECompileDefinitionsAndFlags/d' -i CMakeLists.txt

  # fix for trying to write into the system during build
  #sed 's,if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}"),if (0),g' -i CMakeLists.txt

  # fix for https://tracker.dev.opencascade.org/view.php?id=32328
  #sed 's,#include <TopoDS_Shape.hxx>,#include <TopoDS_Edge.hxx>\n#include <TopoDS_Shape.hxx>,g' -i src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.hxx
}

build() {
  cd occt-${_pkgver}
  # prevents the build from trying to write into the system
  export DESTDIR="${srcdir}/garbage"
  rm -rf "${DESTDIR}"
  
  cmake -B build_dir -S . -W no-dev -G Ninja \
    -D CMAKE_BUILD_TYPE=None \
    -D CMAKE_INSTALL_PREFIX='/usr' \
    -D INSTALL_DIR_CMAKE=/usr/lib/cmake/opencascade \
    -D INSTALL_TEST_CASES=OFF \
    -D BUILD_WITH_DEBUG=OFF \
    -D BUILD_RELEASE_DISABLE_EXCEPTIONS=OFF \
    -D USE_FFMPEG=ON \
    -D USE_FREEIMAGE=ON \
    -D USE_RAPIDJSON=ON \
    -D USE_TBB=ON \
    -D USE_GLES2=ON \
    -D USE_VTK=ON \
    -D INSTALL_SAMPLES=ON \
    -D INSTALL_DOC_Overview=ON \
    -D BUILD_RESOURCES=ON \
    -D BUILD_SAMPLES_QT=ON \
    -D BUILD_Inspector=ON \
    -D 3RDPARTY_QT_DIR="/usr/lib" \
    -D 3RDPARTY_VTK_INCLUDE_DIR="/usr/include/vtk"

  cmake --build build_dir
  rm -rf "${DESTDIR}"
}

check() {
  cd occt-${_pkgver}
  # prevent the current environment from skewing the testing
  unset "${!CSF@}"
  unset "${!DRAW@}"
  unset CASROOT

  # graphics testing does not seem to go well (some seem to stall forever)
  rm -rf tests/bugs/vis
  rm -rf tests/perf/vis
  rm -rf tests/v3d

  cd build_dir
  cp draw.sh check.sh
  sed 's,DRAWEXE,lin64/gcc/bin/DRAWEXE -b -f testgrid.tcl,g' -i check.sh  # possibly try with -v instead of -b
  echo testgrid > testgrid.tcl
  ./check.sh  
}

package() {
  cd occt-${_pkgver}
  DESTDIR="${pkgdir}" cmake --install build_dir
  
  # remove the pollution from bin
  rm -rf "${pkgdir}/usr/bin/"*.sh
  
  install -m644 -Dt "${pkgdir}"/etc/profile.d ${srcdir}/opencascade.sh
  install -m644 -Dt "${pkgdir}"/usr/share/licenses/${pkgname} LICENSE_LGPL_21.txt
  install -m644 -Dt "${pkgdir}"/usr/share/licenses/${pkgname} OCCT_LGPL_EXCEPTION.txt
}