summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 36add75f7a117bb1fb8a75c33e8ba38244c3c819 (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
# Maintainer : bartus <arch-user-repoᘓbartus.33mail.com>
# shellcheck disable=SC2034,SC2164,SC2154

_pkgname="mitsuba"
_pkgver="0.6.0"
pkgname="${_pkgname}-git"
pkgver=0.6.0.r2171.26355676
pkgrel=2
pkgdesc="Mitsuba physically based renderer."
url="http://mitsuba-renderer.org/"
license=("GPL3")
arch=("i686" "x86_64")
depends=("python" "xerces-c" "glew-1.13.0" "openexr" "libpng" "libjpeg" "qt5-base" "qt5-xmlpatterns" "fftw" "collada-dom-mitsuba" "boost-libs" "pcre")
makedepends=("eigen" "python2-scons" "git" "boost")
provides=("mitsuba")
conflicts=("mitsuba" "mitsuba-hg")
source=("${_pkgname}::git+https://github.com/mitsuba-renderer/mitsuba.git"
        "python3.8.patch"
        )
sha256sums=('SKIP'
            'e3411c523aa56e1d784b64699cc32eaffc970b8e4d9645911e335e765fe472b4')

pkgver() {
  cd ${_pkgname}
#  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
#  git describe --long --tags | sed        's/\([^-]*-g\)/r\1/;s/-/./g'
  printf "${_pkgver}.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}


prepare() {
    cd "${_pkgname}"
    export _pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))")
    cp build/config-linux-gcc.py config.py

    ## use collada-dom-mitsuba
    sed -i -e "s:collada-dom:collada-dom-mitsuba:g" config.py
    ## use collada-dom instead of collada-dom-mitsube currrently not working (can't figure why)
    #sed -i -e "s:collada-dom:collada-dom2.4:g" -e "s:collada14dom:collada-dom2.4-dp:g" config.py

    ## update GLINCLUDE path to refere to glew-1.13.0 as mitsuba wont build with glew 2.0.0
    sed -i "/XERCESLIB/aGLINCLUDE      = ['/usr/include/glew-1.13.0']" config.py

    ## fix qt5-base on archlinux provides QtWidgets pkg-config as Qt5Widgets
    sed -i -E "s/('Qt)([a-zA-Z]+')/\15\2/g" src/mtsgui/SConscript data/scons/qt5.py
    ## fix:
    # "You must build your code with position independent code
    #  if Qt was built with -reduce-relocations.
    # "Compile your code with -fPIC (-fPIE is not enough)."
    sed -i "s/^CXXFLAGS[ ]*= \[/&'-fPIC', /g" config.py

    # Scons doesn't honor environment variables
    # user has to export then manually in Sconscript file.
    sed -E -i "s/^(SH)?LINKFLAGS[ ]*= \[/&\'${LDFLAGS}\', /g" config.py
    sed -i "s/^CFLAGS[ ]*= \[/&\'${CFLAGS// /\',\'}\', /g" config.py
    sed -i "s/^CXXFLAGS[ ]*= \[/&\'${CXXFLAGS// /\',\'}\', /g" config.py

    git apply ${srcdir}/python3.8.patch
}

build() {
    cd "${_pkgname}"
    scons2 --jobs=$((${MAKEFLAGS/-j/} - 1))
    
}

package() {
    cd "${_pkgname}"
    	install -d \
		${pkgdir}/usr/bin \
		${pkgdir}/usr/lib \
		${pkgdir}/usr/share/mitsuba/plugins \
		${pkgdir}/usr/share/mitsuba/data/schema \
		${pkgdir}/usr/share/mitsuba/data/ior \
		${pkgdir}/usr/share/mitsuba/data/microfacet \
		${pkgdir}/usr/share/applications \
		${pkgdir}/usr/share/pixmaps \
		${pkgdir}/usr/include/mitsuba/{core,hw,render,bidir} \
		${pkgdir}/usr/lib/python2.7/lib-dynload \
		${pkgdir}/usr/lib/python${_pyver}/lib-dynload

	install -m755 dist/mitsuba dist/mtsgui dist/mtssrv dist/mtsutil ${pkgdir}/usr/bin
	install -m755 dist/libmitsuba-core.so \
		dist/libmitsuba-hw.so \
		dist/libmitsuba-render.so \
		dist/libmitsuba-bidir.so \
		${pkgdir}/usr/lib
	install -m755 dist/plugins/* ${pkgdir}/usr/share/mitsuba/plugins
	install -m644 dist/data/schema/* ${pkgdir}/usr/share/mitsuba/data/schema
	install -m644 dist/data/ior/* ${pkgdir}/usr/share/mitsuba/data/ior
	install -m644 dist/data/microfacet/* ${pkgdir}/usr/share/mitsuba/data/microfacet
	install -m644 dist/python/2.7/mitsuba.so ${pkgdir}/usr/lib/python2.7/lib-dynload
	install -m644 dist/python/${_pyver}/mitsuba.so ${pkgdir}/usr/lib/python${_pyver}/lib-dynload
	install -m644 data/linux/mitsuba.desktop ${pkgdir}/usr/share/applications
	install -m644 src/mtsgui/resources/mitsuba48.png ${pkgdir}/usr/share/pixmaps
	install -m644 include/mitsuba/*.h ${pkgdir}/usr/include/mitsuba
	install -m644 include/mitsuba/core/* ${pkgdir}/usr/include/mitsuba/core
	install -m644 include/mitsuba/render/* ${pkgdir}/usr/include/mitsuba/render
	install -m644 include/mitsuba/hw/* ${pkgdir}/usr/include/mitsuba/hw
	install -m644 include/mitsuba/bidir/* ${pkgdir}/usr/include/mitsuba/bidir
}
# vim:set ts=2 sw=2 et: