summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a97c0b934d0d62deb98963d62ae0301cb689ae0d (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
# Maintainer: Grey Christoforo <first name at last name dot net>
# Maintainer: Darcy Hu <hot123tea123@gmail.com>

## This PKGBUILD creates an Arch Linux package for the proprietary MATLAB application.
## In order to build the package, the user must supply:
## 1) a plain text file installation key as file `matlab.fik`
## and
## 2) the software tarball as `matlab.tar` from MATLAB ISO image or as downloaded by the installer
## A typical matlab tarball structure looks like this:
#matlab.tar
#├── activate.ini*
#├── archives/
#│   ├── common/
#│   └── glnxa64/
#│       ├── matlab/
#│       ├── matlab_code_analyzer/
#│       ├── matlabconnector/
#│       ├── matlabdata/
#│       ├── matlab_desktop_glnxa64_1535004605.enc*
#│       ├── matlab_desktop_glnxa64_1535004605.xml*
#│       ├── ... other toolbox/product files & folders go here 
#├── bin/
#├── help/
#├── install*
#├── installer_input.txt*
#├── install_guide.pdf*
#├── java/
#├── license_agreement.txt*
#├── patents.txt*
#├── readme.txt*
#├── sys/
#├── trademarks.txt*
#├── ui/
#└── VersionInfo.xml*

## This PKGBUILD no longer attempts to activate the product.
## The user will be prompted to undertake their activation method of choice when the GUI is first run.
## Activation could be automated by running /opt/matlab/bin/activate_matlab.sh after this package is installed.
## Activation could be further automated in matlab.install (a file that doesn't exist at this time)

# partial install
_partialinstall=false

pkgname=matlab
# install dir
_instdir="/opt/${pkgname}"
pkgver=9.6.0.1072779
pkgrel=1
pkgdesc='A high-level language for numerical computation and visualization'
arch=('x86_64')
url='http://www.mathworks.com'
license=(custom)
makedepends=('gendesk')
depends=('gconf'
         'glu'
         'gstreamer0.10-base'
         'gtk2'
         'libunwind'
         'libxp'
         'libxpm'
         'libxtst'
         'nss'
         'portaudio'
         'python2'
         'qt5-svg'
         'qt5-webkit'
         'qt5-websockets'
         'qt5-x11extras'
         'xerces-c')
optdepends=('gcc6: For MEX support')

source=("local:///matlab.tar"
	"local:///matlab.fik"
	"matlab.png::https://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png")
md5sums=("SKIP" "SKIP" 'cf28632239db6e02bc09bcca6bf5360f')
PKGEXT='.pkg.tar'

prepare() {
	msg2 'Creating desktop file'
	gendesk -f -n --pkgname "${pkgname}" \
		--pkgdesc "${pkgdesc}" \
		--categories "Development;Education;Science;Mathematics;IDE" \
	        --exec '/opt/matlab/bin/matlab -desktop'

	msg2 'Extracting file installation key'
	_fik=$(grep -o [0-9-]* ${pkgname}.fik)

	msg2 'Modifying the installer settings'
	sed -i "s,^# destinationFolder=,destinationFolder=${pkgdir}/${_instdir}," "${srcdir}/${pkgname}/installer_input.txt"
	sed -i "s,^# agreeToLicense=,agreeToLicense=yes," "${srcdir}/${pkgname}/installer_input.txt"
	sed -i "s,^# mode=,mode=silent," "${srcdir}/${pkgname}/installer_input.txt"
	sed -i "s,^# fileInstallationKey=,fileInstallationKey=${_fik}," "${srcdir}/${pkgname}/installer_input.txt"

	if [ ! -z ${_products+isSet} ]; then
    	msg2 'Building a package with a subset of the licensed products.'
    	for _product in "${_products[@]}"; do
      		sed -i "/^#product.${_product}$/ s/^#//" "${srcdir}/${pkgname}/installer_input.txt"
    	done
  	fi
}

package() {
	msg2 'Starting MATLAB installer'
	"${srcdir}/${pkgname}/install" -inputFile "${srcdir}/${pkgname}/installer_input.txt"

	msg2 'Installing license'
	install -D -m644 "${srcdir}/${pkgname}/license_agreement.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

	msg2 'Installing desktop files'
	install -D -m644 "${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
	install -D -m644 "${srcdir}/${pkgname}.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"

}

if ${_partialinstall} && [ -z ${_products+isSet} ]; then
	_products=(
		"MATLAB"
		#"Curve_Fitting_Toolbox"
		# fill in toolboxes/products here as needed for a partial install
		# hint: look in your installer_input.txt file for names to use here
		)
fi