Advertisement
Guest User

matlab PKGBUILD

a guest
Nov 19th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.98 KB | None | 0 0
  1. # Maintainer: Grey Christoforo <first name at last name dot net>
  2.  
  3. ## This PKGBUILD creates an Arch Linux package for the proprietary MATLAB application. A license from The MathWorks is needed in order to both build the package and to run MATLAB once the package is installed. In order to build the package the user must supply a plain text file installation key and the software. For network installations, in addition to the file installation key, a license file needs to be used for the installation. The tar archive file can be generated from an ISO downloaded from The MathWorks, generated from the official DVD, or created by using the interactive installer to download the toolboxes (installation can be made to a temporary directory and canceled once the toolboxes are downloaded). The contents of the tar archive must include: ./archives/ ./bin/ ./etc/ ./help/ ./java/ /sys ./activate.ini ./install ./installer_input.txt
  4.  
  5. ## The default installation behavior is to install all licensed products whether or not they are available in the tar file. To install only a subset of licensed products either provide a $_products array or set $_partialinstall and remove unwanted entries from the provided $_products array. To perform a network install set $_networkinstall.
  6.  
  7. pkgname=matlab
  8. pkgver=9.3.0.713579
  9. pkgrel=1
  10. pkgdesc='A high-level language for numerical computation and visualization'
  11. arch=('x86_64')
  12. url='http://www.mathworks.com'
  13. license=(custom)
  14. makedepends=('gendesk')
  15. depends=('gconf'
  16.          'glu'
  17.          'gstreamer0.10-base'
  18.          'gtk2'
  19.          'libunwind'
  20.          'libxp'
  21.          'libxpm'
  22.          'libxtst'
  23.          'nss'
  24.      'gcc5'
  25.          'portaudio'
  26.          'python2'
  27.          'qt5-svg'
  28.          'qt5-webkit'
  29.          'qt5-websockets'
  30.          'qt5-x11extras'
  31.          'xerces-c')
  32. optdepends=('gcc49: For MEX support')
  33. source=("file://matlab.tar"
  34.         "file://matlab.fik"
  35.         "http://cloud.teamdev.com/downloads/jxbrowser/jxbrowser-6.17-cross-desktop-win_mac_linux.zip")
  36. md5sums=('SKIP'
  37.          'SKIP'
  38.          'd7f69f34df55ba5642ce4c05557b6c3a')
  39. PKGEXT='.pkg.tar'
  40.  
  41. #_networkinstall=true
  42.  
  43. ## For network installations, apparently, a license file needs to be used for the installation.
  44. if [ ! -z ${_networkinstall+isSet} ]; then
  45.   source+=("file://license.dat")
  46.   md5sums+=('SKIP')
  47. fi
  48.  
  49. prepare() {
  50.   msg2 'Creating desktop file'
  51.   gendesk -f -n --pkgname "${pkgname}" --pkgdesc "${pkgdesc}" --categories "Development;Education;Science;Mathematics;IDE" > /dev/null
  52.   sed -i "/^Exec=/ s,$, -desktop," "${srcdir}/${pkgname}.desktop"
  53.  
  54.   msg2 'Extracting file installation key'
  55.   _fik=$(grep -o [0-9-]* ${pkgname}.fik)
  56.  
  57.   msg2 'Modifying the installer settings'
  58.   sed -i "s,^# destinationFolder=,destinationFolder=${pkgdir}/opt/tmw/${pkgname}/," "${srcdir}/installer_input.txt"
  59.   sed -i "s,^# agreeToLicense=,agreeToLicense=yes," "${srcdir}/installer_input.txt"
  60.   sed -i "s,^# mode=,mode=silent," "${srcdir}/installer_input.txt"
  61.   sed -i "s,^# fileInstallationKey=,fileInstallationKey=${_fik}," "${srcdir}/installer_input.txt"
  62.   if [ ! -z ${_networkinstall+isSet} ]; then
  63.     sed -i "s,^# licensePath=,licensePath=${srcdir}/license.dat," "${srcdir}/installer_input.txt"
  64.   fi
  65.   if [ ! -z ${_products+isSet} ]; then
  66.     msg2 'Building a package with a subset of the licensed products.'
  67.     for _product in "${_products[@]}"; do
  68.       sed -i "/^#product.${_product}$/ s/^#//" "${srcdir}/installer_input.txt"
  69.     done
  70.   fi
  71. }
  72.  
  73. package() {
  74.   msg2 'Starting MATLAB installer'
  75.   "${srcdir}/install" -t -inputFile "${srcdir}/installer_input.txt" -mode silent &> /dev/null
  76.  
  77.   msg2 'Installing license'
  78.   install -D -m644 "${pkgdir}/opt/tmw/${pkgname}/license_agreement.txt" "${pkgdir}/usr/share/licenses/tmw/${pkgname}/LICENSE"
  79.  
  80.   msg2 'Creating links for license.dat'
  81.   ln -s "/etc/tmw/${pkgname}/licenses/" "${pkgdir}/opt/tmw/${pkgname}/licenses"
  82.  
  83.   msg2 'Creating links for executables'
  84.   install -d -m755 "${pkgdir}/usr/bin/"
  85.   for _executable in deploytool matlab mbuild mcc; do
  86.     ln -s "/opt/tmw/${pkgname}/bin/${_executable}" "${pkgdir}/usr/bin/${_executable}"
  87.   done
  88.   ln -s "/opt/tmw/${pkgname}/bin/mex" "${pkgdir}/usr/bin/matlab-mex"
  89.  
  90.   msg2 'Installing desktop files'
  91.   install -D -m644 "${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
  92.   install -D -m644 "${pkgdir}/opt/tmw/${pkgname}/help/matlab/matlab_env/matlab_desktop_icon.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
  93.  
  94.   msg2 'Configuring mex options'
  95.   sed -i "s#CC='gcc'#CC='gcc-4.9'#g" "${pkgdir}/opt/tmw/${pkgname}/bin/mexopts.sh"
  96.   sed -i "s#CXX='g++'#CXX='g++-4.9'#g" "${pkgdir}/opt/tmw/${pkgname}/bin/mexopts.sh"
  97.   sed -i "s#FC='gfortran'#FC='gfortran-4.9'#g" "${pkgdir}/opt/tmw/${pkgname}/bin/mexopts.sh"
  98.  
  99.   # Link libraries to system libraries for working Help browser and AddOn-Manager
  100.   # see https://wiki.archlinux.org/index.php/matlab#Addon_manager_not_working
  101.   msg2 'Linking libraries for Help browser and AddOn-Manager to system libraries'
  102.   ln -sf /usr/lib/{libgio-2.0.so,libglib-2.0.so,libgmodule-2.0.so,libgobject-2.0.so,libgthread-2.0.so}{,.0} "${pkgdir}/opt/tmw/${pkgname}/cefclient/sys/os/glnxa64/"
  103.   ln -sf /usr/lib/libfreetype.so.6 "${pkgdir}/opt/tmw/${pkgname}/bin/glnxa64/"
  104.  
  105.   ## See $MATLABROOT/sys/os/glnxa64/README.libstdc++
  106.   msg2 'Removing unused library files'
  107.   rm ${pkgdir}/opt/tmw/${pkgname}/sys/os/glnxa64/{libstdc++.so.6.0.20,libstdc++.so.6,libgcc_s.so.1,libgfortran.so.3.0.0,libgfortran.so.3,libquadmath.so.0.0.0,libquadmath.so.0}
  108.  
  109.   # These are linked to system libraries (see above)
  110.   rm ${pkgdir}/opt/tmw/${pkgname}/cefclient/sys/os/glnxa64/{libgio-2.0.so,libglib-2.0.so,libgmodule-2.0.so,libgobject-2.0.so,libgthread-2.0.so}.0.4200.2
  111.   rm ${pkgdir}/opt/tmw/${pkgname}/bin/glnxa64/libfreetype.so.6.11.1
  112.  
  113.   # make sure MATLAB can find libgfortran.so.3
  114.   sed -i 's,LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`",LD_LIBRARY_PATH="`eval echo $LD_LIBRARY_PATH`:/usr/lib/gcc/x86_64-pc-linux-gnu/5.5.0",g' "${pkgdir}/opt/tmw/matlab/bin/matlab"
  115.  
  116.   # Replace jxbrowser for fixing freeze after closing Help Browser
  117.   # see https://wiki.archlinux.org/index.php/matlab#MATLAB_hangs_for_several_minutes_when_closing_Help_Browser
  118.   msg2 'Replacing jxbrowser for fixing freeze when closing Help Browser'
  119.   cp "${srcdir}/lib/jxbrowser-6.17.jar" "${pkgdir}/opt/tmw/matlab/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar"
  120.   cp "${srcdir}/lib/jxbrowser-linux64-6.17.jar" "${pkgdir}/opt/tmw/matlab/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar"
  121. }
  122.  
  123. if [ ! -z ${_partialinstall+isSet} ] && [ -z ${_products+isSet} ]; then
  124.   _products=(
  125.       "Aerospace_Blockset"
  126.       "Aerospace_Toolbox"
  127.       "Antenna_Toolbox"
  128.       "Bioinformatics_Toolbox"
  129.       "Communications_System_Toolbox"
  130.       "Computer_Vision_System_Toolbox"
  131.       "Control_System_Toolbox"
  132.       "Curve_Fitting_Toolbox"
  133.       "DO_Qualification_Kit"
  134.       "DSP_System_Toolbox"
  135.       "Data_Acquisition_Toolbox"
  136.       "Database_Toolbox"
  137.       "Datafeed_Toolbox"
  138.       "Econometrics_Toolbox"
  139.       "Embedded_Coder"
  140.       "Filter_Design_HDL_Coder"
  141.       "Financial_Instruments_Toolbox"
  142.       "Financial_Toolbox"
  143.       "Fixed_Point_Designer"
  144.       "Fuzzy_Logic_Toolbox"
  145.       "Gauges_Blockset"
  146.       "Global_Optimization_Toolbox"
  147.       "HDL_Coder"
  148.       "HDL_Verifier"
  149.       "IEC_Certification_Kit"
  150.       "Image_Acquisition_Toolbox"
  151.       "Image_Processing_Toolbox"
  152.       "Instrument_Control_Toolbox"
  153.       "LTE_System_Toolbox"
  154.       "MATLAB"
  155.       "MATLAB_Coder"
  156.       "MATLAB_Compiler"
  157.       "MATLAB_Compiler_SDK"
  158.       "MATLAB_Distributed_Computing_Server"
  159.       "MATLAB_Production_Server"
  160.       "MATLAB_Report_Generator"
  161.       "Mapping_Toolbox"
  162.       "Model_Predictive_Control_Toolbox"
  163.       "Model_Based_Calibration_Toolbox"
  164.       "Neural_Network_Toolbox"
  165.       "OPC_Toolbox"
  166.       "Optimization_Toolbox"
  167.       "Parallel_Computing_Toolbox"
  168.       "Partial_Differential_Equation_Toolbox"
  169.       "Phased_Array_System_Toolbox"
  170.       "Polyspace_Bug_Finder"
  171.       "Polyspace_Code_Prover"
  172.       "RF_Toolbox"
  173.       "Robotics_System_Toolbox"
  174.       "Robust_Control_Toolbox"
  175.       "Signal_Processing_Toolbox"
  176.       "SimBiology"
  177.       "SimDriveline"
  178.       "SimElectronics"
  179.       "SimEvents"
  180.       "SimHydraulics"
  181.       "SimMechanics"
  182.       "SimPowerSystems"
  183.       "SimRF"
  184.       "Simscape"
  185.       "Simulink"
  186.       "Simulink_3D_Animation"
  187.       "Simulink_Code_Inspector"
  188.       "Simulink_Coder"
  189.       "Simulink_Control_Design"
  190.       "Simulink_Design_Optimization"
  191.       "Simulink_Design_Verifier"
  192.       "Simulink_Desktop_Real_Time"
  193.       "Simulink_PLC_Coder"
  194.       "Simulink_Real_Time"
  195.       "Simulink_Report_Generator"
  196.       "Simulink_Test"
  197.       "Simulink_Verification_and_Validation"
  198.       "Spreadsheet_Link_EX"
  199.       "Stateflow"
  200.       "Statistics_and_Machine_Learning_Toolbox"
  201.       "Symbolic_Math_Toolbox"
  202.       "System_Identification_Toolbox"
  203.       "SystemTest"
  204.       "Trading_Toolbox"
  205.       "Vehicle_Network_Toolbox"
  206.       "Vision_HDL_Toolbox"
  207.       "Wavelet_Toolbox"
  208.   )
  209. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement