summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22d7038eefbd173c2b3af5aee903bea2a4723271 (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
# Maintainer: Daniel Liland <celsiuss@await.sh>

pkgname=preflight
pkgver=1.3.0
pkgrel=1
pkgdesc="A modern slicer built for precision and performance. "
arch=('x86_64')
url="https://github.com/oozebot/preFlight"
license=('AGPL-3.0-only')
depends=('gtk3' 'webkit2gtk-4.1' 'mpfr' 'gmp' 'blosc' 'boost-libs' 'curl'
  'expat' 'libjpeg-turbo' 'nanosvg' 'nlopt' 'opencascade' 'opencsg'
  'openexr' 'openssl' 'openvdb' 'libpng' 'qhull' 'tbb' 'libtiff'
  'wxwidgets-gtk3' 'z3' 'zlib' 'gcc-libs' 'dbus' 'imath'
  'glib2' 'pango' 'hicolor-icon-theme' 'python')
makedepends=('cmake' 'glu' 'ninja' 'git' 'boost' 'catch2'
  'cereal' 'cgal' 'eigen' 'nlohmann-json' 'glad' 'pybind11')
options=('!makeflags')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/oozebot/preFlight/archive/refs/tags/v${pkgver}.tar.gz"
  0001-fix-building-for-arch.patch)
sha256sums=('2126dbd2c6a19707eabb3a99cc5841b88f6c0006fd705b4421d9ebecb6311d92'
            '00950c192a500014c7f090d3b394bb21271ad9b9b3b8da0a1594293083de1c9c')

_dir="preFlight-$pkgver"

prepare() {
  cd ${_dir}
  # We want to use the system OpenVDB
  rm cmake/modules/FindOpenVDB.cmake

  # Dynamically link system OpenCASCADE
  sed -i -e 's/\(OpenCASCADE\).*\(REQUIRED\)/\1 \2/
             /TK/d
             s/^\(set(OCCT_LIBS\)/\1 TKDESTEP/' \
    src/occt_wrapper/CMakeLists.txt

  patch -Np1 -i "${srcdir}/0001-fix-building-for-arch.patch"
}

build() {
  export CMAKE_POLICY_VERSION_MINIMUM=3.5

  # Fix crashes
  export CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS/}

  # Use all packages currently available in extra from the system.
  # While upstream does not provide any support if we are using system deps,
  # the alignment of ABI incompatibiities seem more challenging. Additionally,
  # using the vendor deps would create extra responsibility in this package to
  # apply security fixes for issues fixed in the system deps.
  # Therefore we should instead explain how to properly verify issues against
  # the upstream Flatpak to decide whether they are upstream issues to be
  # reported there or are packaging issues we should look for by ourselves.
  # This approach should also fix recurring ABI issue. See
  # https://gitlab.archlinux.org/archlinux/packaging/packages/prusa-slicer/-/issues/2
  cmake \
    -G Ninja \
    -S ${_dir}/deps \
    -B deps_${pkgver} \
    -DpreFlight_deps_PACKAGE_EXCLUDES="Blosc;Boost;Catch2;Cereal;CGAL;CURL;Eigen;EXPAT;GLEW;GMP;JPEG;json;MPFR;NanoSVG;NLopt;OCCT;OpenCSG;OpenEXR;OpenSSL;OpenVDB;PNG;pybind11;PythonRuntime;Qhull;TBB;TIFF;wxWidgets;z3;ZLIB"
  ninja -C deps_${pkgver}

  cmake \
    -G Ninja \
    -S ${_dir} \
    -B build_${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_PREFIX_PATH="$(pwd)/deps_${pkgver}/destdir/usr/local" \
    -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
    -DSLIC3R_FHS=ON \
    -DSLIC3R_GTK=3 \
    -DSLIC3R_PCH=1 \
    -DSLIC3R_STATIC=0 \
    -DCMAKE_CXX_FLAGS="-Wno-template-body"
  ninja -C build_${pkgver}
}

package() {
  optdepends=('slicer-udev: 3D printer connection rules')

  DESTDIR="$pkgdir" ninja -C build_${pkgver} install
}