summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b833f67681418d96d720fe66c2ec2bf01216bdcf (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
148
149
150
151
152
153
154
155
156
157
158
159
160
# 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.0b5
pkgrel=0
pkgdesc='Professional A/V post-production software suite'
arch=('x86_64')
url="https://www.blackmagicdesign.com/"
license=('Commercial')
depends=('glu' 'gtk2' 'gstreamer' 'libpng12' 'lib32-libpng12' 'ocl-icd' 'openssl-1.0'
         'opencl-driver' 'qt4' 'qt5-base' 'qt5-svg' 'qt5-webkit'
         'qt5-webengine' 'qt5-websockets')
options=('!strip')
conflicts=('davinci-resolve')

# Not a good idea, but let's leave it here
#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
#    _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

if [ ! -f ${pkgdir}/DaVinci_Resolve_${pkgver}_Linux.zip ]; then
  if [ -f $HOME/Downloads/DaVinci_Resolve_${pkgver}_Linux.zip ]; then
    ln -s $HOME/Downloads/DaVinci_Resolve_${pkgver}_Linux.zip ${pkgdir}
  else
    msg2 "Please remember to put a package archive DaVinci_Resolve_${pkgver}_Linux.zip in ${pkgdir}"
    sleep 3
  fi
fi

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

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
	install -Dm666 rsf/default-config-linux.dat "${pkgdir}/opt/${_pkgname}/configs/config.dat"

	msg2 "Add lib symlinks..."
	cd "${pkgdir}/opt/${_pkgname}/" || exit
	ln -s /usr/lib/libcrypto.so.1.0.0  libs/libcrypto.so.10
	ln -s /usr/lib/libssl.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
mkdir -p /tmp/${_pkgname}/{logs,GPUCache}
cd /opt/${_pkgname}
exec 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}/configs"
	chmod 0777 "${pkgdir}/opt/${_pkgname}/Media"

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

	msg2 "Done!"
}