summaryrefslogtreecommitdiff
path: root/libre/openexr/PKGBUILD
blob: 6f34343777000b4e03155e54a83e09c630d86480 (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
# Maintainer (Arch): Tobias Powalowski <tpowa@archlinux.org>
# Maintainer (Hyperbola): André Silva <emulatorman@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=openexr
pkgver=2.4.0
pkgrel=7
pkgrel+=.parabola1
pkgdesc="An high dynamic-range image file format library"
pkgdesc+=", without embedded nonfree fonts in the documentation"
url="https://www.openexr.com/"
arch=('x86_64')
arch+=('i686' 'armv7h')
license=('BSD3')
depends=('zlib')
makedepends=('cmake' 'fltk' 'python' 'boost' 'freeglut' 'python-numpy' 'chrpath')
makedepends+=('unoconv' 'libepoxy')
optdepends=('fltk: for exrdisplay' 'boost-libs: python support' 'python: python support')
conflicts=('ilmbase')
replaces=('ilmbase')
source=("https://repo.parabola.nu/other/${pkgname}-libre/${pkgname}-libre-${pkgver}.tar.gz")
sha256sums=('94624fc929b5f34acbbccf8bd111ed9b5c6c4ef7112ac71862eb837f00442582')
mksource=($pkgname-$pkgver.tar.gz::"https://github.com/openexr/openexr/archive/v$pkgver.tar.gz"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR/doc/InterpretingDeepPixels.docx"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR/doc/MultiViewOpenEXR.odt"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR/doc/OpenEXRFileLayout.odt"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR/doc/ReadingAndWritingImageFiles.odt"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR/doc/TechnicalIntroduction.odt"
          "https://github.com/${pkgname}/${pkgname}/raw/master/OpenEXR_Viewers/doc/OpenEXRViewers.odt")
mksha256sums=('4904c5ea7914a58f60a5e2fbc397be67e7a25c380d7d07c1c31a3eefff1c92f1'
              '208147fafb904114e7afa5f632d583be741db765fd341e6ad21b8455a2175436'
              '38c46075f7efe02e231d32753966ffa463f2a3c4673dd8ea71dd47560c403db0'
              '854942160870b4c442dc249e10d8f540aa554bd793ce40576bda430f90b7f995'
              'a4fdf678244f6c37e5ae126a9385a2e154b824b67e1746ed10bc17907c6b45ba'
              'fab77bb2afb3d580387249807300fa26c70eaf46ca23a0036165bafee607dc4e'
              '27467ce4cad8a84cb63b2da2d58454834eac8830c2516cbe8846f32324517a92')
noextract=(InterpretingDeepPixels.docx
           MultiViewOpenEXR.odt
           OpenEXRFileLayout.odt
           ReadingAndWritingImageFiles.odt
           TechnicalIntroduction.odt
           OpenEXRViewers.odt)

mksource() {
  cd $pkgname-$pkgver

  # remove documentation with embedded nonfree fonts
  rm -v OpenEXR/doc/{InterpretingDeepPixels,MultiViewOpenEXR,OpenEXRFileLayout,ReadingAndWritingImageFiles,TechnicalIntroduction,TheoryDeepPixels}.pdf
  rm -v OpenEXR_Viewers/doc/OpenEXRViewers.pdf

  # add source documentation
  install -m644 -v "$srcdir/"{InterpretingDeepPixels.docx,{MultiViewOpenEXR,OpenEXRFileLayout,ReadingAndWritingImageFiles,TechnicalIntroduction}.odt} OpenEXR/doc
  install -m644 -v "$srcdir/"OpenEXRViewers.odt OpenEXR_Viewers/doc

  # convert source documentation to pdf format and clean source code
  pushd OpenEXR/doc
  unoconv -v -f pdf {InterpretingDeepPixels.docx,{MultiViewOpenEXR,OpenEXRFileLayout,ReadingAndWritingImageFiles,TechnicalIntroduction}.odt}
  popd
  pushd OpenEXR_Viewers/doc
  unoconv -v -f pdf OpenEXRViewers.odt
  popd

  rm -rv "${srcdir}/"{_rels,Configurations2,customXml,docProps,META-INF,ObjBFFFDCA{1,3,4,5,7},Object\ 1,ObjectReplacements,Pictures,Thumbnails,word}
}

prepare() {
  cd $pkgname-$pkgver

  # remove TheoryDeepPixels.pdf reference
  sed -i '\|TheoryDeepPixels[.]pdf|d
         ' "OpenEXR/doc/CMakeLists.txt"

# Take DESTDIR into account when creating symlinks
  sed -e 's|chdir ${CMAKE_INSTALL_FULL_LIBDIR}|chdir \\$ENV\\{DESTDIR\\}${CMAKE_INSTALL_FULL_LIBDIR}|' \
    -i OpenEXR/config/LibraryDefine.cmake -i IlmBase/config/LibraryDefine.cmake

# Fix linking python modules to boost_python
  sed -e 's|${libname} ${extraDeps}|${libname} ${extraDeps} Boost::${PYILMBASE_BOOST_PY3_COMPONENT}|' -i PyIlmBase/config/ModuleDefine.cmake
}

build() {
  mkdir -p build

  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install
  install -D -m644 "$srcdir"/$pkgname-$pkgver/LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 "$srcdir/$pkgname-$pkgver/OpenEXR/doc/"{InterpretingDeepPixels.docx,{MultiViewOpenEXR,OpenEXRFileLayout,ReadingAndWritingImageFiles,TechnicalIntroduction}.odt} "${pkgdir}/usr/share/doc/OpenEXR"

# Fix pc include path
  sed -e 's|=include|=${prefix}/include|g' -e 's|=lib|=${prefix}/lib|g' \
    -i "$pkgdir"/usr/lib/pkgconfig/OpenEXR.pc -i "$pkgdir"/usr/lib/pkgconfig/IlmBase.pc

# Install python modules
  _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  install -Dm755 python3*/*.so -t "$pkgdir"/$_pythonpath 
  chrpath -d "$pkgdir"/$_pythonpath/*.so # Remove insecure RPATH
}