install_deps.sh 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664
  1. #!/usr/bin/env bash
  2. # ##### BEGIN GPL LICENSE BLOCK #####
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software Foundation,
  16. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. #
  18. # ##### END GPL LICENSE BLOCK #####
  19. # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
  20. ##### Args and Help Handling #####
  21. # Parse command line!
  22. ARGS=$( \
  23. getopt \
  24. -o s:i:t:h \
  25. --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
  26. with-all,with-opencollada,with-jack,with-embree,\
  27. ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
  28. force-all,force-python,force-numpy,force-boost,\
  29. force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
  30. force-ffmpeg,force-opencollada,force-alembic,force-embree,\
  31. build-all,build-python,build-numpy,build-boost,\
  32. build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
  33. build-ffmpeg,build-opencollada,build-alembic,build-embree,\
  34. skip-python,skip-numpy,skip-boost,\
  35. skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
  36. skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree \
  37. -- "$@" \
  38. )
  39. COMMANDLINE=$@
  40. DISTRO=""
  41. RPM=""
  42. SRC="$HOME/src/blender-deps"
  43. INST="/opt/lib"
  44. TMP="/tmp"
  45. CWD=$PWD
  46. INFO_PATH=$CWD
  47. SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
  48. # Do not install some optional, potentially conflicting libs by default...
  49. WITH_ALL=false
  50. # Do not yet enable opencollada or embree, use --with-opencollada/--with-embree (or --with-all) option to try it.
  51. WITH_OPENCOLLADA=false
  52. WITH_EMBREE=false
  53. THREADS=$(nproc)
  54. COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
  55. Built libs of dependencies needed to be compiled will be installed into '\$INST'.
  56. Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
  57. or use --source/--install options, if you want to use other paths!
  58. Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
  59. Full install: \$WITH_ALL (use --with-all option to enable it).
  60. Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
  61. Building Embree: \$WITH_EMBREE (use --with-embree option to enable it).
  62. Example:
  63. Full install without OpenCOLLADA: --with-all --skip-opencollada
  64. Use --help to show all available options!\""
  65. ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
  66. -h, --help
  67. Show this message and exit.
  68. --show-deps
  69. Show main dependencies of Blender (including officially supported versions) and exit.
  70. -s <path>, --source=<path>
  71. Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
  72. -i <path>, --install=<path>
  73. Use a specific path where to install built libraries (defaults to '\$INST').
  74. --tmp=<path>
  75. Use a specific temp path (defaults to '\$TMP').
  76. --info=<path>
  77. Use a specific info path (to store BUILD_NOTES.txt, defaults to '\$INFO_PATH').
  78. -t n, --threads=n
  79. Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
  80. --no-sudo
  81. Disable use of sudo (this script won't be able to do much though, will just print needed packages...).
  82. --no-build
  83. Do not build (compile) anything, dependencies not installable with the package manager will remain missing.
  84. --no-confirm
  85. Disable any interaction with user (suitable for automated run).
  86. --with-all
  87. By default, a number of optional and not-so-often needed libraries are not installed.
  88. This option will try to install them, at the cost of potential conflicts (depending on
  89. how your package system is set…).
  90. Note this option also implies all other (more specific) --with-foo options below.
  91. --with-opencollada
  92. Build and install the OpenCOLLADA libraries.
  93. --with-embree
  94. Build and install the Embree libraries.
  95. --with-jack
  96. Install the jack libraries.
  97. --ver-ocio=<ver>
  98. Force version of OCIO library.
  99. --ver-oiio=<ver>
  100. Force version of OIIO library.
  101. --ver-llvm=<ver>
  102. Force version of LLVM library.
  103. --ver-osl=<ver>
  104. Force version of OSL library.
  105. --ver-osd=<ver>
  106. Force version of OSD library.
  107. --ver-openvdb=<ver>
  108. Force version of OpenVDB library.
  109. Note about the --ver-foo options:
  110. It may not always work as expected (some libs are actually checked out from a git rev...), yet it might help
  111. to fix some build issues (like LLVM mismatch with the version used by your graphic system).
  112. --build-all
  113. Force the build of all possible libraries.
  114. --build-python
  115. Force the build of Python.
  116. --build-numpy
  117. Force the build of NumPy.
  118. --build-boost
  119. Force the build of Boost.
  120. --build-ocio
  121. Force the build of OpenColorIO.
  122. --build-openexr
  123. Force the build of OpenEXR.
  124. --build-oiio
  125. Force the build of OpenImageIO.
  126. --build-llvm
  127. Force the build of LLVM.
  128. --build-osl
  129. Force the build of OpenShadingLanguage.
  130. --build-osd
  131. Force the build of OpenSubdiv.
  132. --build-openvdb
  133. Force the build of OpenVDB.
  134. --build-alembic
  135. Force the build of Alembic.
  136. --build-opencollada
  137. Force the build of OpenCOLLADA.
  138. --build-embree
  139. Force the build of Embree.
  140. --build-ffmpeg
  141. Force the build of FFMpeg.
  142. Note about the --build-foo options:
  143. * They force the script to prefer building dependencies rather than using available packages.
  144. This may make things simpler and allow working around some distribution bugs, but on the other hand it will
  145. use much more space on your hard drive.
  146. * Please be careful with the Blender building options if you have both 'official' dev packages and
  147. install_deps' built ones on your system, by default CMake will prefer official packages, which may lead to
  148. linking issues. Please ensure your CMake configuration always uses all correct library paths.
  149. * If the “force-built” library is a dependency of others, it will force the build
  150. of those libraries as well (e.g. --build-boost also implies --build-oiio and --build-osl...).
  151. --force-all
  152. Force the rebuild of all built libraries.
  153. --force-python
  154. Force the rebuild of Python.
  155. --force-numpy
  156. Force the rebuild of NumPy.
  157. --force-boost
  158. Force the rebuild of Boost.
  159. --force-ocio
  160. Force the rebuild of OpenColorIO.
  161. --force-openexr
  162. Force the rebuild of OpenEXR.
  163. --force-oiio
  164. Force the rebuild of OpenImageIO.
  165. --force-llvm
  166. Force the rebuild of LLVM.
  167. --force-osl
  168. Force the rebuild of OpenShadingLanguage.
  169. --force-osd
  170. Force the rebuild of OpenSubdiv.
  171. --force-openvdb
  172. Force the rebuild of OpenVDB.
  173. --force-alembic
  174. Force the rebuild of Alembic.
  175. --force-opencollada
  176. Force the rebuild of OpenCOLLADA.
  177. --force-embree
  178. Force the rebuild of Embree.
  179. --force-ffmpeg
  180. Force the rebuild of FFMpeg.
  181. Note about the --force-foo options:
  182. * They obviously only have an effect if those libraries are built by this script
  183. (i.e. if there is no available and satisfactory package)!
  184. * If the “force-rebuilt” library is a dependency of others, it will force the rebuild
  185. of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
  186. --skip-python
  187. Unconditionally skip Python installation/building.
  188. --skip-numpy
  189. Unconditionally skip NumPy installation/building.
  190. --skip-boost
  191. Unconditionally skip Boost installation/building.
  192. --skip-ocio
  193. Unconditionally skip OpenColorIO installation/building.
  194. --skip-openexr
  195. Unconditionally skip OpenEXR installation/building.
  196. --skip-oiio
  197. Unconditionally skip OpenImageIO installation/building.
  198. --skip-llvm
  199. Unconditionally skip LLVM installation/building.
  200. --skip-osl
  201. Unconditionally skip OpenShadingLanguage installation/building.
  202. --skip-osd
  203. Unconditionally skip OpenSubdiv installation/building.
  204. --skip-openvdb
  205. Unconditionally skip OpenVDB installation/building.
  206. --skip-alembic
  207. Unconditionally skip Alembic installation/building.
  208. --skip-opencollada
  209. Unconditionally skip OpenCOLLADA installation/building.
  210. --skip-Embree
  211. Unconditionally skip Embree installation/building.
  212. --skip-ffmpeg
  213. Unconditionally skip FFMpeg installation/building.\""
  214. ##### Main Vars #####
  215. DO_SHOW_DEPS=false
  216. SUDO="sudo"
  217. NO_BUILD=false
  218. NO_CONFIRM=false
  219. USE_CXX11=true
  220. CLANG_FORMAT_VERSION_MIN="6.0"
  221. PYTHON_VERSION="3.7.0"
  222. PYTHON_VERSION_MIN="3.7"
  223. PYTHON_FORCE_BUILD=false
  224. PYTHON_FORCE_REBUILD=false
  225. PYTHON_SKIP=false
  226. NUMPY_VERSION="1.15.0"
  227. NUMPY_VERSION_MIN="1.8"
  228. NUMPY_FORCE_BUILD=false
  229. NUMPY_FORCE_REBUILD=false
  230. NUMPY_SKIP=false
  231. BOOST_VERSION="1.68.0"
  232. BOOST_VERSION_MIN="1.49"
  233. BOOST_FORCE_BUILD=false
  234. BOOST_FORCE_REBUILD=false
  235. BOOST_SKIP=false
  236. OCIO_VERSION="1.1.0"
  237. OCIO_VERSION_MIN="1.0"
  238. OCIO_FORCE_BUILD=false
  239. OCIO_FORCE_REBUILD=false
  240. OCIO_SKIP=false
  241. OPENEXR_VERSION="2.3.0"
  242. OPENEXR_VERSION_MIN="2.0.1"
  243. ILMBASE_VERSION="2.3.0"
  244. ILMBASE_VERSION_MIN="2.3"
  245. OPENEXR_FORCE_BUILD=false
  246. OPENEXR_FORCE_REBUILD=false
  247. OPENEXR_SKIP=false
  248. _with_built_openexr=false
  249. OIIO_VERSION="1.8.13"
  250. OIIO_VERSION_MIN="1.8.13"
  251. OIIO_VERSION_MAX="99.99.0" # UNKNOWN currently # Not supported by current OSL...
  252. OIIO_FORCE_BUILD=false
  253. OIIO_FORCE_REBUILD=false
  254. OIIO_SKIP=false
  255. LLVM_VERSION="6.0.1"
  256. LLVM_VERSION_MIN="6.0"
  257. LLVM_VERSION_FOUND=""
  258. LLVM_FORCE_BUILD=false
  259. LLVM_FORCE_REBUILD=false
  260. LLVM_SKIP=false
  261. # OSL needs to be compiled for now!
  262. OSL_VERSION="1.9.9"
  263. OSL_VERSION_MIN=$OSL_VERSION
  264. OSL_FORCE_BUILD=false
  265. OSL_FORCE_REBUILD=false
  266. OSL_SKIP=false
  267. # OpenSubdiv needs to be compiled for now
  268. OSD_VERSION="3.4.0_RC2"
  269. OSD_VERSION_MIN=$OSD_VERSION
  270. OSD_FORCE_BUILD=false
  271. OSD_FORCE_REBUILD=false
  272. OSD_SKIP=false
  273. # OpenVDB needs to be compiled for now
  274. OPENVDB_BLOSC_VERSION="1.14.4"
  275. OPENVDB_VERSION="5.1.0"
  276. OPENVDB_VERSION_MIN=$OPENVDB_VERSION
  277. OPENVDB_FORCE_BUILD=false
  278. OPENVDB_FORCE_REBUILD=false
  279. OPENVDB_SKIP=false
  280. # Alembic needs to be compiled for now
  281. ALEMBIC_VERSION="1.7.8"
  282. ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
  283. ALEMBIC_FORCE_BUILD=false
  284. ALEMBIC_FORCE_REBUILD=false
  285. ALEMBIC_SKIP=false
  286. OPENCOLLADA_VERSION="1.6.68"
  287. OPENCOLLADA_FORCE_BUILD=false
  288. OPENCOLLADA_FORCE_REBUILD=false
  289. OPENCOLLADA_SKIP=false
  290. EMBREE_VERSION="3.2.4"
  291. EMBREE_FORCE_BUILD=false
  292. EMBREE_FORCE_REBUILD=false
  293. EMBREE_SKIP=false
  294. FFMPEG_VERSION="4.0.2"
  295. FFMPEG_VERSION_MIN="2.8.4"
  296. FFMPEG_FORCE_BUILD=false
  297. FFMPEG_FORCE_REBUILD=false
  298. FFMPEG_SKIP=false
  299. _ffmpeg_list_sep=";"
  300. # FFMPEG optional libs.
  301. VORBIS_USE=false
  302. VORBIS_DEV=""
  303. OGG_USE=false
  304. OGG_DEV=""
  305. THEORA_USE=false
  306. THEORA_DEV=""
  307. XVID_USE=false
  308. XVID_DEV=""
  309. X264_USE=false
  310. X264_DEV=""
  311. X264_VERSION_MIN=0.118
  312. VPX_USE=false
  313. VPX_VERSION_MIN=0.9.7
  314. VPX_DEV=""
  315. MP3LAME_USE=false
  316. MP3LAME_DEV=""
  317. OPENJPEG_USE=false
  318. OPENJPEG_DEV=""
  319. # Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
  320. NO_SYSTEM_GLEW=false
  321. # Switch to english language, else some things (like check_package_DEB()) won't work!
  322. LANG_BACK=$LANG
  323. LANG=""
  324. export LANG
  325. ##### Generic Helpers #####
  326. BLACK=$(tput setaf 0)
  327. RED=$(tput setaf 1)
  328. GREEN=$(tput setaf 2)
  329. YELLOW=$(tput setaf 3)
  330. LIME_YELLOW=$(tput setaf 190)
  331. POWDER_BLUE=$(tput setaf 153)
  332. BLUE=$(tput setaf 4)
  333. MAGENTA=$(tput setaf 5)
  334. CYAN=$(tput setaf 6)
  335. WHITE=$(tput setaf 7)
  336. BRIGHT=$(tput bold)
  337. NORMAL=$(tput sgr0)
  338. BLINK=$(tput blink)
  339. REVERSE=$(tput smso)
  340. UNDERLINE=$(tput smul)
  341. _echo() {
  342. if [ "X$1" = "X-n" ]; then
  343. shift; printf "%s" "$@"
  344. else
  345. printf "%s\n" "$@"
  346. fi
  347. }
  348. ERROR() {
  349. _echo "${BRIGHT}${RED}ERROR! ${NORMAL}${RED}$@${NORMAL}"
  350. }
  351. WARNING() {
  352. _echo "${BRIGHT}${YELLOW}WARNING! ${NORMAL}${YELLOW}$@${NORMAL}"
  353. }
  354. INFO() {
  355. _echo "${GREEN}$@${NORMAL}"
  356. }
  357. PRINT() {
  358. _echo "$@"
  359. }
  360. ##### Args Handling #####
  361. # Finish parsing the commandline args.
  362. eval set -- "$ARGS"
  363. while true; do
  364. case $1 in
  365. -s|--source)
  366. SRC="$2"; shift; shift; continue
  367. ;;
  368. -i|--install)
  369. INST="$2"; shift; shift; continue
  370. ;;
  371. --tmp)
  372. TMP="$2"; shift; shift; continue
  373. ;;
  374. --info)
  375. INFO_PATH="$2"; shift; shift; continue
  376. ;;
  377. -t|--threads)
  378. THREADS="$2"; shift; shift; continue
  379. ;;
  380. -h|--help)
  381. PRINT ""
  382. PRINT "USAGE:"
  383. PRINT ""
  384. PRINT "`eval _echo "$COMMON_INFO"`"
  385. PRINT ""
  386. PRINT "`eval _echo "$ARGUMENTS_INFO"`"
  387. PRINT ""
  388. exit 0
  389. ;;
  390. --show-deps)
  391. # We have to defer...
  392. DO_SHOW_DEPS=true; shift; continue
  393. ;;
  394. --no-sudo)
  395. PRINT ""
  396. WARNING "--no-sudo enabled, this script might not be able to do much..."
  397. PRINT ""
  398. SUDO=""; shift; continue
  399. ;;
  400. --no-build)
  401. PRINT ""
  402. WARNING "--no-build enabled, this script will not be able to install all dependencies..."
  403. PRINT ""
  404. NO_BUILD=true; shift; continue
  405. ;;
  406. --no-confirm)
  407. NO_CONFIRM=true; shift; continue
  408. ;;
  409. --with-all)
  410. WITH_ALL=true; shift; continue
  411. ;;
  412. --with-opencollada)
  413. WITH_OPENCOLLADA=true; shift; continue
  414. ;;
  415. --with-embree)
  416. WITH_EMBREE=true; shift; continue
  417. ;;
  418. --with-jack)
  419. WITH_JACK=true; shift; continue;
  420. ;;
  421. --ver-ocio)
  422. OCIO_VERSION="$2"
  423. OCIO_VERSION_MIN=$OCIO_VERSION
  424. shift; shift; continue
  425. ;;
  426. --ver-oiio)
  427. OIIO_VERSION="$2"
  428. OIIO_VERSION_MIN=$OIIO_VERSION
  429. shift; shift; continue
  430. ;;
  431. --ver-llvm)
  432. LLVM_VERSION="$2"
  433. LLVM_VERSION_MIN=$LLVM_VERSION
  434. shift; shift; continue
  435. ;;
  436. --ver-osl)
  437. OSL_VERSION="$2"
  438. OSL_VERSION_MIN=$OSL_VERSION
  439. shift; shift; continue
  440. ;;
  441. --ver-osd)
  442. OSD_VERSION="$2"
  443. OSD_VERSION_MIN=$OSD_VERSION
  444. shift; shift; continue
  445. ;;
  446. --ver-openvdb)
  447. OPENVDB_VERSION="$2"
  448. OPENVDB_VERSION_MIN=$OPENVDB_VERSION
  449. shift; shift; continue
  450. ;;
  451. --build-all)
  452. PYTHON_FORCE_BUILD=true
  453. NUMPY_FORCE_BUILD=true
  454. BOOST_FORCE_BUILD=true
  455. OCIO_FORCE_BUILD=true
  456. OPENEXR_FORCE_BUILD=true
  457. OIIO_FORCE_BUILD=true
  458. LLVM_FORCE_BUILD=true
  459. OSL_FORCE_BUILD=true
  460. OSD_FORCE_BUILD=true
  461. OPENVDB_FORCE_BUILD=true
  462. OPENCOLLADA_FORCE_BUILD=true
  463. EMBREE_FORCE_BUILD=true
  464. FFMPEG_FORCE_BUILD=true
  465. ALEMBIC_FORCE_BUILD=true
  466. shift; continue
  467. ;;
  468. --build-python)
  469. PYTHON_FORCE_BUILD=true
  470. NUMPY_FORCE_BUILD=true
  471. shift; continue
  472. ;;
  473. --build-numpy)
  474. PYTHON_FORCE_BUILD=true
  475. NUMPY_FORCE_BUILD=true
  476. shift; continue
  477. ;;
  478. --build-boost)
  479. BOOST_FORCE_BUILD=true; shift; continue
  480. ;;
  481. --build-ocio)
  482. OCIO_FORCE_BUILD=true; shift; continue
  483. ;;
  484. --build-openexr)
  485. OPENEXR_FORCE_BUILD=true; shift; continue
  486. ;;
  487. --build-oiio)
  488. OIIO_FORCE_BUILD=true; shift; continue
  489. ;;
  490. --build-llvm)
  491. LLVM_FORCE_BUILD=true; shift; continue
  492. ;;
  493. --build-osl)
  494. OSL_FORCE_BUILD=true; shift; continue
  495. ;;
  496. --build-osd)
  497. OSD_FORCE_BUILD=true; shift; continue
  498. ;;
  499. --build-openvdb)
  500. OPENVDB_FORCE_BUILD=true; shift; continue
  501. ;;
  502. --build-opencollada)
  503. OPENCOLLADA_FORCE_BUILD=true; shift; continue
  504. ;;
  505. --build-embree)
  506. EMBREE_FORCE_BUILD=true; shift; continue
  507. ;;
  508. --build-ffmpeg)
  509. FFMPEG_FORCE_BUILD=true; shift; continue
  510. ;;
  511. --build-alembic)
  512. ALEMBIC_FORCE_BUILD=true; shift; continue
  513. ;;
  514. --force-all)
  515. PYTHON_FORCE_REBUILD=true
  516. NUMPY_FORCE_REBUILD=true
  517. BOOST_FORCE_REBUILD=true
  518. OCIO_FORCE_REBUILD=true
  519. OPENEXR_FORCE_REBUILD=true
  520. OIIO_FORCE_REBUILD=true
  521. LLVM_FORCE_REBUILD=true
  522. OSL_FORCE_REBUILD=true
  523. OSD_FORCE_REBUILD=true
  524. OPENVDB_FORCE_REBUILD=true
  525. OPENCOLLADA_FORCE_REBUILD=true
  526. EMBREE_FORCE_REBUILD=true
  527. FFMPEG_FORCE_REBUILD=true
  528. ALEMBIC_FORCE_REBUILD=true
  529. shift; continue
  530. ;;
  531. --force-python)
  532. PYTHON_FORCE_REBUILD=true
  533. NUMPY_FORCE_REBUILD=true
  534. shift; continue
  535. ;;
  536. --force-numpy)
  537. NUMPY_FORCE_REBUILD=true; shift; continue
  538. ;;
  539. --force-boost)
  540. BOOST_FORCE_REBUILD=true; shift; continue
  541. ;;
  542. --force-ocio)
  543. OCIO_FORCE_REBUILD=true; shift; continue
  544. ;;
  545. --force-openexr)
  546. OPENEXR_FORCE_REBUILD=true; shift; continue
  547. ;;
  548. --force-oiio)
  549. OIIO_FORCE_REBUILD=true; shift; continue
  550. ;;
  551. --force-llvm)
  552. LLVM_FORCE_REBUILD=true; shift; continue
  553. ;;
  554. --force-osl)
  555. OSL_FORCE_REBUILD=true; shift; continue
  556. ;;
  557. --force-osd)
  558. OSD_FORCE_REBUILD=true; shift; continue
  559. ;;
  560. --force-openvdb)
  561. OPENVDB_FORCE_REBUILD=true; shift; continue
  562. ;;
  563. --force-opencollada)
  564. OPENCOLLADA_FORCE_REBUILD=true; shift; continue
  565. ;;
  566. --force-embree)
  567. EMBREE_FORCE_REBUILD=true; shift; continue
  568. ;;
  569. --force-ffmpeg)
  570. FFMPEG_FORCE_REBUILD=true; shift; continue
  571. ;;
  572. --force-alembic)
  573. ALEMBIC_FORCE_REBUILD=true; shift; continue
  574. ;;
  575. --skip-python)
  576. PYTHON_SKIP=true; shift; continue
  577. ;;
  578. --skip-numpy)
  579. NUMPY_SKIP=true; shift; continue
  580. ;;
  581. --skip-boost)
  582. BOOST_SKIP=true; shift; continue
  583. ;;
  584. --skip-ocio)
  585. OCIO_SKIP=true; shift; continue
  586. ;;
  587. --skip-openexr)
  588. OPENEXR_SKIP=true; shift; continue
  589. ;;
  590. --skip-oiio)
  591. OIIO_SKIP=true; shift; continue
  592. ;;
  593. --skip-llvm)
  594. LLVM_SKIP=true; shift; continue
  595. ;;
  596. --skip-osl)
  597. OSL_SKIP=true; shift; continue
  598. ;;
  599. --skip-osd)
  600. OSD_SKIP=true; shift; continue
  601. ;;
  602. --skip-openvdb)
  603. OPENVDB_SKIP=true; shift; continue
  604. ;;
  605. --skip-opencollada)
  606. OPENCOLLADA_SKIP=true; shift; continue
  607. ;;
  608. --skip-embree)
  609. EMBREE_SKIP=true; shift; continue
  610. ;;
  611. --skip-ffmpeg)
  612. FFMPEG_SKIP=true; shift; continue
  613. ;;
  614. --skip-alembic)
  615. ALEMBIC_SKIP=true; shift; continue
  616. ;;
  617. --)
  618. # no more arguments to parse
  619. break
  620. ;;
  621. *)
  622. PRINT ""
  623. ERROR "Wrong parameter! Usage:"
  624. PRINT ""
  625. PRINT "`eval _echo "$COMMON_INFO"`"
  626. PRINT ""
  627. exit 1
  628. ;;
  629. esac
  630. done
  631. if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then
  632. WITH_OPENCOLLADA=true
  633. fi
  634. if [ "$WITH_ALL" = true -a "$EMBREE_SKIP" = false ]; then
  635. WITH_EMBREE=true
  636. fi
  637. if [ "$WITH_ALL" = true ]; then
  638. WITH_JACK=true
  639. fi
  640. WARNING "****WARNING****"
  641. PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
  642. PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
  643. PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
  644. PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
  645. PRINT ""
  646. PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
  647. PRINT "for some troublesome/buggy libraries..."
  648. PRINT ""
  649. PRINT ""
  650. PRINT "Ran with:"
  651. PRINT " install_deps.sh $COMMANDLINE"
  652. PRINT ""
  653. PRINT ""
  654. # This has to be done here, because user might force some versions...
  655. PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
  656. NUMPY_SOURCE=( "https://github.com/numpy/numpy/releases/download/v$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" )
  657. _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
  658. BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
  659. BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
  660. OCIO_USE_REPO=false
  661. OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/archive/v$OCIO_VERSION.tar.gz")
  662. #~ OCIO_SOURCE_REPO=( "https://github.com/imageworks/OpenColorIO.git" )
  663. #~ OCIO_SOURCE_REPO_UID="6de971097c7f552300f669ed69ca0b6cf5a70843"
  664. OPENEXR_USE_REPO=false
  665. #~ OPENEXR_SOURCE=( "https://github.com/openexr/openexr/releases/download/v$OPENEXR_VERSION/openexr-$OPENEXR_VERSION.tar.gz" )
  666. OPENEXR_SOURCE_REPO_UID="0ac2ea34c8f3134148a5df4052e40f155b76f6fb"
  667. OPENEXR_SOURCE=( "https://github.com/openexr/openexr/archive/$OPENEXR_SOURCE_REPO_UID.tar.gz" )
  668. #~ OPENEXR_SOURCE_REPO=( "https://github.com/mont29/openexr.git" )
  669. ILMBASE_SOURCE=( "https://github.com/openexr/openexr/releases/download/v$ILMBASE_VERSION/ilmbase-$ILMBASE_VERSION.tar.gz" )
  670. OIIO_USE_REPO=false
  671. OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
  672. #~ OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" )
  673. #~ OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
  674. LLVM_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.xz" )
  675. LLVM_CLANG_SOURCE=( "http://releases.llvm.org/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.xz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.xz" )
  676. OSL_USE_REPO=false
  677. OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
  678. #~ OSL_SOURCE_REPO=( "https://github.com/imageworks/OpenShadingLanguage.git" )
  679. #~ OSL_SOURCE_REPO_BRANCH="master"
  680. #~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
  681. #~ OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage/archive/Release-1.5.11.tar.gz" )
  682. #~ OSL_SOURCE_REPO=( "https://github.com/mont29/OpenShadingLanguage.git" )
  683. #~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
  684. #~ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
  685. #~ OSL_SOURCE_REPO_UID="7d40ff5fe8e47b030042afb92d0e955f5aa96f48"
  686. #~ OSL_SOURCE_REPO_BRANCH="blender-fixes"
  687. OSD_USE_REPO=false
  688. # Script foo to make the version string compliant with the archive name:
  689. # ${Varname//SearchForThisChar/ReplaceWithThisChar}
  690. OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
  691. #~ OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
  692. #~ OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
  693. #~ OSD_SOURCE_REPO_BRANCH="dev"
  694. OPENVDB_USE_REPO=false
  695. OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" )
  696. OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
  697. #~ OPENVDB_SOURCE_REPO=( "https:///dreamworksanimation/openvdb.git" )
  698. #~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
  699. #~ OPENVDB_SOURCE_REPO_BRANCH="dev"
  700. ALEMBIC_USE_REPO=false
  701. ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
  702. # ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
  703. # ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
  704. # ALEMBIC_SOURCE_REPO_BRANCH="master"
  705. OPENCOLLADA_USE_REPO=false
  706. OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA/archive/v${OPENCOLLADA_VERSION}.tar.gz" )
  707. #~ OPENCOLLADA_SOURCE_REPO=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
  708. #~ OPENCOLLADA_REPO_UID="e937c3897b86fc0da53cde97257f5156"
  709. #~ OPENCOLLADA_REPO_BRANCH="master"
  710. EMBREE_USE_REPO=false
  711. EMBREE_SOURCE=( "https://github.com/embree/embree/archive/v${EMBREE_VERSION}.tar.gz" )
  712. #~ EMBREE_SOURCE_REPO=( "https://github.com/embree/embree.git" )
  713. #~ EMBREE_REPO_UID="4a12bfed63c90e85b6eab98b8cdd8dd2a3ba5809"
  714. #~ EMBREE_REPO_BRANCH="master"
  715. FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
  716. # C++11 is required now
  717. CXXFLAGS_BACK=$CXXFLAGS
  718. CXXFLAGS="$CXXFLAGS -std=c++11"
  719. export CXXFLAGS
  720. #### Show Dependencies ####
  721. # Need those to be after we defined versions...
  722. DEPS_COMMON_INFO="\"COMMON DEPENDENCIES:
  723. Those libraries should be available as packages in all recent distributions (optional ones are [between brackets]):
  724. * Basics of dev environment (cmake, gcc, svn , git, ...).
  725. * libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
  726. * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
  727. * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
  728. * libsdl1.2, libglew, [libglewmx].\""
  729. DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
  730. The following libraries will probably not all be available as packages in your distribution
  731. (install_deps will by default try to install packages, and fall back to building missing ones).
  732. You can force install_deps to build those with '--build-all' or relevant 'build-foo' options, see '--help' message.
  733. You may also want to build them yourself (optional ones are [between brackets]):
  734. * Python $PYTHON_VERSION_MIN (from $PYTHON_SOURCE).
  735. * [NumPy $NUMPY_VERSION_MIN] (from $NUMPY_SOURCE).
  736. * Boost $BOOST_VERSION_MIN (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES).
  737. * [FFMpeg $FFMPEG_VERSION_MIN (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE).
  738. * [OpenColorIO $OCIO_VERSION_MIN] (from $OCIO_SOURCE).
  739. * ILMBase $ILMBASE_VERSION_MIN (from $ILMBASE_SOURCE).
  740. * OpenEXR $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE).
  741. * OpenImageIO $OIIO_VERSION_MIN (from $OIIO_SOURCE).
  742. * [LLVM $LLVM_VERSION_MIN (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE).
  743. * [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
  744. * [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
  745. * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
  746. * [OpenCollada $OPENCOLLADA_VERSION] (from $OPENCOLLADA_SOURCE).
  747. * [Embree $EMBREE_VERSION] (from $EMBREE_SOURCE).
  748. * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
  749. if [ "$DO_SHOW_DEPS" = true ]; then
  750. PRINT ""
  751. PRINT "Blender dependencies (libraries needed to build it):"
  752. PRINT ""
  753. PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
  754. PRINT ""
  755. PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
  756. PRINT ""
  757. exit 0
  758. fi
  759. ##### Generic Helpers #####
  760. # Check return code of wget for success...
  761. download() {
  762. declare -a sources=("${!1}")
  763. sources_count=${#sources[@]}
  764. error=1
  765. for (( i=0; $i < $sources_count; i++ ))
  766. do
  767. wget -c ${sources[$i]} -O $2
  768. if [ $? -eq 0 ]; then
  769. error=0
  770. break
  771. fi
  772. done
  773. if [ $error -eq 1 ]; then
  774. ERROR "wget could not find ${sources[@]}, or could not write it to $2, exiting"
  775. exit 1
  776. fi
  777. }
  778. # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
  779. # $1 and $2 should be version numbers made of numbers only.
  780. version_eq() {
  781. backIFS=$IFS
  782. IFS='.'
  783. # Split both version numbers into their numeric elements.
  784. arr1=( $1 )
  785. arr2=( $2 )
  786. ret=1
  787. count1=${#arr1[@]}
  788. count2=${#arr2[@]}
  789. if [ $count2 -ge $count1 ]; then
  790. _t=$count1
  791. count1=$count2
  792. count2=$_t
  793. arr1=( $2 )
  794. arr2=( $1 )
  795. fi
  796. ret=0
  797. for (( i=0; $i < $count2; i++ ))
  798. do
  799. if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
  800. ret=1
  801. break
  802. fi
  803. done
  804. for (( i=$count2; $i < $count1; i++ ))
  805. do
  806. if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
  807. ret=1
  808. break
  809. fi
  810. done
  811. IFS=$backIFS
  812. return $ret
  813. }
  814. # Return 0 if $1 >= $2, else 1.
  815. # $1 and $2 should be version numbers made of numbers only.
  816. version_ge() {
  817. version_eq $1 $2
  818. if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
  819. return 1
  820. else
  821. return 0
  822. fi
  823. }
  824. # Return 0 if $3 > $1 >= $2, else 1.
  825. # $1 and $2 should be version numbers made of numbers only.
  826. version_ge_lt() {
  827. version_ge $1 $3
  828. if [ $? -eq 0 ]; then
  829. return 1
  830. else
  831. version_ge $1 $2
  832. return $?
  833. fi
  834. }
  835. # Return 0 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5), else 1.
  836. # $1 and $2 should be version numbers made of numbers only.
  837. # $1 should be at least as long as $2!
  838. version_match() {
  839. backIFS=$IFS
  840. IFS='.'
  841. # Split both version numbers into their numeric elements.
  842. arr1=( $1 )
  843. arr2=( $2 )
  844. ret=1
  845. count1=${#arr1[@]}
  846. count2=${#arr2[@]}
  847. if [ $count1 -ge $count2 ]; then
  848. ret=0
  849. for (( i=0; $i < $count2; i++ ))
  850. do
  851. if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
  852. ret=1
  853. break
  854. fi
  855. done
  856. fi
  857. IFS=$backIFS
  858. return $ret
  859. }
  860. ##### Generic compile helpers #####
  861. prepare_opt() {
  862. INFO "Ensuring $INST exists and is writable by us"
  863. if [ ! $SUDO ]; then
  864. WARNING "--no-sudo enabled, might be impossible to create install dir..."
  865. fi
  866. if [ ! -d $INST ]; then
  867. $SUDO mkdir -p $INST
  868. fi
  869. if [ ! -w $INST ]; then
  870. $SUDO chown $USER $INST
  871. $SUDO chmod 775 $INST
  872. fi
  873. }
  874. # Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
  875. magic_compile_check() {
  876. if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then
  877. return 0
  878. else
  879. return 1
  880. fi
  881. }
  882. magic_compile_set() {
  883. rm -f $INST/.$1-magiccheck-*
  884. touch $INST/.$1-magiccheck-$2-$USE_CXX11
  885. }
  886. # Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
  887. _clean() {
  888. rm -rf `readlink -f $_inst_shortcut`
  889. # Only remove $_src dir when not using git repo (avoids to re-clone the whole repo every time!!!).
  890. if [ $_git == false ]; then
  891. rm -rf $_src
  892. fi
  893. rm -rf $_inst
  894. rm -rf $_inst_shortcut
  895. }
  896. _create_inst_shortcut() {
  897. rm -f $_inst_shortcut
  898. ln -s $_inst $_inst_shortcut
  899. }
  900. # ldconfig
  901. run_ldconfig() {
  902. _lib_path="$INST/$1/lib"
  903. _ldconf_path="/etc/ld.so.conf.d/$1.conf"
  904. PRINT ""
  905. if [ ! $SUDO ]; then
  906. WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..."
  907. else
  908. INFO "Running ldconfig for $1..."
  909. $SUDO sh -c "echo \"$_lib_path\" > $_ldconf_path"
  910. $SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!!
  911. fi
  912. PRINT ""
  913. }
  914. #### Build Python ####
  915. _init_python() {
  916. _src=$SRC/Python-$PYTHON_VERSION
  917. _git=false
  918. _inst=$INST/python-$PYTHON_VERSION
  919. _inst_shortcut=$INST/python-$PYTHON_VERSION_MIN
  920. }
  921. clean_Python() {
  922. clean_Numpy
  923. _init_python
  924. _clean
  925. }
  926. compile_Python() {
  927. if [ "$NO_BUILD" = true ]; then
  928. WARNING "--no-build enabled, Python will not be compiled!"
  929. return
  930. fi
  931. # To be changed each time we make edits that would modify the compiled result!
  932. py_magic=1
  933. _init_python
  934. # Clean install if needed!
  935. magic_compile_check python-$PYTHON_VERSION $py_magic
  936. if [ $? -eq 1 -o "$PYTHON_FORCE_REBUILD" = true ]; then
  937. clean_Python
  938. fi
  939. if [ ! -d $_inst ]; then
  940. INFO "Building Python-$PYTHON_VERSION"
  941. prepare_opt
  942. if [ ! -d $_src ]; then
  943. mkdir -p $SRC
  944. download PYTHON_SOURCE[@] $_src.tgz
  945. INFO "Unpacking Python-$PYTHON_VERSION"
  946. tar -C $SRC -xf $_src.tgz
  947. fi
  948. cd $_src
  949. ./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \
  950. --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
  951. --with-computed-gotos --with-pymalloc
  952. make -j$THREADS && make install
  953. make clean
  954. if [ -d $_inst ]; then
  955. _create_inst_shortcut
  956. else
  957. ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
  958. exit 1
  959. fi
  960. magic_compile_set python-$PYTHON_VERSION $py_magic
  961. cd $CWD
  962. INFO "Done compiling Python-$PYTHON_VERSION!"
  963. else
  964. INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
  965. INFO "If you want to force rebuild of this lib, use the --force-python option."
  966. fi
  967. }
  968. ##### Build Numpy #####
  969. _init_numpy() {
  970. _src=$SRC/numpy-$NUMPY_VERSION
  971. _git=false
  972. _inst=$INST/numpy-$NUMPY_VERSION
  973. _python=$INST/python-$PYTHON_VERSION
  974. _site=lib/python$PYTHON_VERSION_MIN/site-packages
  975. _inst_shortcut=$_python/$_site/numpy
  976. }
  977. clean_Numpy() {
  978. _init_numpy
  979. _clean
  980. }
  981. compile_Numpy() {
  982. if [ "$NO_BUILD" = true ]; then
  983. WARNING "--no-build enabled, Numpy will not be compiled!"
  984. return
  985. fi
  986. # To be changed each time we make edits that would modify the compiled result!
  987. numpy_magic=0
  988. _init_numpy
  989. # Clean install if needed!
  990. magic_compile_check numpy-$NUMPY_VERSION $numpy_magic
  991. if [ $? -eq 1 -o "$NUMPY_FORCE_REBUILD" = true ]; then
  992. clean_Numpy
  993. fi
  994. if [ ! -d $_inst ]; then
  995. INFO "Building Numpy-$NUMPY_VERSION"
  996. prepare_opt
  997. if [ ! -d $_src ]; then
  998. mkdir -p $SRC
  999. download NUMPY_SOURCE[@] $_src.tar.gz
  1000. INFO "Unpacking Numpy-$NUMPY_VERSION"
  1001. tar -C $SRC -xf $_src.tar.gz
  1002. fi
  1003. cd $_src
  1004. $_python/bin/python3 setup.py install --old-and-unmanageable --prefix=$_inst
  1005. if [ -d $_inst ]; then
  1006. # Can't use _create_inst_shortcut here...
  1007. rm -f $_inst_shortcut
  1008. ln -s $_inst/$_site/numpy $_inst_shortcut
  1009. else
  1010. ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
  1011. exit 1
  1012. fi
  1013. magic_compile_set numpy-$NUMPY_VERSION $numpy_magic
  1014. cd $CWD
  1015. INFO "Done compiling Numpy-$NUMPY_VERSION!"
  1016. else
  1017. INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
  1018. INFO "If you want to force rebuild of this lib, use the --force-numpy option."
  1019. fi
  1020. }
  1021. #### Build Boost ####
  1022. _init_boost() {
  1023. _src=$SRC/boost-$BOOST_VERSION
  1024. _git=false
  1025. _inst=$INST/boost-$BOOST_VERSION
  1026. _inst_shortcut=$INST/boost
  1027. }
  1028. clean_Boost() {
  1029. _init_boost
  1030. _clean
  1031. }
  1032. compile_Boost() {
  1033. if [ "$NO_BUILD" = true ]; then
  1034. WARNING "--no-build enabled, Boost will not be compiled!"
  1035. return
  1036. fi
  1037. # To be changed each time we make edits that would modify the compiled result!
  1038. boost_magic=11
  1039. _init_boost
  1040. # Clean install if needed!
  1041. magic_compile_check boost-$BOOST_VERSION $boost_magic
  1042. if [ $? -eq 1 -o "$BOOST_FORCE_REBUILD" = true ]; then
  1043. clean_Boost
  1044. fi
  1045. if [ ! -d $_inst ]; then
  1046. INFO "Building Boost-$BOOST_VERSION"
  1047. # Rebuild dependencies as well!
  1048. OIIO_FORCE_BUILD=true
  1049. OIIO_FORCE_REBUILD=true
  1050. OSL_FORCE_BUILD=true
  1051. OSL_FORCE_REBUILD=true
  1052. OPENVDB_FORCE_BUILD=true
  1053. OPENVDB_FORCE_REBUILD=true
  1054. prepare_opt
  1055. if [ ! -d $_src ]; then
  1056. INFO "Downloading Boost-$BOOST_VERSION"
  1057. mkdir -p $SRC
  1058. download BOOST_SOURCE[@] $_src.tar.bz2
  1059. tar -C $SRC --transform "s,\w*,boost-$BOOST_VERSION,x" -xf $_src.tar.bz2
  1060. fi
  1061. cd $_src
  1062. if [ ! -f $_src/b2 ]; then
  1063. ./bootstrap.sh
  1064. fi
  1065. ./b2 -j$THREADS -a $BOOST_BUILD_MODULES \
  1066. --prefix=$_inst --disable-icu boost.locale.icu=off install
  1067. ./b2 --clean
  1068. if [ -d $_inst ]; then
  1069. _create_inst_shortcut
  1070. else
  1071. ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
  1072. exit 1
  1073. fi
  1074. magic_compile_set boost-$BOOST_VERSION $boost_magic
  1075. cd $CWD
  1076. INFO "Done compiling Boost-$BOOST_VERSION!"
  1077. else
  1078. INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
  1079. INFO "If you want to force rebuild of this lib, use the --force-boost option."
  1080. fi
  1081. # Just always run it, much simpler this way!
  1082. run_ldconfig "boost"
  1083. }
  1084. #### Build OCIO ####
  1085. _init_ocio() {
  1086. _src=$SRC/OpenColorIO-$OCIO_VERSION
  1087. if [ "$OCIO_USE_REPO" = true ]; then
  1088. _git=true
  1089. else
  1090. _git=false
  1091. fi
  1092. _inst=$INST/ocio-$OCIO_VERSION
  1093. _inst_shortcut=$INST/ocio
  1094. }
  1095. clean_OCIO() {
  1096. _init_ocio
  1097. _clean
  1098. }
  1099. compile_OCIO() {
  1100. if [ "$NO_BUILD" = true ]; then
  1101. WARNING "--no-build enabled, OpenColorIO will not be compiled!"
  1102. return
  1103. fi
  1104. # To be changed each time we make edits that would modify the compiled result!
  1105. ocio_magic=2
  1106. _init_ocio
  1107. # Clean install if needed!
  1108. magic_compile_check ocio-$OCIO_VERSION $ocio_magic
  1109. if [ $? -eq 1 -o "$OCIO_FORCE_REBUILD" = true ]; then
  1110. clean_OCIO
  1111. fi
  1112. if [ ! -d $_inst ]; then
  1113. INFO "Building OpenColorIO-$OCIO_VERSION"
  1114. prepare_opt
  1115. if [ ! -d $_src ]; then
  1116. INFO "Downloading OpenColorIO-$OCIO_VERSION"
  1117. mkdir -p $SRC
  1118. if [ "$OCIO_USE_REPO" = true ]; then
  1119. git clone ${OCIO_SOURCE_REPO[0]} $_src
  1120. else
  1121. download OCIO_SOURCE[@] $_src.tar.gz
  1122. INFO "Unpacking OpenColorIO-$OCIO_VERSION"
  1123. tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
  1124. -xf $_src.tar.gz
  1125. fi
  1126. fi
  1127. cd $_src
  1128. if [ "$OCIO_USE_REPO" = true ]; then
  1129. # XXX For now, always update from latest repo...
  1130. git pull origin master
  1131. git checkout $OCIO_SOURCE_REPO_UID
  1132. git reset --hard
  1133. fi
  1134. # Always refresh the whole build!
  1135. if [ -d build ]; then
  1136. rm -rf build
  1137. fi
  1138. mkdir build
  1139. cd build
  1140. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1141. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1142. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1143. cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF"
  1144. cmake_d="$cmake_d -D OCIO_BUILD_PYGLUE=OFF"
  1145. cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
  1146. if file /bin/cp | grep -q '32-bit'; then
  1147. cflags="-fPIC -m32 -march=i686"
  1148. else
  1149. cflags="-fPIC"
  1150. fi
  1151. cflags="$cflags -Wno-error=unused-function -Wno-error=deprecated-declarations"
  1152. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1153. make -j$THREADS && make install
  1154. # Force linking against static libs
  1155. rm -f $_inst/lib/*.so*
  1156. # Additional depencencies
  1157. cp ext/dist/lib/libtinyxml.a $_inst/lib
  1158. cp ext/dist/lib/libyaml-cpp.a $_inst/lib
  1159. make clean
  1160. if [ -d $_inst ]; then
  1161. _create_inst_shortcut
  1162. else
  1163. ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
  1164. exit 1
  1165. fi
  1166. magic_compile_set ocio-$OCIO_VERSION $ocio_magic
  1167. cd $CWD
  1168. INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
  1169. else
  1170. INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
  1171. INFO "If you want to force rebuild of this lib, use the --force-ocio option."
  1172. fi
  1173. run_ldconfig "ocio"
  1174. }
  1175. #### Build ILMBase ####
  1176. _init_ilmbase() {
  1177. _src=$SRC/ILMBase-$ILMBASE_VERSION
  1178. _git=false
  1179. _inst=$TMP/ilmbase-$ILMBASE_VERSION
  1180. _inst_shortcut=$TMP/ilmbase
  1181. }
  1182. clean_ILMBASE() {
  1183. _init_ilmbase
  1184. _clean
  1185. }
  1186. compile_ILMBASE() {
  1187. if [ "$NO_BUILD" = true ]; then
  1188. WARNING "--no-build enabled, ILMBase will not be compiled!"
  1189. return
  1190. fi
  1191. # To be changed each time we make edits that would modify the compiled result!
  1192. ilmbase_magic=10
  1193. _init_ilmbase
  1194. # Clean install if needed!
  1195. magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
  1196. if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
  1197. clean_ILMBASE
  1198. rm -rf $_openexr_inst
  1199. fi
  1200. if [ ! -d $_openexr_inst ]; then
  1201. INFO "Building ILMBase-$ILMBASE_VERSION"
  1202. # Rebuild dependencies as well!
  1203. OPENEXR_FORCE_BUILD=true
  1204. OPENEXR_FORCE_REBUILD=true
  1205. prepare_opt
  1206. if [ ! -d $_src ]; then
  1207. INFO "Downloading ILMBase-$ILMBASE_VERSION"
  1208. mkdir -p $SRC
  1209. download ILMBASE_SOURCE[@] $_src.tar.gz
  1210. INFO "Unpacking ILMBase-$ILMBASE_VERSION"
  1211. tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" -xf $_src.tar.gz
  1212. fi
  1213. cd $_src
  1214. # Always refresh the whole build!
  1215. if [ -d build ]; then
  1216. rm -rf build
  1217. fi
  1218. mkdir build
  1219. cd build
  1220. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1221. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1222. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1223. cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
  1224. cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
  1225. if file /bin/cp | grep -q '32-bit'; then
  1226. cflags="-fPIC -m32 -march=i686"
  1227. else
  1228. cflags="-fPIC"
  1229. fi
  1230. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1231. make -j$THREADS && make install
  1232. make clean
  1233. if [ -d $_inst ]; then
  1234. _create_inst_shortcut
  1235. else
  1236. ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
  1237. exit 1
  1238. fi
  1239. cd $CWD
  1240. INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
  1241. else
  1242. INFO "Own ILMBase-$ILMBASE_VERSION is up to date, nothing to do!"
  1243. INFO "If you want to force rebuild of this lib (and openexr), use the --force-openexr option."
  1244. fi
  1245. magic_compile_set ilmbase-$ILMBASE_VERSION $ilmbase_magic
  1246. }
  1247. #### Build OpenEXR ####
  1248. _init_openexr() {
  1249. _src=$SRC/OpenEXR-$OPENEXR_VERSION
  1250. _git=true
  1251. _inst=$_openexr_inst
  1252. _inst_shortcut=$INST/openexr
  1253. }
  1254. clean_OPENEXR() {
  1255. clean_ILMBASE
  1256. _init_openexr
  1257. _clean
  1258. }
  1259. compile_OPENEXR() {
  1260. if [ "$NO_BUILD" = true ]; then
  1261. WARNING "--no-build enabled, OpenEXR will not be compiled!"
  1262. return
  1263. fi
  1264. # To be changed each time we make edits that would modify the compiled result!
  1265. openexr_magic=14
  1266. # Clean install if needed!
  1267. magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
  1268. if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
  1269. clean_OPENEXR
  1270. fi
  1271. _openexr_inst=$INST/openexr-$OPENEXR_VERSION
  1272. compile_ILMBASE
  1273. PRINT ""
  1274. _ilmbase_inst=$_inst_shortcut
  1275. _init_openexr
  1276. if [ ! -d $_inst ]; then
  1277. INFO "Building OpenEXR-$OPENEXR_VERSION"
  1278. # Rebuild dependencies as well!
  1279. OIIO_FORCE_BUILD=true
  1280. OIIO_FORCE_REBUILD=true
  1281. prepare_opt
  1282. if [ ! -d $_src ]; then
  1283. INFO "Downloading OpenEXR-$OPENEXR_VERSION"
  1284. mkdir -p $SRC
  1285. if [ "$OPENEXR_USE_REPO" = true ]; then
  1286. git clone ${OPENEXR_SOURCE_REPO[0]} $_src
  1287. else
  1288. download OPENEXR_SOURCE[@] $_src.tar.gz
  1289. INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
  1290. tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz
  1291. fi
  1292. fi
  1293. cd $_src
  1294. if [ "$OPENEXR_USE_REPO" = true ]; then
  1295. # XXX For now, always update from latest repo...
  1296. git pull origin master
  1297. git checkout $OPENEXR_SOURCE_REPO_UID
  1298. git reset --hard
  1299. oiio_src_path="../OpenEXR"
  1300. else
  1301. oiio_src_path=".."
  1302. fi
  1303. # Always refresh the whole build!
  1304. if [ -d build ]; then
  1305. rm -rf build
  1306. fi
  1307. mkdir build
  1308. cd build
  1309. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1310. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1311. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1312. cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
  1313. cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
  1314. cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
  1315. if file /bin/cp | grep -q '32-bit'; then
  1316. cflags="-fPIC -m32 -march=i686"
  1317. else
  1318. cflags="-fPIC"
  1319. fi
  1320. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $oiio_src_path
  1321. make -j$THREADS && make install
  1322. make clean
  1323. if [ -d $_inst ]; then
  1324. _create_inst_shortcut
  1325. # Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
  1326. cp -an $_ilmbase_inst/* $_inst_shortcut
  1327. else
  1328. ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
  1329. exit 1
  1330. fi
  1331. magic_compile_set openexr-$OPENEXR_VERSION $openexr_magic
  1332. cd $CWD
  1333. INFO "Done compiling OpenEXR-$OPENEXR_VERSION!"
  1334. else
  1335. INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!"
  1336. INFO "If you want to force rebuild of this lib, use the --force-openexr option."
  1337. fi
  1338. _with_built_openexr=true
  1339. # Just always run it, much simpler this way!
  1340. run_ldconfig "openexr"
  1341. }
  1342. #### Build OIIO ####
  1343. _init_oiio() {
  1344. _src=$SRC/OpenImageIO-$OIIO_VERSION
  1345. _git=true
  1346. _inst=$INST/oiio-$OIIO_VERSION
  1347. _inst_shortcut=$INST/oiio
  1348. }
  1349. clean_OIIO() {
  1350. _init_oiio
  1351. _clean
  1352. }
  1353. compile_OIIO() {
  1354. if [ "$NO_BUILD" = true ]; then
  1355. WARNING "--no-build enabled, OpenImageIO will not be compiled!"
  1356. return
  1357. fi
  1358. # To be changed each time we make edits that would modify the compiled result!
  1359. oiio_magic=17
  1360. _init_oiio
  1361. # Clean install if needed!
  1362. magic_compile_check oiio-$OIIO_VERSION $oiio_magic
  1363. if [ $? -eq 1 -o "$OIIO_FORCE_REBUILD" = true ]; then
  1364. clean_OIIO
  1365. fi
  1366. if [ ! -d $_inst ]; then
  1367. INFO "Building OpenImageIO-$OIIO_VERSION"
  1368. # Rebuild dependencies as well!
  1369. OSL_FORCE_BUILD=true
  1370. OSL_FORCE_REBUILD=true
  1371. prepare_opt
  1372. if [ ! -d $_src ]; then
  1373. mkdir -p $SRC
  1374. if [ "$OIIO_USE_REPO" = true ]; then
  1375. git clone ${OIIO_SOURCE_REPO[0]} $_src
  1376. else
  1377. download OIIO_SOURCE[@] "$_src.tar.gz"
  1378. INFO "Unpacking OpenImageIO-$OIIO_VERSION"
  1379. tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz
  1380. fi
  1381. fi
  1382. cd $_src
  1383. if [ "$OIIO_USE_REPO" = true ]; then
  1384. # XXX For now, always update from latest repo...
  1385. git pull origin master
  1386. # Stick to same rev as windows' libs...
  1387. git checkout $OIIO_SOURCE_REPO_UID
  1388. git reset --hard
  1389. fi
  1390. # Always refresh the whole build!
  1391. if [ -d build ]; then
  1392. rm -rf build
  1393. fi
  1394. mkdir build
  1395. cd build
  1396. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1397. cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
  1398. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1399. cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
  1400. cmake_d="$cmake_d -D BUILDSTATIC=OFF"
  1401. cmake_d="$cmake_d -D LINKSTATIC=OFF"
  1402. cmake_d="$cmake_d -D USE_SIMD=sse2"
  1403. cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
  1404. if [ "$_with_built_openexr" = true ]; then
  1405. cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
  1406. cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
  1407. INFO "ILMBASE_HOME=$INST/openexr"
  1408. fi
  1409. # ptex is only needed when nicholas bishop is ready
  1410. cmake_d="$cmake_d -D USE_PTEX=OFF"
  1411. # Optional tests and cmd tools
  1412. cmake_d="$cmake_d -D USE_QT=OFF"
  1413. cmake_d="$cmake_d -D USE_PYTHON=OFF"
  1414. cmake_d="$cmake_d -D USE_FFMPEG=OFF"
  1415. cmake_d="$cmake_d -D USE_OPENCV=OFF"
  1416. cmake_d="$cmake_d -D BUILD_TESTING=OFF"
  1417. cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
  1418. cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
  1419. cmake_d="$cmake_d -D TXT2MAN="
  1420. #cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
  1421. #cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
  1422. if [ -d $INST/boost ]; then
  1423. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
  1424. fi
  1425. # Looks like we do not need ocio in oiio for now...
  1426. # if [ -d $INST/ocio ]; then
  1427. # cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
  1428. # fi
  1429. cmake_d="$cmake_d -D USE_OCIO=OFF"
  1430. cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
  1431. if file /bin/cp | grep -q '32-bit'; then
  1432. cflags="-fPIC -m32 -march=i686"
  1433. else
  1434. cflags="-fPIC"
  1435. fi
  1436. cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
  1437. make -j$THREADS && make install
  1438. make clean
  1439. if [ -d $_inst ]; then
  1440. _create_inst_shortcut
  1441. else
  1442. ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
  1443. exit 1
  1444. fi
  1445. magic_compile_set oiio-$OIIO_VERSION $oiio_magic
  1446. cd $CWD
  1447. INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
  1448. else
  1449. INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
  1450. INFO "If you want to force rebuild of this lib, use the --force-oiio option."
  1451. fi
  1452. # Just always run it, much simpler this way!
  1453. run_ldconfig "oiio"
  1454. }
  1455. #### Build LLVM ####
  1456. _init_llvm() {
  1457. _src=$SRC/LLVM-$LLVM_VERSION
  1458. _src_clang=$SRC/CLANG-$LLVM_VERSION
  1459. _git=false
  1460. _inst=$INST/llvm-$LLVM_VERSION
  1461. _inst_shortcut=$INST/llvm
  1462. }
  1463. clean_LLVM() {
  1464. _init_llvm
  1465. _clean
  1466. }
  1467. compile_LLVM() {
  1468. if [ "$NO_BUILD" = true ]; then
  1469. WARNING "--no-build enabled, LLVM will not be compiled!"
  1470. return
  1471. fi
  1472. # To be changed each time we make edits that would modify the compiled result!
  1473. llvm_magic=3
  1474. _init_llvm
  1475. # Clean install if needed!
  1476. magic_compile_check llvm-$LLVM_VERSION $llvm_magic
  1477. if [ $? -eq 1 -o "$LLVM_FORCE_REBUILD" = true ]; then
  1478. clean_LLVM
  1479. fi
  1480. if [ ! -d $_inst ]; then
  1481. INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
  1482. # Rebuild dependencies as well!
  1483. OSL_FORCE_BUILD=true
  1484. OSL_FORCE_REBUILD=true
  1485. prepare_opt
  1486. if [ ! -d $_src -o true ]; then
  1487. mkdir -p $SRC
  1488. download LLVM_SOURCE[@] "$_src.tar.xz"
  1489. download LLVM_CLANG_SOURCE[@] "$_src_clang.tar.xz"
  1490. INFO "Unpacking LLVM-$LLVM_VERSION"
  1491. tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
  1492. -xf $_src.tar.xz
  1493. INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
  1494. # Stupid clang guys renamed 'clang' to 'cfe' for now handle both cases... :(
  1495. tar -C $_src/tools \
  1496. --transform "s,([^/]*/?)(clang|cfe)-[^/]*(.*),\1clang\3,x" \
  1497. -xf $_src_clang.tar.xz
  1498. cd $_src
  1499. cd $CWD
  1500. fi
  1501. cd $_src
  1502. # Always refresh the whole build!
  1503. if [ -d build ]; then
  1504. rm -rf build
  1505. fi
  1506. mkdir build
  1507. cd build
  1508. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1509. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1510. cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
  1511. cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
  1512. cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF"
  1513. if [ -d $_FFI_INCLUDE_DIR ]; then
  1514. cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
  1515. fi
  1516. cmake $cmake_d ..
  1517. make -j$THREADS && make install
  1518. make clean
  1519. if [ -d $_inst ]; then
  1520. _create_inst_shortcut
  1521. else
  1522. ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
  1523. exit 1
  1524. fi
  1525. magic_compile_set llvm-$LLVM_VERSION $llvm_magic
  1526. cd $CWD
  1527. INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
  1528. else
  1529. INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
  1530. INFO "If you want to force rebuild of this lib, use the --force-llvm option."
  1531. fi
  1532. }
  1533. #### Build OSL ####
  1534. _init_osl() {
  1535. _src=$SRC/OpenShadingLanguage-$OSL_VERSION
  1536. _git=true
  1537. _inst=$INST/osl-$OSL_VERSION
  1538. _inst_shortcut=$INST/osl
  1539. }
  1540. clean_OSL() {
  1541. _init_osl
  1542. _clean
  1543. }
  1544. compile_OSL() {
  1545. if [ "$NO_BUILD" = true ]; then
  1546. WARNING "--no-build enabled, OpenShadingLanguage will not be compiled!"
  1547. return
  1548. fi
  1549. # To be changed each time we make edits that would modify the compiled result!
  1550. osl_magic=21
  1551. _init_osl
  1552. # Clean install if needed!
  1553. magic_compile_check osl-$OSL_VERSION $osl_magic
  1554. if [ $? -eq 1 -o "$OSL_FORCE_REBUILD" = true ]; then
  1555. #~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
  1556. clean_OSL
  1557. fi
  1558. if [ ! -d $_inst ]; then
  1559. INFO "Building OpenShadingLanguage-$OSL_VERSION"
  1560. prepare_opt
  1561. if [ ! -d $_src ]; then
  1562. mkdir -p $SRC
  1563. if [ "$OSL_USE_REPO" = true ]; then
  1564. git clone ${OSL_SOURCE_REPO[0]} $_src
  1565. else
  1566. download OSL_SOURCE[@] "$_src.tar.gz"
  1567. INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
  1568. tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
  1569. -xf $_src.tar.gz
  1570. fi
  1571. fi
  1572. cd $_src
  1573. if [ "$OSL_USE_REPO" = true ]; then
  1574. git remote set-url origin ${OSL_SOURCE_REPO[0]}
  1575. # XXX For now, always update from latest repo...
  1576. git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH
  1577. # Stick to same rev as windows' libs...
  1578. git checkout $OSL_SOURCE_REPO_UID
  1579. git reset --hard
  1580. fi
  1581. # Always refresh the whole build!
  1582. if [ -d build ]; then
  1583. rm -rf build
  1584. fi
  1585. mkdir build
  1586. cd build
  1587. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1588. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1589. cmake_d="$cmake_d -D BUILD_TESTING=OFF"
  1590. cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
  1591. cmake_d="$cmake_d -D BUILDSTATIC=OFF"
  1592. cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
  1593. cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
  1594. cmake_d="$cmake_d -D USE_SIMD=sse2"
  1595. cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
  1596. #~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
  1597. if [ "$_with_built_openexr" = true ]; then
  1598. INFO "ILMBASE_HOME=$INST/openexr"
  1599. cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
  1600. # XXX Temp workaround... sigh, ILMBase really messed the things up by defining their custom names ON by default :(
  1601. cmake_d="$cmake_d -D ILMBASE_CUSTOM=ON"
  1602. cmake_d="$cmake_d -D ILMBASE_CUSTOM_LIBRARIES='Half;Iex;Imath;IlmThread'"
  1603. fi
  1604. if [ -d $INST/boost ]; then
  1605. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
  1606. fi
  1607. if [ -d $INST/oiio ]; then
  1608. cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
  1609. fi
  1610. if [ ! -z $LLVM_VERSION_FOUND ]; then
  1611. cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
  1612. if [ -d $INST/llvm ]; then
  1613. cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
  1614. cmake_d="$cmake_d -D LLVM_STATIC=ON"
  1615. fi
  1616. fi
  1617. #~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
  1618. #~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
  1619. cmake $cmake_d ..
  1620. make -j$THREADS && make install
  1621. make clean
  1622. if [ -d $_inst ]; then
  1623. _create_inst_shortcut
  1624. else
  1625. ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
  1626. exit 1
  1627. fi
  1628. magic_compile_set osl-$OSL_VERSION $osl_magic
  1629. cd $CWD
  1630. INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
  1631. else
  1632. INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
  1633. INFO "If you want to force rebuild of this lib, use the --force-osl option."
  1634. fi
  1635. run_ldconfig "osl"
  1636. }
  1637. #### Build OSD ####
  1638. _init_osd() {
  1639. _src=$SRC/OpenSubdiv-$OSD_VERSION
  1640. _git=true
  1641. _inst=$INST/osd-$OSD_VERSION
  1642. _inst_shortcut=$INST/osd
  1643. }
  1644. clean_OSD() {
  1645. _init_osd
  1646. _clean
  1647. }
  1648. compile_OSD() {
  1649. if [ "$NO_BUILD" = true ]; then
  1650. WARNING "--no-build enabled, OpenSubdiv will not be compiled!"
  1651. return
  1652. fi
  1653. # To be changed each time we make edits that would modify the compiled result!
  1654. osd_magic=2
  1655. _init_osd
  1656. # Clean install if needed!
  1657. magic_compile_check osd-$OSD_VERSION $osd_magic
  1658. if [ $? -eq 1 -o "$OSD_FORCE_REBUILD" = true ]; then
  1659. clean_OSD
  1660. fi
  1661. if [ ! -d $_inst ]; then
  1662. INFO "Building OpenSubdiv-$OSD_VERSION"
  1663. prepare_opt
  1664. if [ ! -d $_src ]; then
  1665. mkdir -p $SRC
  1666. if [ "$OSD_USE_REPO" = true ]; then
  1667. git clone ${OSD_SOURCE_REPO[0]} $_src
  1668. else
  1669. download OSD_SOURCE[@] "$_src.tar.gz"
  1670. INFO "Unpacking OpenSubdiv-$OSD_VERSION"
  1671. tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
  1672. -xf $_src.tar.gz
  1673. fi
  1674. fi
  1675. cd $_src
  1676. if [ "$OSD_USE_REPO" = true ]; then
  1677. git remote set-url origin ${OSD_SOURCE_REPO[0]}
  1678. # XXX For now, always update from latest repo...
  1679. git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
  1680. # Stick to same rev as windows' libs...
  1681. git checkout $OSD_SOURCE_REPO_UID
  1682. git reset --hard
  1683. fi
  1684. # Always refresh the whole build!
  1685. if [ -d build ]; then
  1686. rm -rf build
  1687. fi
  1688. mkdir build
  1689. cd build
  1690. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1691. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1692. # ptex is only needed when nicholas bishop is ready
  1693. cmake_d="$cmake_d -D NO_PTEX=1"
  1694. cmake_d="$cmake_d -D NO_CLEW=1 -D NO_CUDA=1 -D NO_OPENCL=1"
  1695. # maya plugin, docs, tutorials, regression tests and examples are not needed
  1696. cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
  1697. cmake $cmake_d ..
  1698. make -j$THREADS && make install
  1699. make clean
  1700. if [ -d $_inst ]; then
  1701. _create_inst_shortcut
  1702. else
  1703. ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
  1704. exit 1
  1705. fi
  1706. magic_compile_set osd-$OSD_VERSION $osd_magic
  1707. cd $CWD
  1708. INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
  1709. else
  1710. INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
  1711. INFO "If you want to force rebuild of this lib, use the --force-osd option."
  1712. fi
  1713. run_ldconfig "osd"
  1714. }
  1715. #### Build Blosc ####
  1716. _init_blosc() {
  1717. _src=$SRC/c-blosc-$OPENVDB_BLOSC_VERSION
  1718. _git=false
  1719. _inst=$INST/blosc-$OPENVDB_BLOSC_VERSION
  1720. _inst_shortcut=$INST/blosc
  1721. }
  1722. clean_BLOSC() {
  1723. _init_blosc
  1724. _clean
  1725. }
  1726. compile_BLOSC() {
  1727. if [ "$NO_BUILD" = true ]; then
  1728. WARNING "--no-build enabled, Blosc will not be compiled!"
  1729. return
  1730. fi
  1731. # To be changed each time we make edits that would modify the compiled result!
  1732. blosc_magic=0
  1733. _init_blosc
  1734. # Clean install if needed!
  1735. magic_compile_check blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
  1736. if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
  1737. clean_BLOSC
  1738. rm -rf $_inst
  1739. fi
  1740. if [ ! -d $_inst ]; then
  1741. INFO "Building Blosc-$OPENVDB_BLOSC_VERSION"
  1742. # Rebuild dependencies as well!
  1743. OPENVDB_FORCE_BUILD=true
  1744. OPENVDB_FORCE_REBUILD=true
  1745. prepare_opt
  1746. if [ ! -d $_src ]; then
  1747. INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION"
  1748. mkdir -p $SRC
  1749. download OPENVDB_BLOSC_SOURCE[@] $_src.tar.gz
  1750. INFO "Unpacking Blosc-$OPENVDB_BLOSC_VERSION"
  1751. tar -C $SRC -xf $_src.tar.gz
  1752. fi
  1753. cd $_src
  1754. # Always refresh the whole build!
  1755. if [ -d build ]; then
  1756. rm -rf build
  1757. fi
  1758. mkdir build
  1759. cd build
  1760. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1761. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1762. cmake_d="$cmake_d -D BUILD_STATIC=OFF"
  1763. cmake_d="$cmake_d -D BUILD_TESTS=OFF"
  1764. cmake_d="$cmake_d -D BUILD_BENCHMARKS=OFF"
  1765. INFO "$cmake_d"
  1766. cmake $cmake_d ..
  1767. make -j$THREADS && make install
  1768. make clean
  1769. if [ -d $_inst ]; then
  1770. _create_inst_shortcut
  1771. else
  1772. ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
  1773. exit 1
  1774. fi
  1775. cd $CWD
  1776. INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!"
  1777. else
  1778. INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!"
  1779. INFO "If you want to force rebuild of this lib (and openvdb), use the --force-openvdb option."
  1780. fi
  1781. magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
  1782. run_ldconfig "blosc"
  1783. }
  1784. #### Build OpenVDB ####
  1785. _init_openvdb() {
  1786. _src=$SRC/openvdb-$OPENVDB_VERSION
  1787. _git=false
  1788. _inst=$INST/openvdb-$OPENVDB_VERSION
  1789. _inst_shortcut=$INST/openvdb
  1790. }
  1791. clean_OPENVDB() {
  1792. _init_openvdb
  1793. _clean
  1794. }
  1795. compile_OPENVDB() {
  1796. if [ "$NO_BUILD" = true ]; then
  1797. WARNING "--no-build enabled, OpenVDB will not be compiled!"
  1798. return
  1799. fi
  1800. compile_BLOSC
  1801. PRINT ""
  1802. # To be changed each time we make edits that would modify the compiled result!
  1803. openvdb_magic=1
  1804. _init_openvdb
  1805. # Clean install if needed!
  1806. magic_compile_check openvdb-$OPENVDB_VERSION $openvdb_magic
  1807. if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
  1808. clean_OPENVDB
  1809. fi
  1810. if [ ! -d $_inst ]; then
  1811. INFO "Building OpenVDB-$OPENVDB_VERSION"
  1812. prepare_opt
  1813. if [ ! -d $_src -o true ]; then
  1814. mkdir -p $SRC
  1815. download OPENVDB_SOURCE[@] "$_src.tar.gz"
  1816. INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
  1817. tar -C $SRC -xf $_src.tar.gz
  1818. fi
  1819. cd $_src
  1820. #~ if [ "$OPENVDB_USE_REPO" = true ]; then
  1821. #~ git remote set-url origin ${OPENVDB_SOURCE_REPO[0]}
  1822. #~ # XXX For now, always update from latest repo...
  1823. #~ git pull --no-edit -X theirs origin $OPENVDB_SOURCE_REPO_BRANCH
  1824. #~ # Stick to same rev as windows' libs...
  1825. #~ git checkout $OPENVDB_SOURCE_REPO_UID
  1826. #~ git reset --hard
  1827. #~ fi
  1828. # Source builds here
  1829. cd openvdb
  1830. make_d="DESTDIR=$_inst"
  1831. make_d="$make_d HDSO=/usr"
  1832. if [ -d $INST/boost ]; then
  1833. make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib"
  1834. fi
  1835. if [ "$_with_built_openexr" = true ]; then
  1836. make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib"
  1837. make_d="$make_d EXR_INCL_DIR=$INST/openexr/include EXR_LIB_DIR=$INST/openexr/lib"
  1838. INFO "ILMBASE_HOME=$INST/openexr"
  1839. fi
  1840. if [ -d $INST/blosc ]; then
  1841. make_d="$make_d BLOSC_INCL_DIR=$INST/blosc/include BLOSC_LIB_DIR=$INST/blosc/lib"
  1842. fi
  1843. # Build without log4cplus, glfw, python module & docs
  1844. make_d="$make_d LOG4CPLUS_INCL_DIR= GLFW_INCL_DIR= PYTHON_VERSION= DOXYGEN="
  1845. make -j$THREADS lib $make_d install
  1846. make clean
  1847. if [ -d $_inst ]; then
  1848. _create_inst_shortcut
  1849. else
  1850. ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
  1851. exit 1
  1852. fi
  1853. magic_compile_set openvdb-$OPENVDB_VERSION $openvdb_magic
  1854. cd $CWD
  1855. INFO "Done compiling OpenVDB-$OPENVDB_VERSION!"
  1856. else
  1857. INFO "Own OpenVDB-$OPENVDB_VERSION is up to date, nothing to do!"
  1858. INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
  1859. fi
  1860. run_ldconfig "openvdb"
  1861. }
  1862. #### Build Alembic ####
  1863. _init_alembic() {
  1864. _src=$SRC/alembic-$ALEMBIC_VERSION
  1865. _git=false
  1866. _inst=$INST/alembic-$ALEMBIC_VERSION
  1867. _inst_shortcut=$INST/alembic
  1868. }
  1869. clean_ALEMBIC() {
  1870. _init_alembic
  1871. _clean
  1872. }
  1873. compile_ALEMBIC() {
  1874. if [ "$NO_BUILD" = true ]; then
  1875. WARNING "--no-build enabled, Alembic will not be compiled!"
  1876. return
  1877. fi
  1878. # To be changed each time we make edits that would modify the compiled result!
  1879. alembic_magic=2
  1880. _init_alembic
  1881. # Clean install if needed!
  1882. magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
  1883. if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
  1884. clean_ALEMBIC
  1885. fi
  1886. if [ ! -d $_inst ]; then
  1887. INFO "Building Alembic-$ALEMBIC_VERSION"
  1888. prepare_opt
  1889. if [ ! -d $_src -o true ]; then
  1890. mkdir -p $SRC
  1891. download ALEMBIC_SOURCE[@] "$_src.tar.gz"
  1892. INFO "Unpacking Alembic-$ALEMBIC_VERSION"
  1893. tar -C $SRC -xf $_src.tar.gz
  1894. fi
  1895. cd $_src
  1896. cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
  1897. if [ -d $INST/boost ]; then
  1898. if [ -d $INST/boost ]; then
  1899. cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
  1900. fi
  1901. cmake_d="$cmake_d -D USE_STATIC_BOOST=ON"
  1902. else
  1903. cmake_d="$cmake_d -D USE_STATIC_BOOST=OFF"
  1904. fi
  1905. if [ "$_with_built_openexr" = true ]; then
  1906. cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
  1907. cmake_d="$cmake_d -D USE_ARNOLD=OFF"
  1908. cmake_d="$cmake_d -D USE_BINARIES=OFF"
  1909. cmake_d="$cmake_d -D USE_EXAMPLES=OFF"
  1910. cmake_d="$cmake_d -D USE_HDF5=OFF"
  1911. cmake_d="$cmake_d -D USE_MAYA=OFF"
  1912. cmake_d="$cmake_d -D USE_PRMAN=OFF"
  1913. cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
  1914. cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF"
  1915. cmake_d="$cmake_d -D ALEMBIC_ILMBASE_LINK_STATIC=OFF"
  1916. cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF"
  1917. INFO "ILMBASE_ROOT=$INST/openexr"
  1918. fi
  1919. cmake $cmake_d ./
  1920. make -j$THREADS install
  1921. make clean
  1922. if [ -d $_inst ]; then
  1923. _create_inst_shortcut
  1924. else
  1925. ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
  1926. exit 1
  1927. fi
  1928. magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
  1929. cd $CWD
  1930. INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
  1931. else
  1932. INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
  1933. INFO "If you want to force rebuild of this lib, use the --force-alembic option."
  1934. fi
  1935. run_ldconfig "alembic"
  1936. }
  1937. #### Build OpenCOLLADA ####
  1938. _init_opencollada() {
  1939. _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
  1940. _git=true
  1941. _inst=$INST/opencollada-$OPENCOLLADA_VERSION
  1942. _inst_shortcut=$INST/opencollada
  1943. }
  1944. clean_OpenCOLLADA() {
  1945. _init_opencollada
  1946. _clean
  1947. }
  1948. compile_OpenCOLLADA() {
  1949. if [ "$NO_BUILD" = true ]; then
  1950. WARNING "--no-build enabled, OpenCOLLADA will not be compiled!"
  1951. return
  1952. fi
  1953. # To be changed each time we make edits that would modify the compiled results!
  1954. opencollada_magic=9
  1955. _init_opencollada
  1956. # Clean install if needed!
  1957. magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
  1958. if [ $? -eq 1 -o "$OPENCOLLADA_FORCE_REBUILD" = true ]; then
  1959. clean_OpenCOLLADA
  1960. fi
  1961. if [ ! -d $_inst ]; then
  1962. INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
  1963. prepare_opt
  1964. if [ ! -d $_src ]; then
  1965. mkdir -p $SRC
  1966. if [ "$OPENCOLLADA_USE_REPO" = true ]; then
  1967. git clone $OPENCOLLADA_SOURCE_REPO $_src
  1968. else
  1969. download OPENCOLLADA_SOURCE[@] "$_src.tar.gz"
  1970. INFO "Unpacking OpenCOLLADA-$OPENCOLLADA_VERSION"
  1971. tar -C $SRC -xf $_src.tar.gz
  1972. fi
  1973. fi
  1974. cd $_src
  1975. if [ "$OPENCOLLADA_USE_REPO" = true ]; then
  1976. git pull origin $OPENCOLLADA_REPO_BRANCH
  1977. # Stick to same rev as windows' libs...
  1978. git checkout $OPENCOLLADA_REPO_UID
  1979. git reset --hard
  1980. fi
  1981. # Always refresh the whole build!
  1982. if [ -d build ]; then
  1983. rm -rf build
  1984. fi
  1985. mkdir build
  1986. cd build
  1987. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  1988. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  1989. cmake_d="$cmake_d -D USE_EXPAT=OFF"
  1990. cmake_d="$cmake_d -D USE_LIBXML=ON"
  1991. # XXX Does not work!
  1992. # cmake_d="$cmake_d -D USE_STATIC=OFF"
  1993. cmake_d="$cmake_d -D USE_STATIC=ON"
  1994. cmake $cmake_d ../
  1995. make -j$THREADS && make install
  1996. make clean
  1997. if [ -d $_inst ]; then
  1998. _create_inst_shortcut
  1999. else
  2000. ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
  2001. exit 1
  2002. fi
  2003. magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
  2004. cd $CWD
  2005. INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
  2006. else
  2007. INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
  2008. INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
  2009. fi
  2010. }
  2011. #### Build Embree ####
  2012. _init_embree() {
  2013. _src=$SRC/embree-$EMBREE_VERSION
  2014. _git=true
  2015. _inst=$INST/embree-$EMBREE_VERSION
  2016. _inst_shortcut=$INST/embree
  2017. }
  2018. clean_Embree() {
  2019. _init_embree
  2020. _clean
  2021. }
  2022. compile_Embree() {
  2023. if [ "$NO_BUILD" = true ]; then
  2024. WARNING "--no-build enabled, Embree will not be compiled!"
  2025. return
  2026. fi
  2027. # To be changed each time we make edits that would modify the compiled results!
  2028. embree_magic=9
  2029. _init_embree
  2030. # Clean install if needed!
  2031. magic_compile_check embree-$EMBREE_VERSION $embree_magic
  2032. if [ $? -eq 1 -o "$EMBREE_FORCE_REBUILD" = true ]; then
  2033. clean_Embree
  2034. fi
  2035. if [ ! -d $_inst ]; then
  2036. INFO "Building Embree-$EMBREE_VERSION"
  2037. prepare_opt
  2038. if [ ! -d $_src ]; then
  2039. mkdir -p $SRC
  2040. if [ "EMBREE_USE_REPO" = true ]; then
  2041. git clone $EMBREE_SOURCE_REPO $_src
  2042. else
  2043. download EMBREE_SOURCE[@] "$_src.tar.gz"
  2044. INFO "Unpacking Embree-$EMBREE_VERSION"
  2045. tar -C $SRC -xf $_src.tar.gz
  2046. fi
  2047. fi
  2048. cd $_src
  2049. if [ "$EMBREE_USE_REPO" = true ]; then
  2050. git pull origin $EMBREE_REPO_BRANCH
  2051. # Stick to same rev as windows' libs...
  2052. git checkout $EMBREE_REPO_UID
  2053. git reset --hard
  2054. fi
  2055. # Always refresh the whole build!
  2056. if [ -d build ]; then
  2057. rm -rf build
  2058. fi
  2059. mkdir build
  2060. cd build
  2061. cmake_d="-D CMAKE_BUILD_TYPE=Release"
  2062. cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
  2063. cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF"
  2064. cmake_d="$cmake_d -D EMBREE_TUTORIALS=OFF"
  2065. cmake_d="$cmake_d -D EMBREE_STATIC_LIB=ON"
  2066. cmake_d="$cmake_d -D EMBREE_RAY_MASK=ON"
  2067. cmake_d="$cmake_d -D EMBREE_FILTER_FUNCTION=ON"
  2068. cmake_d="$cmake_d -D EMBREE_BACKFACE_CULLING=OFF"
  2069. cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=INTERNAL"
  2070. cmake_d="$cmake_d -D EMBREE_MAX_ISA=AVX2"
  2071. cmake $cmake_d ../
  2072. make -j$THREADS && make install
  2073. make clean
  2074. if [ -d $_inst ]; then
  2075. _create_inst_shortcut
  2076. else
  2077. ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
  2078. exit 1
  2079. fi
  2080. magic_compile_set embree-$EMBREE_VERSION $embree_magic
  2081. cd $CWD
  2082. INFO "Done compiling Embree-$EMBREE_VERSION!"
  2083. else
  2084. INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
  2085. INFO "If you want to force rebuild of this lib, use the --force-embree option."
  2086. fi
  2087. }
  2088. #### Build FFMPEG ####
  2089. _init_ffmpeg() {
  2090. _src=$SRC/ffmpeg-$FFMPEG_VERSION
  2091. _inst=$INST/ffmpeg-$FFMPEG_VERSION
  2092. _inst_shortcut=$INST/ffmpeg
  2093. }
  2094. clean_FFmpeg() {
  2095. _init_ffmpeg
  2096. _clean
  2097. }
  2098. compile_FFmpeg() {
  2099. if [ "$NO_BUILD" = true ]; then
  2100. WARNING "--no-build enabled, ffmpeg will not be compiled!"
  2101. return
  2102. fi
  2103. # To be changed each time we make edits that would modify the compiled result!
  2104. ffmpeg_magic=5
  2105. _init_ffmpeg
  2106. # Clean install if needed!
  2107. magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
  2108. if [ $? -eq 1 -o "$FFMPEG_FORCE_REBUILD" = true ]; then
  2109. clean_FFmpeg
  2110. fi
  2111. if [ ! -d $_inst ]; then
  2112. INFO "Building ffmpeg-$FFMPEG_VERSION"
  2113. prepare_opt
  2114. if [ ! -d $_src ]; then
  2115. INFO "Downloading ffmpeg-$FFMPEG_VERSION"
  2116. mkdir -p $SRC
  2117. download FFMPEG_SOURCE[@] "$_src.tar.bz2"
  2118. INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
  2119. tar -C $SRC -xf $_src.tar.bz2
  2120. fi
  2121. cd $_src
  2122. extra=""
  2123. if [ "$VORBIS_USE" = true ]; then
  2124. extra="$extra --enable-libvorbis"
  2125. fi
  2126. if [ "$THEORA_USE" = true ]; then
  2127. extra="$extra --enable-libtheora"
  2128. fi
  2129. if [ "$XVID_USE" = true ]; then
  2130. extra="$extra --enable-libxvid"
  2131. fi
  2132. if [ "$X264_USE" = true ]; then
  2133. extra="$extra --enable-libx264"
  2134. fi
  2135. if [ "$VPX_USE" = true ]; then
  2136. extra="$extra --enable-libvpx"
  2137. fi
  2138. if [ "$MP3LAME_USE" = true ]; then
  2139. extra="$extra --enable-libmp3lame"
  2140. fi
  2141. if [ "$OPENJPEG_USE" = true ]; then
  2142. extra="$extra --enable-libopenjpeg"
  2143. fi
  2144. ./configure --cc="gcc -Wl,--as-needed" \
  2145. --extra-ldflags="-pthread -static-libgcc" \
  2146. --prefix=$_inst --enable-static \
  2147. --disable-ffplay --disable-doc \
  2148. --enable-gray \
  2149. --enable-avfilter --disable-vdpau \
  2150. --disable-bzlib --disable-libgsm --disable-libspeex \
  2151. --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
  2152. --disable-vaapi --disable-nonfree --enable-gpl \
  2153. --disable-postproc --disable-librtmp --disable-libopencore-amrnb \
  2154. --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
  2155. --disable-libxcb \
  2156. --disable-outdev=xv --disable-indev=sndio --disable-outdev=sndio \
  2157. --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
  2158. --disable-indev=lavfi $extra
  2159. make -j$THREADS && make install
  2160. make clean
  2161. if [ -d $_inst ]; then
  2162. _create_inst_shortcut
  2163. else
  2164. ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
  2165. exit 1
  2166. fi
  2167. magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
  2168. cd $CWD
  2169. INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
  2170. else
  2171. INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
  2172. INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
  2173. fi
  2174. }
  2175. #### Install on DEB-like ####
  2176. get_package_version_DEB() {
  2177. dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?)+([0-9]+)).*/\2/'
  2178. }
  2179. check_package_DEB() {
  2180. r=`apt-cache show $1 | grep -c 'Package:'`
  2181. if [ $r -ge 1 ]; then
  2182. return 0
  2183. else
  2184. return 1
  2185. fi
  2186. }
  2187. check_package_installed_DEB() {
  2188. r=`dpkg-query -W -f='${Status}' $1 | grep -c "install ok"`
  2189. if [ $r -ge 1 ]; then
  2190. return 0
  2191. else
  2192. return 1
  2193. fi
  2194. }
  2195. check_package_version_match_DEB() {
  2196. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
  2197. if [ -z "$v" ]; then
  2198. return 1
  2199. fi
  2200. version_match $v $2
  2201. return $?
  2202. }
  2203. check_package_version_ge_DEB() {
  2204. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
  2205. if [ -z "$v" ]; then
  2206. return 1
  2207. fi
  2208. version_ge $v $2
  2209. return $?
  2210. }
  2211. check_package_version_ge_lt_DEB() {
  2212. v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
  2213. if [ -z "$v" ]; then
  2214. return 1
  2215. fi
  2216. version_ge_lt $v $2 $3
  2217. return $?
  2218. }
  2219. install_packages_DEB() {
  2220. if [ ! $SUDO ]; then
  2221. WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..."
  2222. else
  2223. $SUDO apt-get install -y $@
  2224. if [ $? -ge 1 ]; then
  2225. ERROR "apt-get failed to install requested packages, exiting."
  2226. exit 1
  2227. fi
  2228. fi
  2229. }
  2230. install_DEB() {
  2231. PRINT ""
  2232. INFO "Installing dependencies for DEB-based distribution"
  2233. PRINT ""
  2234. PRINT "`eval _echo "$COMMON_INFO"`"
  2235. PRINT ""
  2236. if [ "$NO_CONFIRM" = false ]; then
  2237. read -p "Do you want to continue (Y/n)?"
  2238. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  2239. fi
  2240. if [ ! $SUDO ]; then
  2241. WARNING "--no-sudo enabled, impossible to run apt-get update, you'll have to do it yourself..."
  2242. else
  2243. $SUDO apt-get update
  2244. fi
  2245. # These libs should always be available in debian/ubuntu official repository...
  2246. VORBIS_DEV="libvorbis-dev"
  2247. OGG_DEV="libogg-dev"
  2248. THEORA_DEV="libtheora-dev"
  2249. _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
  2250. git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \
  2251. libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
  2252. libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
  2253. libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
  2254. libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
  2255. # libglewmx-dev (broken in deb testing currently...)
  2256. VORBIS_USE=true
  2257. OGG_USE=true
  2258. THEORA_USE=true
  2259. PRINT ""
  2260. # We need openjp2, libopenjpeg is an old version
  2261. OPENJPEG_DEV="libopenjp2-7-dev"
  2262. check_package_DEB $OPENJPEG_DEV
  2263. if [ $? -eq 0 ]; then
  2264. _packages="$_packages $OPENJPEG_DEV"
  2265. OPENJPEG_USE=true
  2266. fi
  2267. PRINT ""
  2268. # Some not-so-old distro (ubuntu 12.4) do not have it, do not fail in this case, just warn.
  2269. YAMLCPP_DEV="libyaml-cpp-dev"
  2270. check_package_DEB $YAMLCPP_DEV
  2271. if [ $? -eq 0 ]; then
  2272. _packages="$_packages $YAMLCPP_DEV"
  2273. else
  2274. PRINT ""
  2275. WARNING "libyaml-cpp-dev not found, you may have to install it by hand to get Blender compiling..."
  2276. PRINT ""
  2277. fi
  2278. PRINT ""
  2279. CLANG_FORMAT="clang-format"
  2280. check_package_version_ge_DEB $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN
  2281. if [ $? -eq 0 ]; then
  2282. _packages="$_packages $CLANG_FORMAT"
  2283. else
  2284. PRINT ""
  2285. WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..."
  2286. PRINT ""
  2287. fi
  2288. if [ "$WITH_JACK" = true ]; then
  2289. _packages="$_packages libspnav-dev"
  2290. # Only install jack if jack2 is not already installed!
  2291. JACK="libjack-dev"
  2292. JACK2="libjack-jackd2-dev"
  2293. check_package_installed_DEB $JACK2
  2294. if [ $? -eq 0 ]; then
  2295. _packages="$_packages $JACK2"
  2296. else
  2297. _packages="$_packages $JACK"
  2298. fi
  2299. fi
  2300. PRINT ""
  2301. install_packages_DEB $_packages
  2302. PRINT""
  2303. LIBSNDFILE_DEV="libsndfile1-dev"
  2304. check_package_DEB $LIBSNDFILE_DEV
  2305. if [ $? -eq 0 ]; then
  2306. install_packages_DEB $LIBSNDFILE_DEV
  2307. fi
  2308. PRINT ""
  2309. X264_DEV="libx264-dev"
  2310. check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
  2311. if [ $? -eq 0 ]; then
  2312. install_packages_DEB $X264_DEV
  2313. X264_USE=true
  2314. fi
  2315. if [ "$WITH_ALL" = true ]; then
  2316. PRINT ""
  2317. XVID_DEV="libxvidcore-dev"
  2318. check_package_DEB $XVID_DEV
  2319. if [ $? -eq 0 ]; then
  2320. install_packages_DEB $XVID_DEV
  2321. XVID_USE=true
  2322. fi
  2323. PRINT ""
  2324. MP3LAME_DEV="libmp3lame-dev"
  2325. check_package_DEB $MP3LAME_DEV
  2326. if [ $? -eq 0 ]; then
  2327. install_packages_DEB $MP3LAME_DEV
  2328. MP3LAME_USE=true
  2329. fi
  2330. PRINT ""
  2331. VPX_DEV="libvpx-dev"
  2332. check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
  2333. if [ $? -eq 0 ]; then
  2334. install_packages_DEB $VPX_DEV
  2335. VPX_USE=true
  2336. fi
  2337. fi
  2338. # Check cmake/glew versions and disable features for older distros.
  2339. # This is so Blender can at least compile.
  2340. PRINT ""
  2341. _cmake=`get_package_version_DEB cmake`
  2342. version_ge $_cmake "2.8.10"
  2343. if [ $? -eq 1 ]; then
  2344. version_ge $_cmake "2.8.8"
  2345. if [ $? -eq 1 ]; then
  2346. WARNING "OpenVDB and OpenCOLLADA disabled because cmake-$_cmake is not enough"
  2347. OPENVDB_SKIP=true
  2348. OPENCOLLADA_SKIP=true
  2349. else
  2350. WARNING "OpenVDB disabled because cmake-$_cmake is not enough"
  2351. OPENVDB_SKIP=true
  2352. fi
  2353. fi
  2354. PRINT ""
  2355. _glew=`get_package_version_DEB libglew-dev`
  2356. if [ -z $_glew ]; then
  2357. # Stupid virtual package in Ubuntu 12.04 doesn't show version number...
  2358. _glew=`apt-cache showpkg libglew-dev|tail -n1|awk '{print $2}'|sed 's/-.*//'`
  2359. fi
  2360. version_ge $_glew "1.9.0"
  2361. if [ $? -eq 1 ]; then
  2362. version_ge $_glew "1.7.0"
  2363. if [ $? -eq 1 ]; then
  2364. WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
  2365. WARNING "Blender will not use system GLEW library"
  2366. OSD_SKIP=true
  2367. NO_SYSTEM_GLEW=true
  2368. else
  2369. WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited capability"
  2370. WARNING "Blender will not use system GLEW library"
  2371. NO_SYSTEM_GLEW=true
  2372. fi
  2373. fi
  2374. PRINT ""
  2375. _do_compile_python=false
  2376. if [ "$PYTHON_SKIP" = true ]; then
  2377. WARNING "Skipping Python/NumPy installation, as requested..."
  2378. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  2379. INFO "Forced Python/NumPy building, as requested..."
  2380. _do_compile_python=true
  2381. else
  2382. check_package_DEB python$PYTHON_VERSION_MIN-dev
  2383. if [ $? -eq 0 ]; then
  2384. install_packages_DEB python$PYTHON_VERSION_MIN-dev
  2385. clean_Python
  2386. PRINT ""
  2387. if [ "$NUMPY_SKIP" = true ]; then
  2388. WARNING "Skipping NumPy installation, as requested..."
  2389. else
  2390. check_package_DEB python3-numpy
  2391. if [ $? -eq 0 ]; then
  2392. install_packages_DEB python3-numpy
  2393. else
  2394. WARNING "Sorry, using python package but no valid numpy package available!" \
  2395. " Use --build-numpy to force building of both Python and NumPy."
  2396. fi
  2397. fi
  2398. else
  2399. _do_compile_python=true
  2400. fi
  2401. fi
  2402. if $_do_compile_python; then
  2403. install_packages_DEB libffi-dev
  2404. compile_Python
  2405. PRINT ""
  2406. if [ "$NUMPY_SKIP" = true ]; then
  2407. WARNING "Skipping NumPy installation, as requested..."
  2408. else
  2409. compile_Numpy
  2410. fi
  2411. fi
  2412. PRINT ""
  2413. if [ "$BOOST_SKIP" = true ]; then
  2414. WARNING "Skipping Boost installation, as requested..."
  2415. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  2416. INFO "Forced Boost building, as requested..."
  2417. compile_Boost
  2418. else
  2419. check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
  2420. if [ $? -eq 0 ]; then
  2421. install_packages_DEB libboost-dev
  2422. boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
  2423. install_packages_DEB libboost-{filesystem,iostreams,locale,regex,system,thread,wave,program-options}$boost_version-dev
  2424. clean_Boost
  2425. else
  2426. compile_Boost
  2427. fi
  2428. fi
  2429. PRINT ""
  2430. if [ "$OCIO_SKIP" = true ]; then
  2431. WARNING "Skipping OpenColorIO installation, as requested..."
  2432. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  2433. INFO "Forced OpenColorIO building, as requested..."
  2434. compile_OCIO
  2435. else
  2436. # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
  2437. #check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
  2438. #if [ $? -eq 0 ]; then
  2439. #install_packages_DEB libopencolorio-dev
  2440. #clean_OCIO
  2441. #else
  2442. compile_OCIO
  2443. #fi
  2444. fi
  2445. PRINT ""
  2446. if [ "$OPENEXR_SKIP" = true ]; then
  2447. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  2448. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  2449. INFO "Forced ILMBase/OpenEXR building, as requested..."
  2450. compile_OPENEXR
  2451. else
  2452. check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN
  2453. if [ $? -eq 0 ]; then
  2454. install_packages_DEB libopenexr-dev
  2455. OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
  2456. ILMBASE_VERSION=$OPENEXR_VERSION
  2457. clean_OPENEXR
  2458. else
  2459. compile_OPENEXR
  2460. fi
  2461. fi
  2462. PRINT ""
  2463. if [ "$OIIO_SKIP" = true ]; then
  2464. WARNING "Skipping OpenImageIO installation, as requested..."
  2465. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  2466. INFO "Forced OpenImageIO building, as requested..."
  2467. compile_OIIO
  2468. else
  2469. # XXX Debian Testing / Ubuntu 16.04 pulls in WAY too many deps (gtk2/opencv ?!) incl. OCIO build against libyaml-cpp0.3 so build for now...
  2470. #check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  2471. #if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
  2472. # install_packages_DEB libopenimageio-dev
  2473. # clean_OIIO
  2474. #else
  2475. compile_OIIO
  2476. #fi
  2477. fi
  2478. PRINT ""
  2479. have_llvm=false
  2480. _do_compile_llvm=false
  2481. if [ "$LLVM_SKIP" = true ]; then
  2482. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  2483. OSL_SKIP=true
  2484. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  2485. INFO "Forced LLVM building, as requested..."
  2486. _do_compile_llvm=true
  2487. else
  2488. check_package_DEB clang-$LLVM_VERSION_MIN
  2489. if [ $? -eq 0 ]; then
  2490. install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang-$LLVM_VERSION_MIN
  2491. have_llvm=true
  2492. LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
  2493. clean_LLVM
  2494. else
  2495. _do_compile_llvm=true
  2496. fi
  2497. fi
  2498. if [ "$_do_compile_llvm" = true ]; then
  2499. install_packages_DEB libffi-dev
  2500. # LLVM can't find the debian ffi header dir
  2501. _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
  2502. PRINT ""
  2503. compile_LLVM
  2504. have_llvm=true
  2505. LLVM_VERSION_FOUND=$LLVM_VERSION
  2506. fi
  2507. PRINT ""
  2508. _do_compile_osl=false
  2509. if [ "$OSL_SKIP" = true ]; then
  2510. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  2511. elif [ "$OSL_FORCE_BUILD" = true ]; then
  2512. INFO "Forced OpenShadingLanguage building, as requested..."
  2513. _do_compile_osl=true
  2514. else
  2515. # No package currently!
  2516. _do_compile_osl=true
  2517. fi
  2518. if [ "$_do_compile_osl" = true ]; then
  2519. if [ "$have_llvm" = true ]; then
  2520. PRINT ""
  2521. compile_OSL
  2522. else
  2523. WARNING "No LLVM available, cannot build OSL!"
  2524. fi
  2525. fi
  2526. PRINT ""
  2527. if [ "$OSD_SKIP" = true ]; then
  2528. WARNING "Skipping OpenSubdiv installation, as requested..."
  2529. elif [ "$OSD_FORCE_BUILD" = true ]; then
  2530. INFO "Forced OpenSubdiv building, as requested..."
  2531. compile_OSD
  2532. else
  2533. # No package currently!
  2534. PRINT ""
  2535. compile_OSD
  2536. fi
  2537. PRINT ""
  2538. if [ "$OPENVDB_SKIP" = true ]; then
  2539. WARNING "Skipping OpenVDB installation, as requested..."
  2540. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  2541. INFO "Forced OpenVDB building, as requested..."
  2542. compile_OPENVDB
  2543. else
  2544. check_package_version_ge_DEB libopenvdb-dev $OPENVDB_VERSION_MIN
  2545. if [ $? -eq 0 ]; then
  2546. install_packages_DEB libopenvdb-dev libblosc-dev
  2547. clean_OPENVDB
  2548. else
  2549. compile_OPENVDB
  2550. fi
  2551. fi
  2552. PRINT ""
  2553. if [ "$ALEMBIC_SKIP" = true ]; then
  2554. WARNING "Skipping Alembic installation, as requested..."
  2555. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  2556. INFO "Forced Alembic building, as requested..."
  2557. compile_ALEMBIC
  2558. else
  2559. # No package currently, only HDF5!
  2560. compile_ALEMBIC
  2561. fi
  2562. if [ "$WITH_OPENCOLLADA" = true ]; then
  2563. _do_compile_collada=false
  2564. PRINT ""
  2565. if [ "$OPENCOLLADA_SKIP" = true ]; then
  2566. WARNING "Skipping OpenCOLLADA installation, as requested..."
  2567. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  2568. INFO "Forced OpenCollada building, as requested..."
  2569. _do_compile_collada=true
  2570. else
  2571. # No package currently!
  2572. _do_compile_collada=true
  2573. fi
  2574. if [ "$_do_compile_collada" = true ]; then
  2575. install_packages_DEB libpcre3-dev
  2576. # Find path to libxml shared lib...
  2577. _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
  2578. # No package
  2579. PRINT ""
  2580. compile_OpenCOLLADA
  2581. fi
  2582. fi
  2583. if [ "$WITH_EMBREE" = true ]; then
  2584. _do_compile_embree=false
  2585. PRINT ""
  2586. if [ "$EMBREE_SKIP" = true ]; then
  2587. WARNING "Skipping Embree installation, as requested..."
  2588. elif [ "$EMBREE_FORCE_BUILD" = true ]; then
  2589. INFO "Forced Embree building, as requested..."
  2590. _do_compile_embree=true
  2591. else
  2592. # No package currently!
  2593. _do_compile_embree=true
  2594. fi
  2595. if [ "$_do_compile_embree" = true ]; then
  2596. compile_Embree
  2597. fi
  2598. fi
  2599. PRINT ""
  2600. if [ "$FFMPEG_SKIP" = true ]; then
  2601. WARNING "Skipping FFMpeg installation, as requested..."
  2602. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  2603. INFO "Forced FFMpeg building, as requested..."
  2604. compile_FFmpeg
  2605. else
  2606. # XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual
  2607. check_package_DEB ffmpeg
  2608. if [ $? -eq 0 ]; then
  2609. check_package_version_ge_DEB ffmpeg $FFMPEG_VERSION_MIN
  2610. if [ $? -eq 0 ]; then
  2611. install_packages_DEB libavdevice-dev
  2612. clean_FFmpeg
  2613. else
  2614. compile_FFmpeg
  2615. fi
  2616. else
  2617. compile_FFmpeg
  2618. fi
  2619. fi
  2620. }
  2621. #### Install on RPM-like ####
  2622. rpm_flavour() {
  2623. if [ -f /etc/redhat-release ]; then
  2624. if [ "`grep '[6-7]\.' /etc/redhat-release`" ]; then
  2625. RPM="RHEL"
  2626. else
  2627. RPM="FEDORA"
  2628. fi
  2629. elif [ -f /etc/SuSE-release ]; then
  2630. RPM="SUSE"
  2631. fi
  2632. }
  2633. get_package_version_RPM() {
  2634. rpm_flavour
  2635. if [ "$RPM" = "RHEL" ]; then
  2636. yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2637. elif [ "$RPM" = "FEDORA" ]; then
  2638. dnf info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2639. elif [ "$RPM" = "SUSE" ]; then
  2640. zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
  2641. fi
  2642. }
  2643. check_package_RPM() {
  2644. rpm_flavour
  2645. if [ "$RPM" = "RHEL" ]; then
  2646. r=`yum info $1 | grep -c 'Summary'`
  2647. elif [ "$RPM" = "FEDORA" ]; then
  2648. r=`dnf info $1 | grep -c 'Summary'`
  2649. elif [ "$RPM" = "SUSE" ]; then
  2650. r=`zypper info $1 | grep -c 'Summary'`
  2651. fi
  2652. if [ $r -ge 1 ]; then
  2653. return 0
  2654. else
  2655. return 1
  2656. fi
  2657. }
  2658. check_package_version_match_RPM() {
  2659. v=`get_package_version_RPM $1`
  2660. if [ -z "$v" ]; then
  2661. return 1
  2662. fi
  2663. version_match $v $2
  2664. return $?
  2665. }
  2666. check_package_version_ge_RPM() {
  2667. v=`get_package_version_RPM $1`
  2668. if [ -z "$v" ]; then
  2669. return 1
  2670. fi
  2671. version_ge $v $2
  2672. return $?
  2673. }
  2674. check_package_version_ge_lt_RPM() {
  2675. v=`get_package_version_RPM $1`
  2676. if [ -z "$v" ]; then
  2677. return 1
  2678. fi
  2679. version_ge_lt $v $2 $3
  2680. return $?
  2681. }
  2682. install_packages_RPM() {
  2683. rpm_flavour
  2684. if [ ! $SUDO ]; then
  2685. WARNING "--no-sudo enabled, impossible to install $@, you'll have to do it yourself..."
  2686. fi
  2687. if [ "$RPM" = "RHEL" ]; then
  2688. $SUDO yum install -y $@
  2689. if [ $? -ge 1 ]; then
  2690. ERROR "yum failed to install requested packages, exiting."
  2691. exit 1
  2692. fi
  2693. elif [ "$RPM" = "FEDORA" ]; then
  2694. $SUDO dnf install -y $@
  2695. if [ $? -ge 1 ]; then
  2696. ERROR "dnf failed to install requested packages, exiting."
  2697. exit 1
  2698. fi
  2699. elif [ "$RPM" = "SUSE" ]; then
  2700. $SUDO zypper --non-interactive install --auto-agree-with-licenses $@
  2701. if [ $? -ge 1 ]; then
  2702. ERROR "zypper failed to install requested packages, exiting."
  2703. exit 1
  2704. fi
  2705. fi
  2706. }
  2707. install_RPM() {
  2708. PRINT ""
  2709. INFO "Installing dependencies for RPM-based distribution"
  2710. PRINT ""
  2711. PRINT "`eval _echo "$COMMON_INFO"`"
  2712. PRINT ""
  2713. if [ "$NO_CONFIRM" = false ]; then
  2714. read -p "Do you want to continue (Y/n)?"
  2715. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  2716. fi
  2717. # Enable non-free repositories for all flavours
  2718. if [ ! $SUDO ]; then
  2719. WARNING "--no-sudo enabled, impossible to install third party repositories, you'll have to do it yourself..."
  2720. else
  2721. rpm_flavour
  2722. if [ "$RPM" = "FEDORA" ]; then
  2723. _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
  2724. $SUDO dnf -y install --nogpgcheck \
  2725. http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
  2726. http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
  2727. $SUDO dnf -y update
  2728. elif [ "$RPM" = "RHEL" ]; then
  2729. if [ "`grep '6\.' /etc/redhat-release`" ]; then
  2730. ERROR "Building with GCC 4.4 is not supported!"
  2731. exit 1
  2732. else
  2733. $SUDO yum -y install --nogpgcheck \
  2734. http://download.fedoraproject.org/pub/epel/7/$(uname -i)/e/epel-release-7-6.noarch.rpm \
  2735. http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  2736. $SUDO yum -y update
  2737. fi
  2738. elif [ "$RPM" = "SUSE" ]; then
  2739. # Packman repo now includes name in link...
  2740. _suse_rel="`grep -w VERSION /etc/os-release | sed 's/[^0-9.]*//g'`"
  2741. _suse_name="`grep -w NAME /etc/os-release | gawk '{print $2}' | sed 's/\"//'`"
  2742. if [ $_suse_name ]; then
  2743. _suse_rel="${_suse_name}_${_suse_rel}"
  2744. fi
  2745. PRINT ""
  2746. INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/"
  2747. INFO "This is only needed if you do not already have a packman repository enabled..."
  2748. read -p "Do you want to add this repo (Y/n)?"
  2749. if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then
  2750. INFO " Installing packman..."
  2751. $SUDO zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_$_suse_rel/ packman
  2752. INFO " Done."
  2753. else
  2754. INFO " Skipping packman installation."
  2755. fi
  2756. $SUDO zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
  2757. fi
  2758. fi
  2759. # These libs should always be available in fedora/suse official repository...
  2760. OPENJPEG_DEV="openjpeg2-devel"
  2761. VORBIS_DEV="libvorbis-devel"
  2762. OGG_DEV="libogg-devel"
  2763. THEORA_DEV="libtheora-devel"
  2764. _packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
  2765. libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL-devel \
  2766. libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
  2767. wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
  2768. glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
  2769. libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel"
  2770. OPENJPEG_USE=true
  2771. VORBIS_USE=true
  2772. OGG_USE=true
  2773. THEORA_USE=true
  2774. if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
  2775. _packages="$_packages freetype-devel tbb-devel"
  2776. if [ "$WITH_JACK" = true ]; then
  2777. _packages="$_packages jack-audio-connection-kit-devel"
  2778. fi
  2779. PRINT ""
  2780. install_packages_RPM $_packages
  2781. PRINT ""
  2782. X264_DEV="x264-devel"
  2783. check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
  2784. if [ $? -eq 0 ]; then
  2785. install_packages_RPM $X264_DEV
  2786. X264_USE=true
  2787. fi
  2788. if [ "$WITH_ALL" = true ]; then
  2789. PRINT ""
  2790. XVID_DEV="xvidcore-devel"
  2791. check_package_RPM $XVID_DEV
  2792. if [ $? -eq 0 ]; then
  2793. install_packages_RPM $XVID_DEV
  2794. XVID_USE=true
  2795. fi
  2796. PRINT ""
  2797. MP3LAME_DEV="lame-devel"
  2798. check_package_RPM $MP3LAME_DEV
  2799. if [ $? -eq 0 ]; then
  2800. install_packages_RPM $MP3LAME_DEV
  2801. MP3LAME_USE=true
  2802. fi
  2803. fi
  2804. elif [ "$RPM" = "SUSE" ]; then
  2805. _packages="$_packages freetype2-devel"
  2806. PRINT ""
  2807. install_packages_RPM $_packages
  2808. PRINT ""
  2809. # Install TBB on openSUSE, from temporary repo
  2810. check_package_RPM tbb-devel
  2811. if [ $? -eq 0 ]; then
  2812. install_packages_RPM tbb-devel
  2813. else
  2814. $SUDO zypper ar -f http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_$_suse_rel/devel:libraries:c_c++.repo
  2815. $SUDO zypper -n --gpg-auto-import-keys install tbb-devel
  2816. $SUDO zypper rr devel_libraries_c_c++
  2817. fi
  2818. PRINT ""
  2819. X264_DEV="libx264-devel"
  2820. check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
  2821. if [ $? -eq 0 ]; then
  2822. install_packages_RPM $X264_DEV
  2823. X264_USE=true
  2824. fi
  2825. if [ "$WITH_ALL" = true ]; then
  2826. PRINT ""
  2827. XVID_DEV="libxvidcore-devel"
  2828. check_package_RPM $XVID_DEV
  2829. if [ $? -eq 0 ]; then
  2830. install_packages_RPM $XVID_DEV
  2831. XVID_USE=true
  2832. fi
  2833. PRINT ""
  2834. MP3LAME_DEV="libmp3lame-devel"
  2835. check_package_RPM $MP3LAME_DEV
  2836. if [ $? -eq 0 ]; then
  2837. install_packages_RPM $MP3LAME_DEV
  2838. MP3LAME_USE=true
  2839. fi
  2840. fi
  2841. fi
  2842. PRINT""
  2843. LIBSNDFILE_DEV="libsndfile-devel"
  2844. check_package_RPM $LIBSNDFILE_DEV
  2845. if [ $? -eq 0 ]; then
  2846. install_packages_RPM $LIBSNDFILE_DEV
  2847. fi
  2848. if [ "$WITH_ALL" = true ]; then
  2849. PRINT ""
  2850. VPX_DEV="libvpx-devel"
  2851. check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
  2852. if [ $? -eq 0 ]; then
  2853. install_packages_RPM $VPX_DEV
  2854. VPX_USE=true
  2855. fi
  2856. PRINT ""
  2857. install_packages_RPM libspnav-devel
  2858. fi
  2859. PRINT ""
  2860. CLANG_FORMAT="clang" # Yeah, on fedora/suse clang-format is part of main clang package...
  2861. check_package_version_ge_RPM $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN
  2862. if [ $? -eq 0 ]; then
  2863. install_packages_RPM $CLANG_FORMAT
  2864. else
  2865. PRINT ""
  2866. WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..."
  2867. PRINT ""
  2868. fi
  2869. PRINT ""
  2870. _do_compile_python=false
  2871. if [ "$PYTHON_SKIP" = true ]; then
  2872. WARNING "Skipping Python installation, as requested..."
  2873. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  2874. INFO "Forced Python/NumPy building, as requested..."
  2875. _do_compile_python=true
  2876. else
  2877. check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
  2878. if [ $? -eq 0 ]; then
  2879. install_packages_RPM python3-devel
  2880. clean_Python
  2881. PRINT ""
  2882. if [ "$NUMPY_SKIP" = true ]; then
  2883. WARNING "Skipping NumPy installation, as requested..."
  2884. else
  2885. check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
  2886. if [ $? -eq 0 ]; then
  2887. install_packages_RPM python3-numpy
  2888. else
  2889. WARNING "Sorry, using python package but no valid numpy package available!" \
  2890. " Use --build-numpy to force building of both Python and NumPy."
  2891. fi
  2892. fi
  2893. else
  2894. _do_compile_python=true
  2895. fi
  2896. fi
  2897. if [ "$_do_compile_python" = true ]; then
  2898. install_packages_RPM libffi-devel
  2899. compile_Python
  2900. PRINT ""
  2901. if [ "$NUMPY_SKIP" = true ]; then
  2902. WARNING "Skipping NumPy installation, as requested..."
  2903. else
  2904. compile_Numpy
  2905. fi
  2906. fi
  2907. PRINT ""
  2908. _do_compile_boost=false
  2909. if [ "$BOOST_SKIP" = true ]; then
  2910. WARNING "Skipping Boost installation, as requested..."
  2911. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  2912. INFO "Forced Boost building, as requested..."
  2913. _do_compile_boost=true
  2914. else
  2915. check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN
  2916. if [ $? -eq 0 ]; then
  2917. install_packages_RPM boost-devel
  2918. clean_Boost
  2919. else
  2920. _do_compile_boost=true
  2921. fi
  2922. fi
  2923. if [ "$_do_compile_boost" = true ]; then
  2924. if [ "$RPM" = "SUSE" ]; then
  2925. install_packages_RPM gcc-fortran
  2926. else
  2927. install_packages_RPM libquadmath-devel bzip2-devel
  2928. fi
  2929. PRINT ""
  2930. compile_Boost
  2931. fi
  2932. PRINT ""
  2933. if [ "$OCIO_SKIP" = true ]; then
  2934. WARNING "Skipping OpenColorIO installation, as requested..."
  2935. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  2936. INFO "Forced OpenColorIO building, as requested..."
  2937. compile_OCIO
  2938. else
  2939. if [ "$RPM" = "SUSE" ]; then
  2940. check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
  2941. if [ $? -eq 0 ]; then
  2942. install_packages_RPM OpenColorIO-devel
  2943. clean_OCIO
  2944. else
  2945. compile_OCIO
  2946. fi
  2947. # XXX Fedora/RHEL OCIO still depends on libyaml-cpp v0.3 even when system default is v0.5!
  2948. else
  2949. compile_OCIO
  2950. fi
  2951. fi
  2952. PRINT ""
  2953. if [ "$OPENEXR_SKIP" = true ]; then
  2954. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  2955. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  2956. INFO "Forced ILMBase/OpenEXR building, as requested..."
  2957. compile_OPENEXR
  2958. else
  2959. check_package_version_ge_RPM openexr-devel $OPENEXR_VERSION_MIN
  2960. if [ $? -eq 0 ]; then
  2961. install_packages_RPM openexr-devel
  2962. OPENEXR_VERSION=`get_package_version_RPM openexr-devel`
  2963. ILMBASE_VERSION=$OPENEXR_VERSION
  2964. clean_OPENEXR
  2965. else
  2966. compile_OPENEXR
  2967. fi
  2968. fi
  2969. PRINT ""
  2970. if [ "$OIIO_SKIP" = true ]; then
  2971. WARNING "Skipping OpenImageIO installation, as requested..."
  2972. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  2973. INFO "Forced OpenImageIO building, as requested..."
  2974. compile_OIIO
  2975. else
  2976. # XXX RPM distros pulls in too much and depends on old libs, so better to build for now...
  2977. #check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  2978. #if [ $? -eq 0 -a $_with_built_openexr == false ]; then
  2979. # install_packages_RPM OpenImageIO-devel
  2980. # clean_OIIO
  2981. #else
  2982. compile_OIIO
  2983. #fi
  2984. fi
  2985. PRINT ""
  2986. have_llvm=false
  2987. _do_compile_llvm=false
  2988. if [ "$LLVM_SKIP" = true ]; then
  2989. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  2990. OSL_SKIP=true
  2991. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  2992. INFO "Forced LLVM building, as requested..."
  2993. _do_compile_llvm=true
  2994. else
  2995. if [ "$RPM" = "SUSE" ]; then
  2996. CLANG_DEV="llvm-clang-devel"
  2997. else
  2998. CLANG_DEV="clang-devel"
  2999. fi
  3000. check_package_version_match_RPM $CLANG_DEV $LLVM_VERSION
  3001. if [ $? -eq 0 ]; then
  3002. install_packages_RPM llvm-devel $CLANG_DEV
  3003. have_llvm=true
  3004. LLVM_VERSION_FOUND=$LLVM_VERSION
  3005. clean_LLVM
  3006. else
  3007. _do_compile_llvm=true
  3008. fi
  3009. fi
  3010. if [ "$_do_compile_llvm" = true ]; then
  3011. install_packages_RPM libffi-devel
  3012. # LLVM can't find the fedora ffi header dir...
  3013. _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
  3014. PRINT ""
  3015. compile_LLVM
  3016. have_llvm=true
  3017. LLVM_VERSION_FOUND=$LLVM_VERSION
  3018. fi
  3019. PRINT ""
  3020. _do_compile_osl=false
  3021. if [ "$OSL_SKIP" = true ]; then
  3022. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  3023. elif [ "$OSL_FORCE_BUILD" = true ]; then
  3024. INFO "Forced OpenShadingLanguage building, as requested..."
  3025. _do_compile_osl=true
  3026. else
  3027. # No package currently!
  3028. _do_compile_osl=true
  3029. fi
  3030. if [ "$_do_compile_osl" = true ]; then
  3031. if [ "$have_llvm" = true ]; then
  3032. PRINT ""
  3033. compile_OSL
  3034. else
  3035. WARNING "No LLVM available, cannot build OSL!"
  3036. fi
  3037. fi
  3038. PRINT ""
  3039. if [ "$OSD_SKIP" = true ]; then
  3040. WARNING "Skipping OpenSubdiv installation, as requested..."
  3041. elif [ "$OSD_FORCE_BUILD" = true ]; then
  3042. INFO "Forced OpenSubdiv building, as requested..."
  3043. compile_OSD
  3044. else
  3045. # No package currently!
  3046. compile_OSD
  3047. fi
  3048. PRINT ""
  3049. if [ "$OPENVDB_SKIP" = true ]; then
  3050. WARNING "Skipping OpenVDB installation, as requested..."
  3051. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  3052. INFO "Forced OpenVDB building, as requested..."
  3053. compile_OPENVDB
  3054. else
  3055. # No package currently!
  3056. compile_OPENVDB
  3057. fi
  3058. PRINT ""
  3059. if [ "$ALEMBIC_SKIP" = true ]; then
  3060. WARNING "Skipping Alembic installation, as requested..."
  3061. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  3062. INFO "Forced Alembic building, as requested..."
  3063. compile_ALEMBIC
  3064. else
  3065. # No package currently!
  3066. compile_ALEMBIC
  3067. fi
  3068. if [ "$WITH_OPENCOLLADA" = true ]; then
  3069. PRINT ""
  3070. _do_compile_collada=false
  3071. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3072. WARNING "Skipping OpenCOLLADA installation, as requested..."
  3073. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  3074. INFO "Forced OpenCollada building, as requested..."
  3075. _do_compile_collada=true
  3076. else
  3077. # No package...
  3078. _do_compile_collada=true
  3079. fi
  3080. if [ "$_do_compile_collada" = true ]; then
  3081. install_packages_RPM pcre-devel
  3082. # Find path to libxml shared lib...
  3083. _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
  3084. PRINT ""
  3085. compile_OpenCOLLADA
  3086. fi
  3087. fi
  3088. if [ "$WITH_EMBREE" = true ]; then
  3089. PRINT ""
  3090. _do_compile_embree=false
  3091. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3092. WARNING "Skipping Embree installation, as requested..."
  3093. elif [ "$EMBREE_FORCE_BUILD" = true ]; then
  3094. INFO "Forced Embree building, as requested..."
  3095. _do_compile_embree=true
  3096. else
  3097. # No package...
  3098. _do_compile_embree=true
  3099. fi
  3100. if [ "$_do_compile_embree" = true ]; then
  3101. compile_Embree
  3102. fi
  3103. fi
  3104. PRINT ""
  3105. if [ "$FFMPEG_SKIP" = true ]; then
  3106. WARNING "Skipping FFMpeg installation, as requested..."
  3107. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  3108. INFO "Forced FFMpeg building, as requested..."
  3109. compile_FFmpeg
  3110. else
  3111. check_package_version_ge_RPM ffmpeg-devel $FFMPEG_VERSION_MIN
  3112. if [ $? -eq 0 ]; then
  3113. install_packages_RPM ffmpeg ffmpeg-devel
  3114. clean_FFmpeg
  3115. else
  3116. compile_FFmpeg
  3117. fi
  3118. fi
  3119. }
  3120. #### Install on ARCH-like ####
  3121. get_package_version_ARCH() {
  3122. pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+?(([0-9]+\.?)+).*/\1/'
  3123. }
  3124. check_package_ARCH() {
  3125. r=`pacman -Si $1 | grep -c 'Description'`
  3126. if [ $r -ge 1 ]; then
  3127. return 0
  3128. else
  3129. return 1
  3130. fi
  3131. }
  3132. check_package_version_match_ARCH() {
  3133. v=`get_package_version_ARCH $1`
  3134. if [ -z "$v" ]; then
  3135. return 1
  3136. fi
  3137. version_match $v $2
  3138. return $?
  3139. }
  3140. check_package_version_ge_ARCH() {
  3141. v=`get_package_version_ARCH $1`
  3142. if [ -z "$v" ]; then
  3143. return 1
  3144. fi
  3145. version_ge $v $2
  3146. return $?
  3147. }
  3148. check_package_version_ge_lt_ARCH() {
  3149. v=`get_package_version_ARCH $1`
  3150. if [ -z "$v" ]; then
  3151. return 1
  3152. fi
  3153. version_ge_lt $v $2 $3
  3154. return $?
  3155. }
  3156. install_packages_ARCH() {
  3157. if [ ! $SUDO ]; then
  3158. WARNING "--no-sudo enabled, impossible to run pacman for $@, you'll have to do it yourself..."
  3159. else
  3160. $SUDO pacman -S --needed --noconfirm $@
  3161. if [ $? -ge 1 ]; then
  3162. ERROR "pacman failed to install requested packages, exiting."
  3163. exit 1
  3164. fi
  3165. fi
  3166. }
  3167. install_ARCH() {
  3168. PRINT ""
  3169. INFO "Installing dependencies for ARCH-based distribution"
  3170. PRINT ""
  3171. PRINT "`eval _echo "$COMMON_INFO"`"
  3172. PRINT ""
  3173. if [ "$NO_CONFIRM" = false ]; then
  3174. read -p "Do you want to continue (Y/n)?"
  3175. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  3176. fi
  3177. # Check for sudo...
  3178. if [ $SUDO ]; then
  3179. if [ ! -x "/usr/bin/sudo" ]; then
  3180. PRINT ""
  3181. ERROR "This script requires sudo but it is not installed."
  3182. PRINT "Please setup sudo according to:"
  3183. PRINT "https://wiki.archlinux.org/index.php/Sudo"
  3184. PRINT "and try again."
  3185. PRINT ""
  3186. exit
  3187. fi
  3188. fi
  3189. if [ ! $SUDO ]; then
  3190. WARNING "--no-sudo enabled, impossible to run pacman -Sy, you'll have to do it yourself..."
  3191. else
  3192. $SUDO pacman -Sy
  3193. fi
  3194. # These libs should always be available in arch official repository...
  3195. OPENJPEG_DEV="openjpeg2"
  3196. VORBIS_DEV="libvorbis"
  3197. OGG_DEV="libogg"
  3198. THEORA_DEV="libtheora"
  3199. BASE_DEVEL="base-devel"
  3200. # Avoid conflicts when gcc-multilib is installed
  3201. pacman -Qi gcc-multilib &>/dev/null
  3202. if [ $? -eq 0 ]; then
  3203. BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
  3204. fi
  3205. _packages="$BASE_DEVEL git cmake \
  3206. libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
  3207. $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw intel-tbb \
  3208. libxml2 yaml-cpp tinyxml python-requests jemalloc"
  3209. OPENJPEG_USE=true
  3210. VORBIS_USE=true
  3211. OGG_USE=true
  3212. THEORA_USE=true
  3213. if [ "$WITH_ALL" = true ]; then
  3214. _packages="$_packages libspnav"
  3215. fi
  3216. if [ "$WITH_JACK" = true ]; then
  3217. _packages="$_packages jack"
  3218. fi
  3219. PRINT ""
  3220. install_packages_ARCH $_packages
  3221. PRINT""
  3222. LIBSNDFILE_DEV="libsndfile"
  3223. check_package_ARCH $LIBSNDFILE_DEV
  3224. if [ $? -eq 0 ]; then
  3225. install_packages_ARCH $LIBSNDFILE_DEV
  3226. fi
  3227. PRINT ""
  3228. X264_DEV="x264"
  3229. check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN
  3230. if [ $? -eq 0 ]; then
  3231. install_packages_ARCH $X264_DEV
  3232. X264_USE=true
  3233. fi
  3234. if [ "$WITH_ALL" = true ]; then
  3235. PRINT ""
  3236. XVID_DEV="xvidcore"
  3237. check_package_ARCH $XVID_DEV
  3238. if [ $? -eq 0 ]; then
  3239. install_packages_ARCH $XVID_DEV
  3240. XVID_USE=true
  3241. fi
  3242. PRINT ""
  3243. MP3LAME_DEV="lame"
  3244. check_package_ARCH $MP3LAME_DEV
  3245. if [ $? -eq 0 ]; then
  3246. install_packages_ARCH $MP3LAME_DEV
  3247. MP3LAME_USE=true
  3248. fi
  3249. PRINT ""
  3250. VPX_DEV="libvpx"
  3251. check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN
  3252. if [ $? -eq 0 ]; then
  3253. install_packages_ARCH $VPX_DEV
  3254. VPX_USE=true
  3255. fi
  3256. fi
  3257. PRINT ""
  3258. CLANG_FORMAT="clang" # Yeah, on arch clang-format is part of main clang package...
  3259. check_package_version_ge_ARCH $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN
  3260. if [ $? -eq 0 ]; then
  3261. install_packages_ARCH $CLANG_FORMAT
  3262. else
  3263. PRINT ""
  3264. WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..."
  3265. PRINT ""
  3266. fi
  3267. PRINT ""
  3268. _do_compile_python=false
  3269. if [ "$PYTHON_SKIP" = true ]; then
  3270. WARNING "Skipping Python installation, as requested..."
  3271. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  3272. INFO "Forced Python/NumPy building, as requested..."
  3273. _do_compile_python=true
  3274. else
  3275. check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
  3276. if [ $? -eq 0 ]; then
  3277. install_packages_ARCH python
  3278. clean_Python
  3279. PRINT ""
  3280. if [ "$NUMPY_SKIP" = true ]; then
  3281. WARNING "Skipping NumPy installation, as requested..."
  3282. else
  3283. check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN
  3284. if [ $? -eq 0 ]; then
  3285. install_packages_ARCH python-numpy
  3286. else
  3287. WARNING "Sorry, using python package but no valid numpy package available!" \
  3288. "Use --build-numpy to force building of both Python and NumPy."
  3289. fi
  3290. fi
  3291. else
  3292. _do_compile_python=true
  3293. fi
  3294. fi
  3295. if [ "$_do_compile_python" = true ]; then
  3296. install_packages_ARCH libffi
  3297. compile_Python
  3298. PRINT ""
  3299. if [ "$NUMPY_SKIP" = true ]; then
  3300. WARNING "Skipping NumPy installation, as requested..."
  3301. else
  3302. compile_Numpy
  3303. fi
  3304. fi
  3305. PRINT ""
  3306. if [ "$BOOST_SKIP" = true ]; then
  3307. WARNING "Skipping Boost installation, as requested..."
  3308. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  3309. INFO "Forced Boost building, as requested..."
  3310. compile_Boost
  3311. else
  3312. check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
  3313. if [ $? -eq 0 ]; then
  3314. install_packages_ARCH boost
  3315. clean_Boost
  3316. else
  3317. compile_Boost
  3318. fi
  3319. fi
  3320. PRINT ""
  3321. if [ "$OCIO_SKIP" = true ]; then
  3322. WARNING "Skipping OpenColorIO installation, as requested..."
  3323. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  3324. INFO "Forced OpenColorIO building, as requested..."
  3325. compile_OCIO
  3326. else
  3327. check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
  3328. if [ $? -eq 0 ]; then
  3329. install_packages_ARCH opencolorio
  3330. clean_OCIO
  3331. else
  3332. compile_OCIO
  3333. fi
  3334. fi
  3335. PRINT ""
  3336. if [ "$OPENEXR_SKIP" = true ]; then
  3337. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  3338. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  3339. INFO "Forced ILMBase/OpenEXR building, as requested..."
  3340. compile_OPENEXR
  3341. else
  3342. check_package_version_ge_ARCH openexr $OPENEXR_VERSION_MIN
  3343. if [ $? -eq 0 ]; then
  3344. install_packages_ARCH openexr
  3345. OPENEXR_VERSION=`get_package_version_ARCH openexr`
  3346. ILMBASE_VERSION=$OPENEXR_VERSION
  3347. clean_OPENEXR
  3348. else
  3349. compile_OPENEXR
  3350. fi
  3351. fi
  3352. PRINT ""
  3353. if [ "$OIIO_SKIP" = true ]; then
  3354. WARNING "Skipping OpenImageIO installation, as requested..."
  3355. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  3356. INFO "Forced OpenImageIO building, as requested..."
  3357. compile_OIIO
  3358. else
  3359. check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
  3360. if [ $? -eq 0 ]; then
  3361. install_packages_ARCH openimageio
  3362. clean_OIIO
  3363. else
  3364. compile_OIIO
  3365. fi
  3366. fi
  3367. PRINT ""
  3368. have_llvm=false
  3369. _do_compile_llvm=false
  3370. if [ "$LLVM_SKIP" = true ]; then
  3371. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  3372. OSL_SKIP=true
  3373. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  3374. INFO "Forced LLVM building, as requested..."
  3375. _do_compile_llvm=true
  3376. else
  3377. check_package_version_match_ARCH llvm $LLVM_VERSION_MIN
  3378. if [ $? -eq 0 ]; then
  3379. install_packages_ARCH llvm clang
  3380. have_llvm=true
  3381. LLVM_VERSION=`get_package_version_ARCH llvm`
  3382. LLVM_VERSION_FOUND=$LLVM_VERSION
  3383. clean_LLVM
  3384. else
  3385. _do_compile_llvm=true
  3386. fi
  3387. fi
  3388. if [ "$_do_compile_llvm" = true ]; then
  3389. install_packages_ARCH libffi
  3390. # LLVM can't find the arch ffi header dir...
  3391. _FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'`
  3392. PRINT ""
  3393. compile_LLVM
  3394. have_llvm=true
  3395. LLVM_VERSION_FOUND=$LLVM_VERSION
  3396. fi
  3397. PRINT ""
  3398. _do_compile_osl=false
  3399. if [ "$OSL_SKIP" = true ]; then
  3400. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  3401. elif [ "$OSL_FORCE_BUILD" = true ]; then
  3402. INFO "Forced OpenShadingLanguage building, as requested..."
  3403. _do_compile_osl=true
  3404. else
  3405. # XXX Compile for now due to requirement of LLVM 3.4 ...
  3406. #check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
  3407. #if [ $? -eq 0 ]; then
  3408. # install_packages_ARCH openshadinglanguage
  3409. # clean_OSL
  3410. #else
  3411. _do_compile_osl=true
  3412. #fi
  3413. fi
  3414. if [ "$_do_compile_osl" = true ]; then
  3415. if [ "$have_llvm" = true ]; then
  3416. PRINT ""
  3417. compile_OSL
  3418. else
  3419. WARNING "No LLVM available, cannot build OSL!"
  3420. fi
  3421. fi
  3422. PRINT ""
  3423. if [ "$OSD_SKIP" = true ]; then
  3424. WARNING "Skipping OpenSubdiv installation, as requested..."
  3425. elif [ "$OSD_FORCE_BUILD" = true ]; then
  3426. INFO "Forced OpenSubdiv building, as requested..."
  3427. compile_OSD
  3428. else
  3429. check_package_version_ge_ARCH opensubdiv $OSD_VERSION_MIN
  3430. if [ $? -eq 0 ]; then
  3431. install_packages_ARCH opensubdiv
  3432. clean_OSD
  3433. else
  3434. compile_OSD
  3435. fi
  3436. fi
  3437. PRINT ""
  3438. if [ "$OPENVDB_SKIP" = true ]; then
  3439. WARNING "Skipping OpenVDB installation, as requested..."
  3440. elif [ "$OPENVDB_FORCE_BUILD" = true ]; then
  3441. INFO "Forced OpenVDB building, as requested..."
  3442. compile_OPENVDB
  3443. else
  3444. check_package_version_ge_ARCH openvdb $OPENVDB_VERSION_MIN
  3445. if [ $? -eq 0 ]; then
  3446. install_packages_ARCH openvdb
  3447. clean_OPENVDB
  3448. else
  3449. compile_OPENVDB
  3450. fi
  3451. fi
  3452. PRINT ""
  3453. if [ "$ALEMBIC_SKIP" = true ]; then
  3454. WARNING "Skipping Alembic installation, as requested..."
  3455. elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
  3456. INFO "Forced Alembic building, as requested..."
  3457. compile_ALEMBIC
  3458. else
  3459. compile_ALEMBIC
  3460. fi
  3461. if [ "$WITH_OPENCOLLADA" = true ]; then
  3462. PRINT ""
  3463. _do_compile_collada=false
  3464. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3465. WARNING "Skipping OpenCOLLADA installation, as requested..."
  3466. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  3467. INFO "Forced OpenCollada building, as requested..."
  3468. _do_compile_collada=true
  3469. else
  3470. check_package_ARCH opencollada
  3471. if [ $? -eq 0 ]; then
  3472. install_packages_ARCH opencollada
  3473. clean_OpenCOLLADA
  3474. else
  3475. _do_compile_collada=true
  3476. fi
  3477. fi
  3478. if [ "$_do_compile_collada" = true ]; then
  3479. install_packages_ARCH pcre
  3480. # Find path to libxml shared lib...
  3481. _XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'`
  3482. PRINT ""
  3483. compile_OpenCOLLADA
  3484. fi
  3485. fi
  3486. if [ "$WITH_EMBREE" = true ]; then
  3487. PRINT ""
  3488. _do_compile_embree=false
  3489. if [ "$EMBREE_SKIP" = true ]; then
  3490. WARNING "Skipping Embree installation, as requested..."
  3491. elif [ "$EMBREE_FORCE_BUILD" = true ]; then
  3492. INFO "Forced Embree building, as requested..."
  3493. _do_compile_embree=true
  3494. else
  3495. check_package_ARCH embree
  3496. if [ $? -eq 0 ]; then
  3497. install_packages_ARCH embree
  3498. clean_Embree
  3499. else
  3500. _do_compile_embree=true
  3501. fi
  3502. fi
  3503. if [ "$_do_compile_embree" = true ]; then
  3504. compile_Embree
  3505. fi
  3506. fi
  3507. PRINT ""
  3508. if [ "$FFMPEG_SKIP" = true ]; then
  3509. WARNING "Skipping FFMpeg installation, as requested..."
  3510. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  3511. INFO "Forced FFMpeg building, as requested..."
  3512. compile_FFmpeg
  3513. else
  3514. check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
  3515. if [ $? -eq 0 ]; then
  3516. install_packages_ARCH ffmpeg
  3517. clean_FFmpeg
  3518. else
  3519. compile_FFmpeg
  3520. fi
  3521. fi
  3522. }
  3523. #### Install on other distro (very limited!) ####
  3524. install_OTHER() {
  3525. PRINT ""
  3526. WARNING "Attempt to build main dependencies for other linux distributions."
  3527. PRINT ""
  3528. PRINT "`eval _echo "$COMMON_INFO"`"
  3529. PRINT ""
  3530. ERROR "Failed to detect distribution type."
  3531. PRINT ""
  3532. PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
  3533. PRINT "dev packages yourself. However, this script can still attempt to build main (complex) libraries for you,"
  3534. PRINT "if you use '--build-foo' options (you can try '--build-all' one first)."
  3535. PRINT ""
  3536. PRINT "Quite obviously, it assumes dependencies from those libraries are already available, otherwise please"
  3537. PRINT "install them (you can also use error messages printed out by build process to find missing libraries...)."
  3538. PRINT ""
  3539. PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
  3540. PRINT ""
  3541. PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
  3542. PRINT ""
  3543. if [ "$NO_CONFIRM" = false ]; then
  3544. read -p "Do you want to continue (Y/n)?"
  3545. [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
  3546. fi
  3547. PRINT ""
  3548. _do_compile_python=false
  3549. if [ "$PYTHON_SKIP" = true ]; then
  3550. WARNING "Skipping Python/NumPy installation, as requested..."
  3551. elif [ "$PYTHON_FORCE_BUILD" = true ]; then
  3552. INFO "Forced Python/NumPy building, as requested..."
  3553. _do_compile_python=true
  3554. fi
  3555. if [ "$_do_compile_python" = true ]; then
  3556. compile_Python
  3557. PRINT ""
  3558. if [ "$NUMPY_SKIP" = true ]; then
  3559. WARNING "Skipping NumPy installation, as requested..."
  3560. else
  3561. compile_Numpy
  3562. fi
  3563. fi
  3564. PRINT ""
  3565. if [ "$BOOST_SKIP" = true ]; then
  3566. WARNING "Skipping Boost installation, as requested..."
  3567. elif [ "$BOOST_FORCE_BUILD" = true ]; then
  3568. INFO "Forced Boost building, as requested..."
  3569. compile_Boost
  3570. fi
  3571. PRINT ""
  3572. if [ "$OCIO_SKIP" = true ]; then
  3573. WARNING "Skipping OpenColorIO installation, as requested..."
  3574. elif [ "$OCIO_FORCE_BUILD" = true ]; then
  3575. INFO "Forced OpenColorIO building, as requested..."
  3576. compile_OCIO
  3577. fi
  3578. PRINT ""
  3579. if [ "$OPENEXR_SKIP" = true ]; then
  3580. WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
  3581. elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
  3582. INFO "Forced ILMBase/OpenEXR building, as requested..."
  3583. compile_OPENEXR
  3584. fi
  3585. PRINT ""
  3586. if [ "$OIIO_SKIP" = true ]; then
  3587. WARNING "Skipping OpenImageIO installation, as requested..."
  3588. elif [ "$OIIO_FORCE_BUILD" = true ]; then
  3589. INFO "Forced OpenImageIO building, as requested..."
  3590. compile_OIIO
  3591. fi
  3592. PRINT ""
  3593. have_llvm=false
  3594. _do_compile_llvm=false
  3595. if [ "$LLVM_SKIP" = true ]; then
  3596. WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
  3597. elif [ "$LLVM_FORCE_BUILD" = true ]; then
  3598. INFO "Forced LLVM building, as requested..."
  3599. _do_compile_llvm=true
  3600. fi
  3601. if [ "$_do_compile_llvm" = true ]; then
  3602. PRINT ""
  3603. compile_LLVM
  3604. have_llvm=true
  3605. LLVM_VERSION_FOUND=$LLVM_VERSION
  3606. fi
  3607. PRINT ""
  3608. _do_compile_osl=false
  3609. if [ "$OSL_SKIP" = true ]; then
  3610. WARNING "Skipping OpenShadingLanguage installation, as requested..."
  3611. elif [ "$OSL_FORCE_BUILD" = true ]; then
  3612. INFO "Forced OpenShadingLanguage building, as requested..."
  3613. _do_compile_osl=true
  3614. fi
  3615. if [ "$_do_compile_osl" = true ]; then
  3616. if [ "$have_llvm" = true ]; then
  3617. PRINT ""
  3618. compile_OSL
  3619. else
  3620. WARNING "No LLVM available, cannot build OSL!"
  3621. fi
  3622. fi
  3623. PRINT ""
  3624. _do_compile_osd=false
  3625. if [ "$OSD_SKIP" = true ]; then
  3626. WARNING "Skipping OpenSubdiv installation, as requested..."
  3627. elif [ "$OSD_FORCE_BUILD" = true ]; then
  3628. INFO "Forced OpenSubdiv building, as requested..."
  3629. _do_compile_osd=true
  3630. fi
  3631. if [ "$_do_compile_osd" = true ]; then
  3632. PRINT ""
  3633. compile_OSD
  3634. fi
  3635. if [ "$WITH_OPENCOLLADA" = true ]; then
  3636. _do_compile_collada=false
  3637. PRINT ""
  3638. if [ "$OPENCOLLADA_SKIP" = true ]; then
  3639. WARNING "Skipping OpenCOLLADA installation, as requested..."
  3640. elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
  3641. INFO "Forced OpenCollada building, as requested..."
  3642. _do_compile_collada=true
  3643. fi
  3644. if [ "$_do_compile_collada" = true ]; then
  3645. PRINT ""
  3646. compile_OpenCOLLADA
  3647. fi
  3648. fi
  3649. if [ "$WITH_EMBREE" = true ]; then
  3650. _do_compile_embree=false
  3651. PRINT ""
  3652. if [ "$EMBREE_SKIP" = true ]; then
  3653. WARNING "Skipping Embree installation, as requested..."
  3654. elif [ "$EMBREE_FORCE_BUILD" = true ]; then
  3655. INFO "Forced Embree building, as requested..."
  3656. _do_compile_embree=true
  3657. fi
  3658. if [ "$_do_compile_embree" = true ]; then
  3659. PRINT ""
  3660. compile_Embree
  3661. fi
  3662. fi
  3663. PRINT ""
  3664. if [ "$FFMPEG_SKIP" = true ]; then
  3665. WARNING "Skipping FFMpeg installation, as requested..."
  3666. elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
  3667. INFO "Forced FFMpeg building, as requested..."
  3668. compile_FFmpeg
  3669. fi
  3670. }
  3671. #### Printing User Info ####
  3672. print_info_ffmpeglink_DEB() {
  3673. dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3674. }
  3675. print_info_ffmpeglink_RPM() {
  3676. rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3677. }
  3678. print_info_ffmpeglink_ARCH() {
  3679. pacman -Ql $_packages | grep -e ".*\/lib[^\/]\+\.so$" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
  3680. }
  3681. print_info_ffmpeglink() {
  3682. # This func must only print a ';'-separated list of libs...
  3683. if [ -z "$DISTRO" ]; then
  3684. ERROR "Failed to detect distribution type"
  3685. exit 1
  3686. fi
  3687. # Create list of packages from which to get libs names...
  3688. _packages=""
  3689. if [ "$THEORA_USE" = true ]; then
  3690. _packages="$_packages $THEORA_DEV"
  3691. fi
  3692. if [ "$VORBIS_USE" = true ]; then
  3693. _packages="$_packages $VORBIS_DEV"
  3694. fi
  3695. if [ "$OGG_USE" = true ]; then
  3696. _packages="$_packages $OGG_DEV"
  3697. fi
  3698. if [ "$XVID_USE" = true ]; then
  3699. _packages="$_packages $XVID_DEV"
  3700. fi
  3701. if [ "$VPX_USE" = true ]; then
  3702. _packages="$_packages $VPX_DEV"
  3703. fi
  3704. if [ "$MP3LAME_USE" = true ]; then
  3705. _packages="$_packages $MP3LAME_DEV"
  3706. fi
  3707. if [ "$X264_USE" = true ]; then
  3708. _packages="$_packages $X264_DEV"
  3709. fi
  3710. if [ "$OPENJPEG_USE" = true ]; then
  3711. _packages="$_packages $OPENJPEG_DEV"
  3712. fi
  3713. if [ "$DISTRO" = "DEB" ]; then
  3714. print_info_ffmpeglink_DEB
  3715. elif [ "$DISTRO" = "RPM" ]; then
  3716. print_info_ffmpeglink_RPM
  3717. elif [ "$DISTRO" = "ARCH" ]; then
  3718. print_info_ffmpeglink_ARCH
  3719. # XXX TODO!
  3720. else
  3721. PRINT "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
  3722. fi
  3723. }
  3724. print_info() {
  3725. PRINT ""
  3726. PRINT ""
  3727. PRINT "Ran with:"
  3728. PRINT " install_deps.sh $COMMANDLINE"
  3729. PRINT ""
  3730. PRINT ""
  3731. PRINT "If you're using CMake add this to your configuration flags:"
  3732. _buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
  3733. _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
  3734. _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
  3735. _1="-D WITH_CODEC_SNDFILE=ON"
  3736. PRINT " $_1"
  3737. _buildargs="$_buildargs $_1"
  3738. _1="-D PYTHON_VERSION=$PYTHON_VERSION_MIN"
  3739. PRINT " $_1"
  3740. _buildargs="$_buildargs $_1"
  3741. if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
  3742. _1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_MIN"
  3743. PRINT " $_1"
  3744. _buildargs="$_buildargs $_1"
  3745. fi
  3746. if [ -d $INST/boost ]; then
  3747. _1="-D BOOST_ROOT=$INST/boost"
  3748. _2="-D Boost_NO_SYSTEM_PATHS=ON"
  3749. PRINT " $_1"
  3750. PRINT " $_2"
  3751. _buildargs="$_buildargs $_1 $_2"
  3752. fi
  3753. if [ "$OCIO_SKIP" = false ]; then
  3754. _1="-D WITH_OPENCOLORIO=ON"
  3755. PRINT " $_1"
  3756. _buildargs="$_buildargs $_1"
  3757. if [ -d $INST/ocio ]; then
  3758. _1="-D OPENCOLORIO_ROOT_DIR=$INST/ocio"
  3759. PRINT " $_1"
  3760. _buildargs="$_buildargs $_1"
  3761. fi
  3762. fi
  3763. if [ -d $INST/openexr ]; then
  3764. _1="-D OPENEXR_ROOT_DIR=$INST/openexr"
  3765. PRINT " $_1"
  3766. _buildargs="$_buildargs $_1"
  3767. fi
  3768. if [ -d $INST/oiio ]; then
  3769. _1="-D WITH_OPENIMAGEIO=ON"
  3770. _2="-D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
  3771. PRINT " $_1"
  3772. PRINT " $_2"
  3773. _buildargs="$_buildargs $_1 $_2"
  3774. fi
  3775. if [ "$OSL_SKIP" = false ]; then
  3776. _1="-D WITH_CYCLES_OSL=ON"
  3777. _2="-D WITH_LLVM=ON"
  3778. _3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
  3779. PRINT " $_1"
  3780. PRINT " $_2"
  3781. PRINT " $_3"
  3782. _buildargs="$_buildargs $_1 $_2 $_3"
  3783. if [ -d $INST/osl ]; then
  3784. _1="-D OSL_ROOT_DIR=$INST/osl"
  3785. PRINT " $_1"
  3786. _buildargs="$_buildargs $_1"
  3787. fi
  3788. if [ -d $INST/llvm ]; then
  3789. _1="-D LLVM_ROOT_DIR=$INST/llvm"
  3790. _2="-D LLVM_STATIC=ON"
  3791. PRINT " $_1"
  3792. PRINT " $_2"
  3793. _buildargs="$_buildargs $_1 $_2"
  3794. fi
  3795. else
  3796. _1="-D WITH_CYCLES_OSL=OFF"
  3797. _2="-D WITH_LLVM=OFF"
  3798. PRINT " $_1"
  3799. PRINT " $_2"
  3800. _buildargs="$_buildargs $_1 $_2"
  3801. fi
  3802. if [ "$OSD_SKIP" = false ]; then
  3803. _1="-D WITH_OPENSUBDIV=ON"
  3804. PRINT " $_1"
  3805. _buildargs="$_buildargs $_1"
  3806. if [ -d $INST/osd ]; then
  3807. _1="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
  3808. PRINT " $_1"
  3809. _buildargs="$_buildargs $_1"
  3810. fi
  3811. fi
  3812. if [ "$OPENVDB_SKIP" = false ]; then
  3813. _1="-D WITH_OPENVDB=ON"
  3814. _2="-D WITH_OPENVDB_BLOSC=ON"
  3815. PRINT " $_1"
  3816. PRINT " $_2"
  3817. _buildargs="$_buildargs $_1 $_2"
  3818. if [ -d $INST/openvdb ]; then
  3819. _1="-D OPENVDB_ROOT_DIR=$INST/openvdb"
  3820. PRINT " $_1"
  3821. _buildargs="$_buildargs $_1"
  3822. fi
  3823. if [ -d $INST/blosc ]; then
  3824. _1="-D BLOSC_ROOT_DIR=$INST/blosc"
  3825. PRINT " $_1"
  3826. _buildargs="$_buildargs $_1"
  3827. fi
  3828. fi
  3829. if [ "$WITH_OPENCOLLADA" = true ]; then
  3830. _1="-D WITH_OPENCOLLADA=ON"
  3831. PRINT " $_1"
  3832. _buildargs="$_buildargs $_1"
  3833. if [ -d $INST/opencollada ]; then
  3834. _1="-D OPENCOLLADA_ROOT_DIR=$INST/opencollada"
  3835. PRINT " $_1"
  3836. _buildargs="$_buildargs $_1"
  3837. fi
  3838. fi
  3839. if [ "$WITH_EMBREE" = true ]; then
  3840. _1="-D WITH_CYCLES_EMBREE=ON"
  3841. PRINT " $_1"
  3842. _buildargs="$_buildargs $_1"
  3843. if [ -d $INST/embree ]; then
  3844. _1="-D EMBREE_ROOT_DIR=$INST/embree"
  3845. PRINT " $_1"
  3846. _buildargs="$_buildargs $_1"
  3847. fi
  3848. fi
  3849. if [ "$WITH_JACK" = true ]; then
  3850. _1="-D WITH_JACK=ON"
  3851. _2="-D WITH_JACK_DYNLOAD=ON"
  3852. PRINT " $_1"
  3853. PRINT " $_2"
  3854. _buildargs="$_buildargs $_1 $_2"
  3855. fi
  3856. if [ "$ALEMBIC_SKIP" = false ]; then
  3857. _1="-D WITH_ALEMBIC=ON"
  3858. PRINT " $_1"
  3859. _buildargs="$_buildargs $_1"
  3860. if [ -d $INST/alembic ]; then
  3861. _1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
  3862. PRINT " $_1"
  3863. _buildargs="$_buildargs $_1"
  3864. fi
  3865. fi
  3866. if [ "$NO_SYSTEM_GLEW" = true ]; then
  3867. _1="-D WITH_SYSTEM_GLEW=OFF"
  3868. PRINT " $_1"
  3869. _buildargs="$_buildargs $_1"
  3870. fi
  3871. if [ "$FFMPEG_SKIP" = false ]; then
  3872. _1="-D WITH_CODEC_FFMPEG=ON"
  3873. _2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
  3874. PRINT " $_1"
  3875. PRINT " $_2"
  3876. _buildargs="$_buildargs $_1 $_2"
  3877. if [ -d $INST/ffmpeg ]; then
  3878. _1="-D FFMPEG=$INST/ffmpeg"
  3879. PRINT " $_1"
  3880. _buildargs="$_buildargs $_1"
  3881. fi
  3882. fi
  3883. PRINT ""
  3884. PRINT "Or even simpler, just run (in your blender-source dir):"
  3885. PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
  3886. PRINT ""
  3887. PRINT "Or in all your build directories:"
  3888. PRINT " cmake $_buildargs ."
  3889. }
  3890. #### "Main" ####
  3891. # Detect distribution type used on this machine
  3892. if [ -f /etc/debian_version ]; then
  3893. DISTRO="DEB"
  3894. install_DEB
  3895. elif [ -f /etc/arch-release ]; then
  3896. DISTRO="ARCH"
  3897. install_ARCH
  3898. elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
  3899. DISTRO="RPM"
  3900. install_RPM
  3901. else
  3902. DISTRO="OTHER"
  3903. install_OTHER
  3904. fi
  3905. print_info | tee $INFO_PATH/BUILD_NOTES.txt
  3906. PRINT ""
  3907. PRINT "This information has been written to $INFO_PATH/BUILD_NOTES.txt"
  3908. PRINT ""
  3909. # Switch back to user language.
  3910. LANG=LANG_BACK
  3911. export LANG
  3912. CXXFLAGS=$CXXFLAGS_BACK
  3913. export CXXFLAGS