summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0210f305cdcb56ea6164ec98db87db227cd92a48 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Maintainer: Alex S. <shantanna_at_hotmail_dot_com>
# Contributor: Jonathon Fernyhough <jonathon_at_manjaro_dot_org>
# Special thanks to jonathon https://aur.archlinux.org/account/jonathon

# You'll need to download the package archive from
# https://www.blackmagicdesign.com/products/davinciresolve

pkgname=davinci-resolve-beta
_pkgname=resolve
pkgver=14.0b4
pkgrel=0
pkgdesc='Professional A/V post-production software suite'
arch=('x86_64')
url="https://www.blackmagicdesign.com/"
license=('Commercial')
depends=('glu' 'gtk2' 'gstreamer' 'ocl-icd' 'libpng12' 'log4cxx'
         'opencl-driver' 'qt4' 'qt5-base' 'qt5-svg' 'qt5-webkit' 'qt5-webengine' 'qt5-websockets')
options=('!strip')
conflicts=('davinci-resolve')

while [ ! -f ${pkgdir}/DaVinci_Resolve_${pkgver}_Linux.zip ]
do
  if [ -f $HOME/Downloads/DaVinci_Resolve_${pkgver}_Linux.zip ]; then
    ln -s $HOME/Downloads/DaVinci_Resolve_${pkgver}_Linux.zip ${pkgdir}
  else
# Not a good idea, but let's leave it here
#    _dialog="$(command -v zenity kdialog Xdialog | awk -F/ '{print $NF}' | xargs)"
#    case $_dialog in
#    zenity)
#        pkgzip=$(zenity --info --text="Please download a new beta $pkgver here: https://www.blackmagicdesign.com/products/davinciresolve and select this package archive."
#                 zenity  --file-selection --title="Please select the package archive DaVinci_Resolve_${pkgver}_Linux.zip" --filename=$HOME/)
#        if [ "$?" -eq 1 ]; then
#          zenity --info --text="Installation canceled"
#          exit 0
#        else
#          ln -s ${pkgzip} ${pkgdir}
#          break
#        fi
#        ;;
#    kdialog)
#        pkgzip=$(kdialog --msgbox "Please download a new beta $pkgver here: https://www.blackmagicdesign.com/products/davinciresolve and select this package archive."
#                 kdialog --getopenfilename $HOME/ '*.zip'
#        if [ "$?" -eq 1 ]; then
#          kdialog --msgbox "Installation canceled"
#          exit 0
#        else
#          ln -s ${pkgzip} ${pkgdir}
#          break
#        fi
#        ;;
#    xdialog)
#        pkgzip=$(Xdialog --msgbox "Please download a new beta $pkgver here: https://www.blackmagicdesign.com/products/davinciresolve and select this package archive."
#                 Xdialog --title "Please select the package archive DaVinci_Resolve_${pkgver}_Linux.zip" --fselect $HOME 28 48 2>&1)
#        if [ "$?" -eq 1 ]; then
#          Xdialog --msgbox "Installation canceled"
#          exit 0
#        else
#          ln -s ${pkgzip} ${pkgdir}
#          break
#        fi
#        ;;
#    *)
        msg2 "Please remember to put a package archive DaVinci_Resolve_${pkgver}_Linux.zip in to ${pkgdir}"
        sleep 3
        break
#        ;;
#    esac
  fi
done

source=("local://DaVinci_Resolve_${pkgver}_Linux.zip")
sha256sums=('1756c12c94af08a2b7a9d502aa63ab429ed756d47cdd0f1834f92add2f945191')

package() {
	mkdir -p "${pkgdir}/opt/${_pkgname}/"{bin,configs,Media}

	msg2 "Extracting from bundle..."
	cd "${srcdir}" || exit
	./DaVinci_Resolve_${pkgver}_Linux.sh --tar xf -C "${pkgdir}/opt/${_pkgname}"

	msg2 "Extracting library archives..."
	cd "${pkgdir}/opt/${_pkgname}/" || exit
	gunzip -f LUT/trim_lut0.dpx.gz
	for archive in libs/*tgz; do
		tar xf "${archive}" -C libs/
		rm -f "${archive}"
	done

	msg2 "Relocate binaries and config..."
	cd "${pkgdir}/opt/${_pkgname}/" || exit
	local _binaries=(
		BMDPanelFirmware
		DPDecoder
		ShowDpxHeader
		TestIO
		bandwidthTest
		bmdpaneld
		deviceQuery
		oclBandwidthTest
		oclDeviceQuery
		qt.conf
	)
	for binary in "${_binaries[@]}"; do
		mv "rsf/${binary}" "bin/${binary}"
	done
	mv resolve bin/resolve
	mv rsf/Control Control
	cp rsf/default-config-linux.dat configs/config.dat

	msg2 "Add lib symlinks..."
	cd "${pkgdir}/opt/${_pkgname}/" || exit
	ln -s /usr/lib/libcrypto-compat.so.1.0.0 libs/libcrypto.so.10
	ln -s /usr/lib/libssl-compat.so.1.0.0    libs/libssl.so.10
	ln -s /usr/lib/libgstbase-1.0.so         libs/libgstbase-0.10.so.0
	ln -s /usr/lib/libgstreamer-1.0.so       libs/libgstreamer-0.10.so.0

	msg2 "Creating launchers..."
	cd "${srcdir}" || exit
	cat > "${srcdir}/DaVinci Resolve.desktop" << EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Name=DaVinci Resolve
Comment=Professional non-linear editing
Exec=/opt/${_pkgname}/bin/start-resolve
Icon=/opt/${_pkgname}/rsf/DV_Resolve.png
Terminal=false
Categories=Multimedia;AudioVideo;Application;
EOF
	install -Dm644 DaVinci\ Resolve.desktop "${pkgdir}/usr/share/applications/DaVinci Resolve.desktop"

	cat > "${srcdir}/start-resolve" << EOF
#!/bin/sh
export LD_LIBRARY_PATH=/opt/${_pkgname}/libs
exec /opt/${_pkgname}/bin/resolve "\$@"
EOF
	install -Dm755 start-resolve "${pkgdir}/opt/${_pkgname}/bin/start-resolve"

	msg2 "Making sure file ownership is correct..."
	chown -R root:root "${pkgdir}/opt"
	chmod 0777 "${pkgdir}/opt/${_pkgname}/Media"

	msg2 "Any final tweaks..."
	ln -s /tmp "${pkgdir}/opt/${_pkgname}/logs"

	msg2 "Done!"
}